Backed out 4 changesets (bug 1269975) for bustage.

Backed out changeset a55ecedea260 (bug 1269975)
Backed out changeset 5321545b938c (bug 1269975)
Backed out changeset 7e4a2ee61ef3 (bug 1269975)
Backed out changeset d181f8e7e4c3 (bug 1269975)
This commit is contained in:
Ryan VanderMeulen 2016-05-10 00:08:54 -04:00
parent 9e2a1c4966
commit f514ed495c
26 changed files with 177 additions and 176 deletions

View File

@ -101,7 +101,7 @@ public:
if (mSubpropertyCount[aProperty] == 0) {
uint32_t count = 0;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
p, aProperty, CSSEnabledState::eForAllContent) {
p, aProperty, nsCSSProps::eEnabledForAllContent) {
++count;
}
mSubpropertyCount[aProperty] = count;
@ -492,13 +492,13 @@ KeyframeUtils::GetAnimationPropertiesFromKeyframes(
if (nsCSSProps::IsShorthand(pair.mProperty)) {
nsCSSValueTokenStream* tokenStream = pair.mValue.GetTokenStreamValue();
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
CSSEnabledState::eForAllContent, aElement, aStyleContext,
nsCSSProps::eEnabledForAllContent, aElement, aStyleContext,
tokenStream->mTokenStream, /* aUseSVGMode */ false, values)) {
continue;
}
} else {
if (!StyleAnimationValue::ComputeValues(pair.mProperty,
CSSEnabledState::eForAllContent, aElement, aStyleContext,
nsCSSProps::eEnabledForAllContent, aElement, aStyleContext,
pair.mValue, /* aUseSVGMode */ false, values)) {
continue;
}
@ -695,7 +695,7 @@ GetPropertyValuesPairs(JSContext* aCx,
}
nsCSSProperty property =
nsCSSProps::LookupPropertyByIDLName(propName,
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
if (property != eCSSProperty_UNKNOWN &&
(nsCSSProps::IsShorthand(property) ||
nsCSSProps::kAnimTypeTable[property] != eStyleAnimType_None)) {
@ -1110,7 +1110,7 @@ RequiresAdditiveAnimation(const nsTArray<Keyframe>& aKeyframes,
continue;
}
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
prop, pair.mProperty, CSSEnabledState::eForAllContent) {
prop, pair.mProperty, nsCSSProps::eEnabledForAllContent) {
addToPropertySets(*prop, offsetToUse);
}
} else {

View File

@ -2503,7 +2503,7 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
NS_ENSURE_SUCCESS(rv, rv);
nsCSSProperty property =
nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eIgnoreEnabledState);
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) {
property = eCSSProperty_UNKNOWN;
}

View File

@ -686,7 +686,7 @@ nsSMILAnimationController::GetTargetIdentifierForAnimation(
} else {
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(attributeName),
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
isCSS = nsSMILCSSProperty::IsPropertyAnimatable(prop);
}
}

View File

@ -126,7 +126,7 @@ nsSMILCompositor::CreateSMILAttr()
if (mKey.mIsCSS) {
nsCSSProperty propId =
nsCSSProps::LookupProperty(nsDependentAtomString(mKey.mAttributeName),
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
if (nsSMILCSSProperty::IsPropertyAnimatable(propId)) {
return new nsSMILCSSProperty(propId, mKey.mElement.get());
}

View File

@ -1186,7 +1186,7 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
// Get the nsCSSProperty ID for our mapped attribute.
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(nsDependentAtomString(aMappedAttrName),
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
if (propertyID != eCSSProperty_UNKNOWN) {
bool changed = false; // outparam for ParseProperty.
mParser.ParseProperty(propertyID, aMappedAttrValue, mDocURI, mBaseURI,
@ -1196,7 +1196,7 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName,
// since it doesn't have a sheet.
if (nsCSSProps::IsShorthand(propertyID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, propertyID,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
UseCounter useCounter = nsCSSProps::UseCounterFor(*subprop);
if (useCounter != eUseCounter_UNKNOWN) {
mElement->OwnerDoc()->SetDocumentAndPageUseCounter(useCounter);
@ -2544,7 +2544,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName)
if (IsAttributeMapped(aName)) {
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(aName),
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
// Check IsPropertyAnimatable to avoid attributes that...
// - map to explicitly unanimatable properties (e.g. 'direction')
// - map to unsupported attributes (e.g. 'glyph-orientation-horizontal')

View File

@ -522,7 +522,7 @@ nsHTMLCSSUtils::GetCSSInlinePropertyBase(nsINode* aNode, nsIAtom* aProperty,
}
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentAtomString(aProperty),
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
MOZ_ASSERT(prop != eCSSProperty_UNKNOWN);
decl->GetValue(prop, aValue);

View File

@ -224,7 +224,7 @@ inCSSValueSearch::AddPropertyCriteria(const char16_t *aPropName)
{
nsCSSProperty prop =
nsCSSProps::LookupProperty(nsDependentString(aPropName),
CSSEnabledState::eIgnoreEnabledState);
nsCSSProps::eIgnoreEnabledState);
mProperties[mPropertyCount] = prop;
mPropertyCount++;
return NS_OK;

View File

@ -485,8 +485,8 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
NS_IMETHODIMP
inDOMUtils::IsInheritedProperty(const nsAString &aPropertyName, bool *_retval)
{
nsCSSProperty prop = nsCSSProps::
LookupProperty(aPropertyName, CSSEnabledState::eIgnoreEnabledState);
nsCSSProperty prop =
nsCSSProps::LookupProperty(aPropertyName, nsCSSProps::eIgnoreEnabledState);
if (prop == eCSSProperty_UNKNOWN) {
*_retval = false;
return NS_OK;
@ -528,14 +528,14 @@ inDOMUtils::GetCSSPropertyNames(uint32_t aFlags, uint32_t* aCount,
char16_t** props =
static_cast<char16_t**>(moz_xmalloc(maxCount * sizeof(char16_t*)));
#define DO_PROP(_prop) \
PR_BEGIN_MACRO \
nsCSSProperty cssProp = nsCSSProperty(_prop); \
if (nsCSSProps::IsEnabled(cssProp, CSSEnabledState::eForAllContent)) { \
props[propCount] = \
ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \
++propCount; \
} \
#define DO_PROP(_prop) \
PR_BEGIN_MACRO \
nsCSSProperty cssProp = nsCSSProperty(_prop); \
if (nsCSSProps::IsEnabled(cssProp, nsCSSProps::eEnabledForAllContent)) { \
props[propCount] = \
ToNewUnicode(nsDependentCString(kCSSRawProperties[_prop])); \
++propCount; \
} \
PR_END_MACRO
// prop is the property id we're considering; propCount is how many properties
@ -674,7 +674,7 @@ inDOMUtils::GetSubpropertiesForCSSProperty(const nsAString& aProperty,
char16_t*** aValues)
{
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
@ -716,7 +716,7 @@ NS_IMETHODIMP
inDOMUtils::CssPropertyIsShorthand(const nsAString& aProperty, bool *_retval)
{
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
@ -861,7 +861,7 @@ inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType,
bool *_retval)
{
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(aProperty, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eEnabledForAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
@ -921,8 +921,8 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
uint32_t* aLength,
char16_t*** aValues)
{
nsCSSProperty propertyID = nsCSSProps::
LookupProperty(aProperty, CSSEnabledState::eForAllContent);
nsCSSProperty propertyID = nsCSSProps::LookupProperty(aProperty,
nsCSSProps::eEnabledForAllContent);
if (propertyID == eCSSProperty_UNKNOWN) {
return NS_ERROR_FAILURE;
}
@ -944,7 +944,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
} else {
// Property is shorthand.
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subproperty, propertyID,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
// Get colors (once) first.
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(*subproperty);
if (propertyParserVariant & VARIANT_COLOR) {
@ -953,7 +953,7 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
}
}
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subproperty, propertyID,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
uint32_t propertyParserVariant = nsCSSProps::ParserVariant(*subproperty);
if (propertyParserVariant & VARIANT_KEYWORD) {
GetKeywordsForProperty(*subproperty, array);
@ -1056,8 +1056,8 @@ inDOMUtils::CssPropertyIsValid(const nsAString& aPropertyName,
const nsAString& aPropertyValue,
bool *_retval)
{
nsCSSProperty propertyID = nsCSSProps::
LookupProperty(aPropertyName, CSSEnabledState::eIgnoreEnabledState);
nsCSSProperty propertyID =
nsCSSProps::LookupProperty(aPropertyName, nsCSSProps::eIgnoreEnabledState);
if (propertyID == eCSSProperty_UNKNOWN) {
*_retval = false;
@ -1211,8 +1211,7 @@ GetStatesForPseudoClass(const nsAString& aStatePseudo)
"Length of PseudoClassStates array is incorrect");
nsCOMPtr<nsIAtom> atom = NS_Atomize(aStatePseudo);
CSSPseudoClassType type = nsCSSPseudoClasses::
GetPseudoType(atom, CSSEnabledState::eIgnoreEnabledState);
CSSPseudoClassType type = nsCSSPseudoClasses::GetPseudoType(atom, true, true);
// Ignore :moz-any-link so we don't give the element simultaneous
// visited and unvisited style state

View File

@ -1,39 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* enum for whether a CSS feature (property, pseudo-class, etc.) is
* enabled in a specific context
*/
#ifndef mozilla_CSSEnabledState_h
#define mozilla_CSSEnabledState_h
#include "mozilla/TypedEnumBits.h"
namespace mozilla {
enum class CSSEnabledState
{
// The default CSSEnabledState: only enable what's enabled for all
// content, given the current values of preferences.
eForAllContent = 0,
// Enable features available in UA sheets.
eInUASheets = 0x01,
// Enable features available in chrome code.
eInChrome = 0x02,
// Special value to unconditionally enable everything. This implies
// all the bits above, but is strictly more than just their OR-ed
// union. This just skips any test so a feature will be enabled even
// if it would have been disabled with all the bits above set.
eIgnoreEnabledState = 0xff
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CSSEnabledState)
} // namespace mozilla
#endif // mozilla_CSSEnabledState_h

View File

@ -146,7 +146,7 @@ Declaration::RemoveProperty(nsCSSProperty aProperty)
if (nsCSSProps::IsShorthand(aProperty)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
data.ClearLonghandProperty(*p);
mOrder.RemoveElement(static_cast<uint32_t>(*p));
}
@ -512,7 +512,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
initialCount = 0, inheritCount = 0, unsetCount = 0,
matchingTokenStreamCount = 0, nonMatchingTokenStreamCount = 0;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
if (*p == eCSSProperty__x_system_font) {
// The system-font subproperty doesn't count.
continue;
@ -1432,8 +1432,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
bool
Declaration::GetValueIsImportant(const nsAString& aProperty) const
{
nsCSSProperty propID = nsCSSProps::
LookupProperty(aProperty, CSSEnabledState::eIgnoreEnabledState);
nsCSSProperty propID =
nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState);
if (propID == eCSSProperty_UNKNOWN) {
return false;
}
@ -1458,7 +1458,7 @@ Declaration::GetValueIsImportant(nsCSSProperty aProperty) const
}
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
if (*p == eCSSProperty__x_system_font) {
// The system_font subproperty doesn't count.
continue;
@ -1572,7 +1572,7 @@ Declaration::ToString(nsAString& aString) const
continue;
}
if (!nsCSSProps::IsEnabled(property, CSSEnabledState::eForAllContent)) {
if (!nsCSSProps::IsEnabled(property, nsCSSProps::eEnabledForAllContent)) {
continue;
}
bool doneProperty = false;

View File

@ -2821,7 +2821,7 @@ BuildStyleRule(nsCSSProperty aProperty,
static bool
ComputeValuesFromStyleRule(nsCSSProperty aProperty,
CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
css::StyleRule* aStyleRule,
@ -2942,7 +2942,7 @@ StyleAnimationValue::ComputeValue(nsCSSProperty aProperty,
AutoTArray<PropertyStyleAnimationValuePair,1> values;
bool ok = ComputeValuesFromStyleRule(aProperty,
CSSEnabledState::eIgnoreEnabledState,
nsCSSProps::eIgnoreEnabledState,
aTargetElement, aStyleContext, styleRule,
values, aIsContextSensitive);
if (!ok) {
@ -2960,7 +2960,7 @@ template <class T>
bool
ComputeValuesFromSpecifiedValue(
nsCSSProperty aProperty,
CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
T& aSpecifiedValue,
@ -2988,7 +2988,7 @@ ComputeValuesFromSpecifiedValue(
/* static */ bool
StyleAnimationValue::ComputeValues(
nsCSSProperty aProperty,
CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsAString& aSpecifiedValue,
@ -3004,7 +3004,7 @@ StyleAnimationValue::ComputeValues(
/* static */ bool
StyleAnimationValue::ComputeValues(
nsCSSProperty aProperty,
CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsCSSValue& aSpecifiedValue,

View File

@ -176,7 +176,7 @@ public:
* in it.
*/
static bool ComputeValues(nsCSSProperty aProperty,
mozilla::CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsAString& aSpecifiedValue,
@ -188,7 +188,7 @@ public:
* value. Only longhand properties are supported.
*/
static bool ComputeValues(nsCSSProperty aProperty,
mozilla::CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
mozilla::dom::Element* aTargetElement,
nsStyleContext* aStyleContext,
const nsCSSValue& aSpecifiedValue,

View File

@ -81,7 +81,6 @@ EXPORTS += [
EXPORTS.mozilla += [
'AnimationCollection.h',
'CSSEnabledState.h',
'CSSStyleSheet.h',
'CSSVariableDeclarations.h',
'CSSVariableResolver.h',

View File

@ -623,8 +623,8 @@ void
nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID)
{
if (nsCSSProps::IsShorthand(aPropID)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
p, aPropID, CSSEnabledState::eIgnoreEnabledState) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID,
nsCSSProps::eIgnoreEnabledState) {
ClearLonghandProperty(*p);
}
} else {
@ -645,7 +645,7 @@ nsCSSExpandedDataBlock::ClearLonghandProperty(nsCSSProperty aPropID)
bool
nsCSSExpandedDataBlock::TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock,
nsCSSProperty aPropID,
CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
bool aIsImportant,
bool aOverrideImportant,
bool aMustCallValueAppended,
@ -659,11 +659,11 @@ nsCSSExpandedDataBlock::TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock,
aSheetDocument);
}
// We can pass CSSEnabledState::eIgnore (here, and in ClearProperty
// above) rather than a value corresponding to whether we're parsing
// a UA style sheet or certified app because we assert in nsCSSProps::
// AddRefTable that shorthand properties available in these contexts
// also have all of their subproperties available in these contexts.
// We can pass eIgnoreEnabledState (here, and in ClearProperty above) rather
// than a value corresponding to whether we're parsing a UA style sheet or
// certified app because we assert in nsCSSProps::AddRefTable that shorthand
// properties available in these contexts also have all of their
// subproperties available in these contexts.
bool changed = false;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID, aEnabledState) {
changed |= DoTransferFromBlock(aFromBlock, *p,

View File

@ -264,7 +264,7 @@ public:
*/
bool TransferFromBlock(nsCSSExpandedDataBlock& aFromBlock,
nsCSSProperty aPropID,
mozilla::CSSEnabledState aEnabledState,
nsCSSProps::EnabledState aEnabledState,
bool aIsImportant,
bool aOverrideImportant,
bool aMustCallValueAppended,

View File

@ -356,22 +356,22 @@ public:
mParsingMode == css::eUserSheetFeatures;
}
CSSEnabledState EnabledState() const {
static_assert(int(CSSEnabledState::eForAllContent) == 0,
"CSSEnabledState::eForAllContent should be zero for "
nsCSSProps::EnabledState PropertyEnabledState() const {
static_assert(nsCSSProps::eEnabledForAllContent == 0,
"nsCSSProps::eEnabledForAllContent should be zero for "
"this bitfield to work");
CSSEnabledState enabledState = CSSEnabledState::eForAllContent;
nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent;
if (AgentRulesEnabled()) {
enabledState |= CSSEnabledState::eInUASheets;
enabledState |= nsCSSProps::eEnabledInUASheets;
}
if (mIsChrome) {
enabledState |= CSSEnabledState::eInChrome;
enabledState |= nsCSSProps::eEnabledInChrome;
}
return enabledState;
}
nsCSSProperty LookupEnabledProperty(const nsAString& aProperty) {
return nsCSSProps::LookupProperty(aProperty, EnabledState());
return nsCSSProps::LookupProperty(aProperty, PropertyEnabledState());
}
protected:
@ -1905,7 +1905,7 @@ CSSParserImpl::ParseTransformProperty(const nsAString& aPropValue,
if (parsedOK) {
declaration->ExpandTo(&mData);
changed = mData.TransferFromBlock(mTempData, eCSSProperty_transform,
EnabledState(), false,
PropertyEnabledState(), false,
true, false, declaration,
GetDocument());
declaration->CompressFrom(&mData);
@ -1952,7 +1952,7 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
// Check for unknown or preffed off properties
if (eCSSProperty_UNKNOWN == aPropID ||
!nsCSSProps::IsEnabled(aPropID, EnabledState())) {
!nsCSSProps::IsEnabled(aPropID, PropertyEnabledState())) {
NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(aPropID));
REPORT_UNEXPECTED_P(PEUnknownProperty, propName);
REPORT_UNEXPECTED(PEDeclDropped);
@ -1987,7 +1987,7 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
// Do it the slow way
aDeclaration->ExpandTo(&mData);
*aChanged = mData.TransferFromBlock(mTempData, aPropID,
EnabledState(), aIsImportant,
PropertyEnabledState(), aIsImportant,
true, false, aDeclaration,
GetDocument());
aDeclaration->CompressFrom(&mData);
@ -3262,7 +3262,7 @@ CSSParserImpl::ParseAtRule(RuleAppendFunc aAppendFunc,
newSection = eCSSSection_General;
} else if ((nsCSSProps::IsEnabled(eCSSPropertyAlias_MozAnimation,
EnabledState()) &&
PropertyEnabledState()) &&
mToken.mIdent.LowerCaseEqualsLiteral("-moz-keyframes")) ||
(nsCSSProps::IsEnabled(eCSSPropertyAlias_WebkitAnimation) &&
mToken.mIdent.LowerCaseEqualsLiteral("-webkit-keyframes")) ||
@ -5914,11 +5914,11 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
// stash away some info about this pseudo so we only have to get it once.
bool isTreePseudo = false;
CSSEnabledState enabledState = EnabledState();
CSSPseudoElementType pseudoElementType =
nsCSSPseudoElements::GetPseudoType(pseudo);
CSSPseudoClassType pseudoClassType =
nsCSSPseudoClasses::GetPseudoType(pseudo, enabledState);
nsCSSPseudoClasses::GetPseudoType(pseudo, AgentRulesEnabled(),
ChromeRulesEnabled());
bool pseudoClassIsUserAction =
nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
@ -7378,7 +7378,8 @@ CSSParserImpl::ParseDeclaration(css::Declaration* aDeclaration,
aDeclaration->AddVariableDeclaration(varName, variableType, variableValue,
status == ePriority_Important, false);
} else {
*aChanged |= mData.TransferFromBlock(mTempData, propID, EnabledState(),
*aChanged |= mData.TransferFromBlock(mTempData, propID,
PropertyEnabledState(),
status == ePriority_Important,
false, aMustCallValueAppended,
aDeclaration, GetDocument());
@ -11384,7 +11385,8 @@ CSSParserImpl::ParseProperty(nsCSSProperty aPropID)
if (nsCSSProps::IsShorthand(aPropID)) {
// If this is a shorthand property, we store the token stream on each
// of its corresponding longhand properties.
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID, EnabledState()) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aPropID,
PropertyEnabledState()) {
nsCSSValueTokenStream* tokenStream = new nsCSSValueTokenStream;
tokenStream->mPropertyID = *p;
tokenStream->mShorthandPropertyID = aPropID;
@ -17015,7 +17017,7 @@ CSSParserImpl::ParseAll()
// instead of computing the correct EnabledState value we just expand out
// to all content-visible properties.
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, eCSSProperty_all,
CSSEnabledState::eForAllContent) {
nsCSSProps::eEnabledForAllContent) {
AppendValue(*p, value);
}
return true;

View File

@ -538,14 +538,13 @@ nsCSSProps::LookupProperty(const nsACString& aProperty,
}
MOZ_ASSERT(eCSSAliasCount != 0,
"'res' must be an alias at this point so we better have some!");
// We intentionally don't support CSSEnabledState::eInUASheets or
// CSSEnabledState::eInChrome for aliases yet because it's unlikely
// there will be a need for it.
if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
// We intentionally don't support eEnabledInUASheets or eEnabledInChrome
// for aliases yet because it's unlikely there will be a need for it.
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
res = gAliases[res - eCSSProperty_COUNT];
MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
return res;
}
}
@ -573,14 +572,13 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled)
}
MOZ_ASSERT(eCSSAliasCount != 0,
"'res' must be an alias at this point so we better have some!");
// We intentionally don't support CSSEnabledState::eInUASheets or
// CSSEnabledState::eInChrome for aliases yet because it's unlikely
// there will be a need for it.
if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
// We intentionally don't support eEnabledInUASheets or eEnabledInChrome
// for aliases yet because it's unlikely there will be a need for it.
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
res = gAliases[res - eCSSProperty_COUNT];
MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT,
"aliases must not point to other aliases");
if (IsEnabled(res) || aEnabled == CSSEnabledState::eIgnoreEnabledState) {
if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) {
return res;
}
}

View File

@ -15,7 +15,6 @@
#include "nsCSSProperty.h"
#include "nsStyleStructFwd.h"
#include "nsCSSKeywords.h"
#include "mozilla/CSSEnabledState.h"
#include "mozilla/UseCounter.h"
// Length of the "--" prefix on custom names (such as custom property names,
@ -331,8 +330,6 @@ enum nsStyleAnimType {
class nsCSSProps {
public:
typedef mozilla::CSSEnabledState EnabledState;
struct KTableEntry {
nsCSSKeyword mKeyword;
int16_t mValue;
@ -341,6 +338,21 @@ public:
static void AddRefTable(void);
static void ReleaseTable(void);
enum EnabledState {
// The default EnabledState: only enable what's enabled for all content,
// given the current values of preferences.
eEnabledForAllContent = 0,
// Enable a property in UA sheets.
eEnabledInUASheets = 0x01,
// Enable a property in chrome code.
eEnabledInChrome = 0x02,
// Special value to unconditionally enable a property. This implies all the
// bits above, but is strictly more than just their OR-ed union.
// This just skips any test so a property will be enabled even if it would
// have been disabled with all the bits above set.
eIgnoreEnabledState = 0xff
};
// Looks up the property with name aProperty and returns its corresponding
// nsCSSProperty value. If aProperty is the name of a custom property,
// then eCSSPropertyExtra_variable will be returned.
@ -612,15 +624,15 @@ public:
if (IsEnabled(aProperty)) {
return true;
}
if (aEnabled == EnabledState::eIgnoreEnabledState) {
if (aEnabled == eIgnoreEnabledState) {
return true;
}
if ((aEnabled & EnabledState::eInUASheets) &&
if ((aEnabled & eEnabledInUASheets) &&
PropHasFlags(aProperty, CSS_PROPERTY_ENABLED_IN_UA_SHEETS))
{
return true;
}
if ((aEnabled & EnabledState::eInChrome) &&
if ((aEnabled & eEnabledInChrome) &&
PropHasFlags(aProperty, CSS_PROPERTY_ENABLED_IN_CHROME))
{
return true;
@ -632,13 +644,13 @@ public:
// Storing the enabledstate_ value in an nsCSSProperty variable is a small hack
// to avoid needing a separate variable declaration for its real type
// (CSSEnabledState), which would then require using a block and
// (nsCSSProps::EnabledState), which would then require using a block and
// therefore a pair of macros by consumers for the start and end of the loop.
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(it_, prop_, enabledstate_) \
for (const nsCSSProperty *it_ = nsCSSProps::SubpropertyEntryFor(prop_), \
es_ = (nsCSSProperty) (enabledstate_); \
*it_ != eCSSProperty_UNKNOWN; ++it_) \
if (nsCSSProps::IsEnabled(*it_, (mozilla::CSSEnabledState) es_))
if (nsCSSProps::IsEnabled(*it_, (nsCSSProps::EnabledState) es_))
// Keyword/Enum value tables
static const KTableEntry kAnimationDirectionKTable[];
@ -828,4 +840,28 @@ public:
static const KTableEntry kWritingModeKTable[];
};
inline nsCSSProps::EnabledState operator|(nsCSSProps::EnabledState a,
nsCSSProps::EnabledState b)
{
return nsCSSProps::EnabledState(int(a) | int(b));
}
inline nsCSSProps::EnabledState operator&(nsCSSProps::EnabledState a,
nsCSSProps::EnabledState b)
{
return nsCSSProps::EnabledState(int(a) & int(b));
}
inline nsCSSProps::EnabledState& operator|=(nsCSSProps::EnabledState& a,
nsCSSProps::EnabledState b)
{
return a = a | b;
}
inline nsCSSProps::EnabledState& operator&=(nsCSSProps::EnabledState& a,
nsCSSProps::EnabledState b)
{
return a = a & b;
}
#endif /* nsCSSProps_h___ */

View File

@ -44,16 +44,14 @@ static const nsStaticAtom CSSPseudoClasses_info[] = {
// Flags data for each of the pseudo-classes, which must be separate
// from the previous array since there's no place for it in
// nsStaticAtom.
/* static */ const uint32_t
nsCSSPseudoClasses::kPseudoClassFlags[Type::Count] = {
static const uint32_t CSSPseudoClasses_flags[] = {
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
flags_,
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
};
/* static */ bool
nsCSSPseudoClasses::sPseudoClassEnabled[Type::Count] = {
static bool sPseudoClassEnabled[] = {
// If the pseudo class has any "ENABLED_IN" flag set, it is disabled by
// default. Note that, if a pseudo class has pref, whatever its default
// value is, it'll later be changed in nsCSSPseudoClasses::AddRefAtoms()
@ -110,14 +108,27 @@ nsCSSPseudoClasses::PseudoTypeToString(Type aType, nsAString& aString)
}
/* static */ CSSPseudoClassType
nsCSSPseudoClasses::GetPseudoType(nsIAtom* aAtom, EnabledState aEnabledState)
nsCSSPseudoClasses::GetPseudoType(nsIAtom* aAtom,
bool aAgentEnabled, bool aChromeEnabled)
{
for (uint32_t i = 0; i < ArrayLength(CSSPseudoClasses_info); ++i) {
if (*CSSPseudoClasses_info[i].mAtom == aAtom) {
Type type = Type(i);
return IsEnabled(type, aEnabledState) ? type : Type::NotPseudo;
if (sPseudoClassEnabled[i]) {
return type;
} else {
auto flags = FlagsForPseudoClass(type);
if ((aChromeEnabled &&
(flags & CSS_PSEUDO_CLASS_ENABLED_IN_CHROME)) ||
(aAgentEnabled &&
(flags & CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS))) {
return type;
}
}
return Type::NotPseudo;
}
}
return Type::NotPseudo;
}
@ -129,3 +140,13 @@ nsCSSPseudoClasses::IsUserActionPseudoClass(Type aType)
aType == Type::active ||
aType == Type::focus;
}
/* static */ uint32_t
nsCSSPseudoClasses::FlagsForPseudoClass(const Type aType)
{
size_t index = static_cast<size_t>(aType);
NS_ASSERTION(index < ArrayLength(CSSPseudoClasses_flags),
"argument must be a pseudo-class");
return CSSPseudoClasses_flags[index];
}

View File

@ -48,12 +48,12 @@ enum class CSSPseudoClassType : CSSPseudoClassTypeBase
class nsCSSPseudoClasses
{
typedef mozilla::CSSPseudoClassType Type;
typedef mozilla::CSSEnabledState EnabledState;
public:
static void AddRefAtoms();
static Type GetPseudoType(nsIAtom* aAtom, EnabledState aEnabledState);
static Type GetPseudoType(nsIAtom* aAtom,
bool aAgentEnabled, bool aChromeEnabled);
static bool HasStringArg(Type aType);
static bool HasNthPairArg(Type aType);
static bool HasSelectorListArg(Type aType) {
@ -64,27 +64,8 @@ public:
// Should only be used on types other than Count and NotPseudoClass
static void PseudoTypeToString(Type aType, nsAString& aString);
static bool IsEnabled(Type aType, EnabledState aEnabledState)
{
auto index = static_cast<size_t>(aType);
MOZ_ASSERT(index < static_cast<size_t>(Type::Count));
if (sPseudoClassEnabled[index] ||
aEnabledState == EnabledState::eIgnoreEnabledState) {
return true;
}
auto flags = kPseudoClassFlags[index];
if (((aEnabledState & EnabledState::eInChrome) &&
(flags & CSS_PSEUDO_CLASS_ENABLED_IN_CHROME)) ||
((aEnabledState & EnabledState::eInUASheets) &&
(flags & CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS))) {
return true;
}
return false;
}
private:
static const uint32_t kPseudoClassFlags[Type::Count];
static bool sPseudoClassEnabled[Type::Count];
static uint32_t FlagsForPseudoClass(const Type aType);
};
#endif /* nsCSSPseudoClasses_h___ */

View File

@ -98,7 +98,8 @@ struct nsComputedStyleMap
bool IsEnabled() const
{
return nsCSSProps::IsEnabled(mProperty, CSSEnabledState::eForAllContent);
return nsCSSProps::IsEnabled(mProperty,
nsCSSProps::eEnabledForAllContent);
}
};
@ -764,8 +765,8 @@ nsComputedDOMStyle::ClearCurrentStyleSources()
already_AddRefed<CSSValue>
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
{
nsCSSProperty prop =
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
bool needsLayoutFlush;
nsComputedStyleMap::Entry::ComputeMethod getter;

View File

@ -196,7 +196,8 @@ nsDOMCSSDeclaration::GetPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
@ -215,7 +216,8 @@ nsDOMCSSDeclaration::GetAuthoredPropertyValue(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;
@ -256,7 +258,8 @@ nsDOMCSSDeclaration::SetProperty(const nsAString& aPropertyName,
{
// In the common (and fast) cases we can use the property id
nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
return NS_OK;
}
@ -292,7 +295,8 @@ nsDOMCSSDeclaration::RemoveProperty(const nsAString& aPropertyName,
nsAString& aReturn)
{
const nsCSSProperty propID =
nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(aPropertyName,
nsCSSProps::eEnabledForAllContent);
if (propID == eCSSProperty_UNKNOWN) {
aReturn.Truncate();
return NS_OK;

View File

@ -5393,7 +5393,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
propertyStr(property.list->mValue.GetStringBufferValue());
nsCSSProperty prop =
nsCSSProps::LookupProperty(propertyStr,
CSSEnabledState::eForAllContent);
nsCSSProps::eEnabledForAllContent);
if (prop == eCSSProperty_UNKNOWN ||
prop == eCSSPropertyExtra_variable) {
transition->SetUnknownProperty(prop, propertyStr);
@ -6197,7 +6197,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
}
nsCSSProperty prop =
nsCSSProps::LookupProperty(buffer, CSSEnabledState::eForAllContent);
nsCSSProps::LookupProperty(buffer,
nsCSSProps::eEnabledForAllContent);
if (prop != eCSSProperty_UNKNOWN &&
prop != eCSSPropertyExtra_variable) {
// If the property given is a shorthand, it indicates the expectation

View File

@ -2740,7 +2740,7 @@ mozilla::StyleTransition::SetUnknownProperty(nsCSSProperty aProperty,
const nsAString& aPropertyString)
{
MOZ_ASSERT(nsCSSProps::LookupProperty(aPropertyString,
CSSEnabledState::eForAllContent) ==
nsCSSProps::eEnabledForAllContent) ==
aProperty,
"property and property string should match");
MOZ_ASSERT(aProperty == eCSSProperty_UNKNOWN ||

View File

@ -414,7 +414,7 @@ nsTransitionManager::UpdateTransitions(
}
} else if (nsCSSProps::IsShorthand(property)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(subprop, property,
CSSEnabledState::eForAllContent)
nsCSSProps::eEnabledForAllContent)
{
ConsiderStartingTransition(*subprop, t, aElement, aElementTransitions,
aOldStyleContext, aNewStyleContext,
@ -459,7 +459,7 @@ nsTransitionManager::UpdateTransitions(
}
} else if (nsCSSProps::IsShorthand(property)) {
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(
subprop, property, CSSEnabledState::eForAllContent) {
subprop, property, nsCSSProps::eEnabledForAllContent) {
allTransitionProperties.AddProperty(*subprop);
}
} else {
@ -530,7 +530,7 @@ nsTransitionManager::ConsiderStartingTransition(
// Ignore disabled properties. We can arrive here if the transition-property
// is 'all' and the disabled property has a default value which derives value
// from another property, e.g. color.
if (!nsCSSProps::IsEnabled(aProperty, CSSEnabledState::eForAllContent)) {
if (!nsCSSProps::IsEnabled(aProperty, nsCSSProps::eEnabledForAllContent)) {
return;
}

View File

@ -9,8 +9,6 @@
#include "nsString.h"
#include "nsXPCOM.h"
using namespace mozilla;
static const char* const kJunkNames[] = {
nullptr,
"",
@ -43,7 +41,7 @@ TestProps()
index = nsCSSProperty(int32_t(index) + 1);
id = nsCSSProps::LookupProperty(nsCString(tagName),
CSSEnabledState::eIgnoreEnabledState);
nsCSSProps::eIgnoreEnabledState);
if (id == eCSSProperty_UNKNOWN) {
printf("bug: can't find '%s'\n", tagName);
success = false;
@ -58,7 +56,7 @@ TestProps()
tagName[0] = tagName[0] - 32;
}
id = nsCSSProps::LookupProperty(NS_ConvertASCIItoUTF16(tagName),
CSSEnabledState::eIgnoreEnabledState);
nsCSSProps::eIgnoreEnabledState);
if (id < 0) {
printf("bug: can't find '%s'\n", tagName);
success = false;
@ -74,7 +72,7 @@ TestProps()
for (int i = 0; i < (int) (sizeof(kJunkNames) / sizeof(const char*)); i++) {
const char* const tag = kJunkNames[i];
id = nsCSSProps::LookupProperty(nsAutoCString(tag),
CSSEnabledState::eIgnoreEnabledState);
nsCSSProps::eIgnoreEnabledState);
if (id >= 0) {
printf("bug: found '%s'\n", tag ? tag : "(null)");
success = false;