Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2025-07-07 11:59:17 +08:00
commit bd335d6284
36 changed files with 1149 additions and 306 deletions

View file

@ -151,7 +151,7 @@ TooltipsOverlay.prototype = {
// Font preview tooltip // Font preview tooltip
if (type === VIEW_NODE_VALUE_TYPE && prop.property === "font-family") { if (type === VIEW_NODE_VALUE_TYPE && prop.property === "font-family") {
let value = prop.value.toLowerCase(); let value = prop.value.toLowerCase();
if (value !== "inherit" && value !== "unset" && value !== "initial") { if (value !== "inherit" && value !== "unset" && value !== "initial" && value !== "revert") {
tooltipType = TOOLTIP_FONTFAMILY_TYPE; tooltipType = TOOLTIP_FONTFAMILY_TYPE;
} }
} }

View file

@ -9,7 +9,8 @@ const {CSS_ANGLEUNIT} = require("devtools/shared/css/properties-db");
const SPECIALVALUES = new Set([ const SPECIALVALUES = new Set([
"initial", "initial",
"inherit", "inherit",
"unset" "unset",
"revert"
]); ]);
const {getCSSLexer} = require("devtools/shared/css/lexer"); const {getCSSLexer} = require("devtools/shared/css/lexer");

View file

@ -395,9 +395,6 @@ const CurlUtils = {
return "\\u" + ("0000" + code).substr(code.length, 4); return "\\u" + ("0000" + code).substr(code.length, 4);
} }
// Escape & and |, which are special characters on Windows.
const winSpecialCharsRegEx = /([&\|])/g;
if (/[^\x20-\x7E]|\'/.test(str)) { if (/[^\x20-\x7E]|\'/.test(str)) {
// Use ANSI-C quoting syntax. // Use ANSI-C quoting syntax.
return "$\'" + str.replace(/\\/g, "\\\\") return "$\'" + str.replace(/\\/g, "\\\\")
@ -405,58 +402,50 @@ const CurlUtils = {
.replace(/\n/g, "\\n") .replace(/\n/g, "\\n")
.replace(/\r/g, "\\r") .replace(/\r/g, "\\r")
.replace(/!/g, "\\041") .replace(/!/g, "\\041")
.replace(winSpecialCharsRegEx, "^$1")
.replace(/[^\x20-\x7E]/g, escapeCharacter) + "'"; .replace(/[^\x20-\x7E]/g, escapeCharacter) + "'";
} }
// Use single quote syntax. // Use single quote syntax.
return "'" + str.replace(winSpecialCharsRegEx, "^$1") + "'"; return "'" + str + "'";
}, },
/** /**
* Escape util function for Windows systems. * Escape util function for Windows systems.
*/ */
escapeStringWin: function (str) { escapeStringWin: function (str) {
/* const encapsChars = '"';
Because the cmd.exe parser and the MS Crt arguments parsers use some
of the same escape characters, they can interact with each other in
terrible ways, meaning the order of operations is critical here.
1. Replace \ with \\ first, because it is an escape character for
certain conditions in both parsers.
2. Escape double quotes with double backslashes.
3. Escape ` and $ so commands do not get executed, e.g $(calc.exe) or
`\$(calc.exe)
4. Escape all characters we are not sure about with ^, to ensure it
gets to the MS Crt arguments parser safely.
5. The % character is special because the MS Crt arguments parser will
try and look for environment variables and fill them in, in-place. We
cannot escape them with % and cannot escape them with ^ (because it's
cmd.exe's escape, not the MS Crt arguments parser). So, we can get the
cmd.exe parser to escape the character after it, if it is followed by
a valid starting character of an environment variable.
This ensures we do not try and double-escape another ^ if it was placed
by the previous replace.
6. Lastly, we replace new lines with ^ and TWO new lines, because the
first new line is there to enact the escape command, and the second is
the character to escape (in this case new line).
*/
const encapsChars = '^"';
return ( return (
encapsChars + encapsChars +
str str
// Replace \ with \\ first because it is an escape character for certain
// conditions in both parsers.
.replace(/\\/g, "\\\\") .replace(/\\/g, "\\\\")
.replace(/"/g, '\\"') // Replace double quote chars with two double quotes (not by escaping with \")
// because it is recognized by both cmd.exe and MS CRT arguments parser.
.replace(/"/g, '""')
// Escape ` and $ so commands do not get executed e.g $(calc.exe) or `\$(calc.exe)
.replace(/[`$]/g, "\\$&") .replace(/[`$]/g, "\\$&")
// Then escape all characters we are not sure about with ^ to ensure it
// gets to the MS CRT parser safely.
.replace(/[^a-zA-Z0-9\s_\-:=+~\/.',?;()*\$&\\{}\"`]/g, "^$&") .replace(/[^a-zA-Z0-9\s_\-:=+~\/.',?;()*\$&\\{}\"`]/g, "^$&")
// The % character is special because MS CRT parser will try and look for
// ENV variables and fill them in its place. We cannot escape them with %
// and cannot escape them with ^ (because it's cmd.exe's escape not MS CRT
// parser); So we can get cmd.exe parser to escape the character after it,
// if it is followed by a valid beginning character of an ENV variable.
// This ensures we do not try and double escape another ^ if it was placed
// by the previous replace.
.replace(/%(?=[a-zA-Z0-9_])/g, "%^") .replace(/%(?=[a-zA-Z0-9_])/g, "%^")
.replace(/\r?\n/g, "^\n\n") // We replace \r and \r\n with \n, this allows to consistently escape all new
+ encapsChars); // lines in the next replace
.replace(/\r\n?/g, "\n")
// Lastly we replace new lines with ^ and TWO new lines because the first
// new line is there to enact the escape command the second is the character
// to escape (in this case new line).
// The extra " enables escaping new lines with ^ within quotes in cmd.exe.
.replace(/\n/g, '"^\r\n\r\n"')
+ encapsChars
);
} }
}; };

View file

@ -99,7 +99,7 @@ const filterList = [
]; ];
// Valid values that shouldn't be parsed for filters. // Valid values that shouldn't be parsed for filters.
const SPECIAL_VALUES = new Set(["none", "unset", "initial", "inherit"]); const SPECIAL_VALUES = new Set(["none", "unset", "initial", "inherit", "revert"]);
/** /**
* A CSS Filter editor widget used to add/remove/modify * A CSS Filter editor widget used to add/remove/modify

View file

@ -19,7 +19,8 @@ const SPECIALVALUES = new Set([
"initial", "initial",
"inherit", "inherit",
"transparent", "transparent",
"unset" "unset",
"revert"
]); ]);
/** /**

File diff suppressed because it is too large Load diff

View file

@ -154,6 +154,7 @@ TimingParams::ParseEasing(const nsAString& aEasing,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_TokenStream: case eCSSUnit_TokenStream:
case eCSSUnit_Null: case eCSSUnit_Null:
break; break;

View file

@ -2731,6 +2731,7 @@ PropertyIsInheritOrInitial(Declaration* aDeclaration, const nsCSSPropertyID aPro
const nsCSSValue* filterVal = const nsCSSValue* filterVal =
aDeclaration->GetNormalBlock()->ValueFor(aProperty); aDeclaration->GetNormalBlock()->ValueFor(aProperty);
return (!filterVal || (filterVal->GetUnit() == eCSSUnit_Unset || return (!filterVal || (filterVal->GetUnit() == eCSSUnit_Unset ||
filterVal->GetUnit() == eCSSUnit_Revert ||
filterVal->GetUnit() == eCSSUnit_Inherit || filterVal->GetUnit() == eCSSUnit_Inherit ||
filterVal->GetUnit() == eCSSUnit_Initial)); filterVal->GetUnit() == eCSSUnit_Initial));
} }

View file

@ -953,10 +953,11 @@ inDOMUtils::GetCSSValuesForProperty(const nsAString& aProperty,
GetOtherValuesForProperty(propertyParserVariant, array); GetOtherValuesForProperty(propertyParserVariant, array);
} }
} }
// All CSS properties take initial, inherit and unset. // All CSS properties take initial, inherit, unset, and revert.
InsertNoDuplicates(array, NS_LITERAL_STRING("initial")); InsertNoDuplicates(array, NS_LITERAL_STRING("initial"));
InsertNoDuplicates(array, NS_LITERAL_STRING("inherit")); InsertNoDuplicates(array, NS_LITERAL_STRING("inherit"));
InsertNoDuplicates(array, NS_LITERAL_STRING("unset")); InsertNoDuplicates(array, NS_LITERAL_STRING("unset"));
InsertNoDuplicates(array, NS_LITERAL_STRING("revert"));
*aLength = array.Length(); *aLength = array.Length();
char16_t** ret = char16_t** ret =

View file

@ -11,12 +11,13 @@
#include "nsCSSScanner.h" #include "nsCSSScanner.h"
#include "nsRuleData.h" #include "nsRuleData.h"
// These three special string values are used to represent specified values of // These four special string values are used to represent specified values of
// 'initial', 'inherit' and 'unset'. (Note that none of these are valid // 'initial', 'inherit', 'unset', and 'revert'. (Note that none of these are
// variable values.) // valid variable values.)
#define INITIAL_VALUE "!" #define INITIAL_VALUE "!"
#define INHERIT_VALUE ";" #define INHERIT_VALUE ";"
#define UNSET_VALUE ")" #define UNSET_VALUE ")"
#define REVERT_VALUE ">"
namespace mozilla { namespace mozilla {
@ -83,6 +84,9 @@ CSSVariableDeclarations::Get(const nsAString& aName,
} else if (value.EqualsLiteral(UNSET_VALUE)) { } else if (value.EqualsLiteral(UNSET_VALUE)) {
aType = eUnset; aType = eUnset;
aTokenStream.Truncate(); aTokenStream.Truncate();
} else if (value.EqualsLiteral(REVERT_VALUE)) {
aType = eRevert;
aTokenStream.Truncate();
} else { } else {
aType = eTokenStream; aType = eTokenStream;
aTokenStream = value; aTokenStream = value;
@ -96,7 +100,8 @@ CSSVariableDeclarations::PutTokenStream(const nsAString& aName,
{ {
MOZ_ASSERT(!aTokenStream.EqualsLiteral(INITIAL_VALUE) && MOZ_ASSERT(!aTokenStream.EqualsLiteral(INITIAL_VALUE) &&
!aTokenStream.EqualsLiteral(INHERIT_VALUE) && !aTokenStream.EqualsLiteral(INHERIT_VALUE) &&
!aTokenStream.EqualsLiteral(UNSET_VALUE)); !aTokenStream.EqualsLiteral(UNSET_VALUE) &&
!aTokenStream.EqualsLiteral(REVERT_VALUE));
mVariables.Put(aName, aTokenStream); mVariables.Put(aName, aTokenStream);
} }
@ -118,6 +123,12 @@ CSSVariableDeclarations::PutUnset(const nsAString& aName)
mVariables.Put(aName, NS_LITERAL_STRING(UNSET_VALUE)); mVariables.Put(aName, NS_LITERAL_STRING(UNSET_VALUE));
} }
void
CSSVariableDeclarations::PutRevert(const nsAString& aName)
{
mVariables.Put(aName, NS_LITERAL_STRING(REVERT_VALUE));
}
void void
CSSVariableDeclarations::Remove(const nsAString& aName) CSSVariableDeclarations::Remove(const nsAString& aName)
{ {
@ -160,12 +171,13 @@ CSSVariableDeclarations::AddVariablesToResolver(
eCSSTokenSerialization_Nothing, eCSSTokenSerialization_Nothing,
false); false);
} else if (value.EqualsLiteral(INHERIT_VALUE) || } else if (value.EqualsLiteral(INHERIT_VALUE) ||
value.EqualsLiteral(UNSET_VALUE)) { value.EqualsLiteral(UNSET_VALUE) ||
// Values of 'inherit' and 'unset' don't need any handling, since it means value.EqualsLiteral(REVERT_VALUE)) {
// we just need to keep whatever value is currently in the resolver. This // Values of 'inherit', 'unset', and 'revert' don't need any handling,
// is because the specified variable declarations already have only the // since it means we just need to keep whatever value is currently in
// winning declaration for the variable and no longer have any of the // the resolver. This is because the specified variable declarations
// others. // already have only the winning declaration for the variable and no
// longer have any of the others.
} else { } else {
// At this point, we don't know what token types are at the start and end // At this point, we don't know what token types are at the start and end
// of the specified variable value. These will be determined later during // of the specified variable value. These will be determined later during

View file

@ -42,7 +42,8 @@ public:
eTokenStream, // a stream of CSS tokens (the usual type for variables) eTokenStream, // a stream of CSS tokens (the usual type for variables)
eInitial, // 'initial' eInitial, // 'initial'
eInherit, // 'inherit' eInherit, // 'inherit'
eUnset // 'unset' eUnset, // 'unset'
eRevert // 'revert'
}; };
/** /**
@ -53,8 +54,8 @@ public:
* @param aType Out parameter into which the type of the variable value will * @param aType Out parameter into which the type of the variable value will
* be stored. * be stored.
* @param aValue Out parameter into which the value of the variable will * @param aValue Out parameter into which the value of the variable will
* be stored. If the variable is 'initial', 'inherit' or 'unset', this will * be stored. If the variable is 'initial', 'inherit', 'unset', or
* be the empty string. * 'revert', this will be the empty string.
* @return Whether a variable with the given name was found. When false * @return Whether a variable with the given name was found. When false
* is returned, aType and aValue will not be modified. * is returned, aType and aValue will not be modified.
*/ */
@ -87,6 +88,15 @@ public:
*/ */
void PutUnset(const nsAString& aName); void PutUnset(const nsAString& aName);
/**
* Adds or modifies an existing entry in this set of variable declarations
* to have the value 'revert'.
*
* @param aName The variable name (not including any "--" prefix that would
* be part of the custom property name) whose value is to be set.
*/
void PutRevert(const nsAString& aName);
/** /**
* Adds or modifies an existing entry in this set of variable declarations * Adds or modifies an existing entry in this set of variable declarations
* to have a token stream value. * to have a token stream value.

View file

@ -558,9 +558,9 @@ Declaration::GetPropertyValueInternal(
// (1) Since a shorthand sets all sub-properties, if some of its // (1) Since a shorthand sets all sub-properties, if some of its
// subproperties were not specified, we must return the empty // subproperties were not specified, we must return the empty
// string. // string.
// (2) Since 'inherit', 'initial' and 'unset' can only be specified // (2) Since 'inherit', 'initial', 'unset', and 'revert' can only be
// as the values for entire properties, we need to return the // specified as the values for entire properties, we need to return
// empty string if some but not all of the subproperties have one // the empty string if some but not all of the subproperties have one
// of those values. // of those values.
// (3) Since a single value only makes sense with or without // (3) Since a single value only makes sense with or without
// !important, we return the empty string if some values are // !important, we return the empty string if some values are
@ -575,7 +575,7 @@ Declaration::GetPropertyValueInternal(
// assigned to the shorthand. // assigned to the shorthand.
const nsCSSValue* tokenStream = nullptr; const nsCSSValue* tokenStream = nullptr;
uint32_t totalCount = 0, importantCount = 0, uint32_t totalCount = 0, importantCount = 0,
initialCount = 0, inheritCount = 0, unsetCount = 0, initialCount = 0, inheritCount = 0, unsetCount = 0, revertCount = 0,
matchingTokenStreamCount = 0, nonMatchingTokenStreamCount = 0; matchingTokenStreamCount = 0, nonMatchingTokenStreamCount = 0;
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty, CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty,
CSSEnabledState::eForAllContent) { CSSEnabledState::eForAllContent) {
@ -601,6 +601,8 @@ Declaration::GetPropertyValueInternal(
++initialCount; ++initialCount;
} else if (val->GetUnit() == eCSSUnit_Unset) { } else if (val->GetUnit() == eCSSUnit_Unset) {
++unsetCount; ++unsetCount;
} else if (val->GetUnit() == eCSSUnit_Revert) {
++revertCount;
} else if (val->GetUnit() == eCSSUnit_TokenStream) { } else if (val->GetUnit() == eCSSUnit_TokenStream) {
if (val->GetTokenStreamValue()->mShorthandPropertyID == aProperty) { if (val->GetTokenStreamValue()->mShorthandPropertyID == aProperty) {
tokenStream = val; tokenStream = val;
@ -632,9 +634,15 @@ Declaration::GetPropertyValueInternal(
nsCSSValue::eNormalized); nsCSSValue::eNormalized);
return; return;
} }
if (initialCount != 0 || inheritCount != 0 || if (revertCount == totalCount) {
unsetCount != 0 || nonMatchingTokenStreamCount != 0) { // Simplify serialization below by serializing revert up-front.
// Case (2): partially initial, inherit, unset or token stream. nsCSSValue(eCSSUnit_Revert).AppendToString(eCSSProperty_UNKNOWN, aValue,
nsCSSValue::eNormalized);
return;
}
if (initialCount != 0 || inheritCount != 0 || unsetCount != 0 ||
revertCount != 0 || nonMatchingTokenStreamCount != 0) {
// Case (2): partially initial, inherit, unset, revert, or token stream.
return; return;
} }
if (tokenStream) { if (tokenStream) {
@ -794,21 +802,66 @@ Declaration::GetPropertyValueInternal(
MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]), MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]),
NS_LITERAL_CSTRING("-color")), NS_LITERAL_CSTRING("-color")),
"third subprop must be the color property"); "third subprop must be the color property");
const nsCSSValue *widthValue = data->ValueFor(subprops[0]);
const nsCSSValue *styleValue = data->ValueFor(subprops[1]);
const nsCSSValue *colorValue = data->ValueFor(subprops[2]); const nsCSSValue *colorValue = data->ValueFor(subprops[2]);
bool isCurrentColor =
bool isNoneStyle =
styleValue->GetUnit() == eCSSUnit_Enumerated &&
styleValue->GetIntValue() == NS_STYLE_BORDER_STYLE_NONE;
bool isMediumWidth =
widthValue->GetUnit() == eCSSUnit_Enumerated &&
widthValue->GetIntValue() == NS_STYLE_BORDER_WIDTH_MEDIUM;
bool isCurrentColor = colorValue->GetUnit() == eCSSUnit_EnumColor &&
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR;
if (isNoneStyle && isCurrentColor) {
// Case (1) above: some subproperties not specified.
return;
}
isCurrentColor =
colorValue->GetUnit() == eCSSUnit_EnumColor && colorValue->GetUnit() == eCSSUnit_EnumColor &&
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR; colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR;
if (!AppendValueToString(subprops[0], aValue, aSerialization) ||
!(aValue.Append(char16_t(' ')), // special case: if we have just color and all other values are default,
AppendValueToString(subprops[1], aValue, aSerialization)) || // output: color
// Don't output a third value when it's currentcolor. if (!isCurrentColor && isNoneStyle && isMediumWidth) {
!(isCurrentColor || if (!AppendValueToString(subprops[2], aValue, aSerialization)) {
(aValue.Append(char16_t(' ')),
AppendValueToString(subprops[2], aValue, aSerialization)))) {
aValue.Truncate(); aValue.Truncate();
} }
break; break;
} }
// normal case: output width unless medium and only have color
if (!(isMediumWidth && isNoneStyle && !isCurrentColor)) {
if (!AppendValueToString(subprops[0], aValue, aSerialization)) {
aValue.Truncate();
break;
}
}
// if style is not none, append style
if (!isNoneStyle) {
aValue.Append(char16_t(' '));
if (!AppendValueToString(subprops[1], aValue, aSerialization)) {
aValue.Truncate();
break;
}
}
if (!isCurrentColor) {
aValue.Append(char16_t(' '));
if (!AppendValueToString(subprops[2], aValue, aSerialization)) {
aValue.Truncate();
break;
}
}
break;
}
case eCSSProperty_background: { case eCSSProperty_background: {
GetImageLayerValue(data, aValue, aSerialization, GetImageLayerValue(data, aValue, aSerialization,
nsStyleImageLayers::kBackgroundLayerTable); nsStyleImageLayers::kBackgroundLayerTable);
@ -1022,12 +1075,21 @@ Declaration::GetPropertyValueInternal(
aSerialization); aSerialization);
break; break;
case eCSSProperty_overflow: { case eCSSProperty_overflow: {
const nsCSSValue &xValue = const nsCSSValue* xValue = data->ValueFor(eCSSProperty_overflow_x);
*data->ValueFor(eCSSProperty_overflow_x); const nsCSSValue* yValue = data->ValueFor(eCSSProperty_overflow_y);
const nsCSSValue &yValue = if (!xValue || !yValue ||
*data->ValueFor(eCSSProperty_overflow_y); xValue->GetUnit() != eCSSUnit_Enumerated ||
if (xValue == yValue) yValue->GetUnit() != eCSSUnit_Enumerated) {
xValue.AppendToString(eCSSProperty_overflow_x, aValue, aSerialization); aValue.Truncate(); // don't serialize shorthand if not both present/enumerated
break;
}
if (*xValue == *yValue) {
xValue->AppendToString(eCSSProperty_overflow_x, aValue, aSerialization);
} else {
xValue->AppendToString(eCSSProperty_overflow_x, aValue, aSerialization);
aValue.Append(char16_t(' '));
yValue->AppendToString(eCSSProperty_overflow_y, aValue, aSerialization);
}
break; break;
} }
case eCSSProperty_text_decoration: { case eCSSProperty_text_decoration: {
@ -1455,6 +1517,7 @@ Declaration::GetPropertyValueInternal(
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
return true; return true;
case eCSSUnit_Enumerated: case eCSSUnit_Enumerated:
// return false if there is a fallback value or <overflow-position> // return false if there is a fallback value or <overflow-position>
@ -1563,10 +1626,10 @@ Declaration::GetPropertyValueInternal(
break; break;
} }
case eCSSProperty_all: case eCSSProperty_all:
// If we got here, then we didn't have all "inherit" or "initial" or // If we got here, then we didn't have all "inherit", "initial", "unset",
// "unset" values for all of the longhand property components of 'all'. // or "revert" values for all of the longhand property components of
// There is no other possible value that is valid for all properties, // 'all'. There is no other possible value that is valid for all
// so serialize as the empty string. // properties, so serialize as the empty string.
break; break;
default: default:
MOZ_ASSERT(false, "no other shorthands"); MOZ_ASSERT(false, "no other shorthands");
@ -1663,6 +1726,10 @@ Declaration::AppendVariableAndValueToString(const nsAString& aName,
aResult.AppendLiteral("unset"); aResult.AppendLiteral("unset");
break; break;
case CSSVariableDeclarations::eRevert:
aResult.AppendLiteral("revert");
break;
default: default:
MOZ_ASSERT(false, "unexpected variable value type"); MOZ_ASSERT(false, "unexpected variable value type");
} }
@ -1899,6 +1966,10 @@ Declaration::GetVariableValue(const nsAString& aName, nsAString& aValue) const
aValue.AppendLiteral("unset"); aValue.AppendLiteral("unset");
break; break;
case CSSVariableDeclarations::eRevert:
aValue.AppendLiteral("revert");
break;
default: default:
MOZ_ASSERT(false, "unexpected variable value type"); MOZ_ASSERT(false, "unexpected variable value type");
} }
@ -1964,6 +2035,11 @@ Declaration::AddVariable(const nsAString& aName,
variables->PutUnset(aName); variables->PutUnset(aName);
break; break;
case CSSVariableDeclarations::eRevert:
MOZ_ASSERT(aValue.IsEmpty());
variables->PutRevert(aName);
break;
default: default:
MOZ_ASSERT(false, "unexpected aType value"); MOZ_ASSERT(false, "unexpected aType value");
} }

View file

@ -201,7 +201,7 @@ FontFaceSet::ParseFontShorthandForMatching(
const nsCSSValue* family = data->ValueFor(eCSSProperty_font_family); const nsCSSValue* family = data->ValueFor(eCSSProperty_font_family);
if (family->GetUnit() != eCSSUnit_FontFamilyList) { if (family->GetUnit() != eCSSUnit_FontFamilyList) {
// We got inherit, initial, unset, a system font, or a token stream. // We got inherit, initial, unset, revert, a system font, or a token stream.
aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
return; return;
} }

View file

@ -174,7 +174,8 @@ MapSinglePropertyInto(nsCSSPropertyID aTargetProp,
// then records any resulting ImageValue objects in the // then records any resulting ImageValue objects in the
// CSSVariableImageTable, to give them the appropriate lifetime. // CSSVariableImageTable, to give them the appropriate lifetime.
MOZ_ASSERT(aTargetValue->GetUnit() == eCSSUnit_TokenStream || MOZ_ASSERT(aTargetValue->GetUnit() == eCSSUnit_TokenStream ||
aTargetValue->GetUnit() == eCSSUnit_Null, aTargetValue->GetUnit() == eCSSUnit_Null ||
aTargetValue->GetUnit() == eCSSUnit_Revert,
"aTargetValue must only be a token stream (when re-parsing " "aTargetValue must only be a token stream (when re-parsing "
"properties with variable references) or null"); "properties with variable references) or null");
@ -316,8 +317,14 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
EnsurePhysicalProperty(iProp, aRuleData); EnsurePhysicalProperty(iProp, aRuleData);
} }
nsCSSValue* target = aRuleData->ValueFor(iProp); nsCSSValue* target = aRuleData->ValueFor(iProp);
if (target->GetUnit() == eCSSUnit_Null) { if (target->GetUnit() == eCSSUnit_Revert) {
const nsCSSValue *val = ValueAtIndex(i); if (aRuleData->mLevel >= target->GetCascadeOriginValue()) {
continue;
}
} else if (target->GetUnit() != eCSSUnit_Null) {
continue;
}
const nsCSSValue* val = ValueAtIndex(i);
// In order for variable resolution to have the right information // In order for variable resolution to have the right information
// about the stylesheet level of a value, that level needs to be // about the stylesheet level of a value, that level needs to be
// stored on the token stream. We can't do that at creation time // stored on the token stream. We can't do that at creation time
@ -326,11 +333,12 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
// the rule walking will have just updated aRuleData. // the rule walking will have just updated aRuleData.
if (val->GetUnit() == eCSSUnit_TokenStream) { if (val->GetUnit() == eCSSUnit_TokenStream) {
val->GetTokenStreamValue()->mLevel = aRuleData->mLevel; val->GetTokenStreamValue()->mLevel = aRuleData->mLevel;
} else if (val->GetUnit() == eCSSUnit_Revert) {
aRuleData->mConditions.SetUncacheable();
} }
MapSinglePropertyInto(iProp, val, target, aRuleData); MapSinglePropertyInto(iProp, val, target, aRuleData);
} }
} }
}
} }
const nsCSSValue* const nsCSSValue*

View file

@ -474,6 +474,7 @@ CSS_KEY(repeat, repeat)
CSS_KEY(repeat-x, repeat_x) CSS_KEY(repeat-x, repeat_x)
CSS_KEY(repeat-y, repeat_y) CSS_KEY(repeat-y, repeat_y)
CSS_KEY(reverse, reverse) CSS_KEY(reverse, reverse)
CSS_KEY(revert, revert)
CSS_KEY(ridge, ridge) CSS_KEY(ridge, ridge)
CSS_KEY(right, right) CSS_KEY(right, right)
CSS_KEY(rl, rl) CSS_KEY(rl, rl)

View file

@ -1170,8 +1170,9 @@ protected:
nsString& aValue); nsString& aValue);
/** /**
* Parses a CSS variable value. This could be 'initial', 'inherit', 'unset' * Parses a CSS variable value. This could be 'initial', 'inherit', 'unset',
* or a token stream, which may or may not include variable references. * 'revert', or a token stream, which may or may not include variable
* references.
* *
* @param aType Out parameter into which the type of the variable value * @param aType Out parameter into which the type of the variable value
* will be stored. * will be stored.
@ -1525,6 +1526,9 @@ protected:
// enum type be signed. // enum type be signed.
css::SheetParsingMode mParsingMode : 3; css::SheetParsingMode mParsingMode : 3;
// Indicates the cascade origin of the sheet.
mozilla::SheetType mLevel;
// True if we are in parsing rules for the chrome. // True if we are in parsing rules for the chrome.
bool mIsChrome : 1; bool mIsChrome : 1;
@ -1656,6 +1660,7 @@ CSSParserImpl::CSSParserImpl()
mHashlessColorQuirk(false), mHashlessColorQuirk(false),
mUnitlessLengthQuirk(false), mUnitlessLengthQuirk(false),
mParsingMode(css::eAuthorSheetFeatures), mParsingMode(css::eAuthorSheetFeatures),
mLevel(mozilla::SheetType::Doc),
mIsChrome(false), mIsChrome(false),
mViewportUnitsEnabled(true), mViewportUnitsEnabled(true),
mHTMLMediaMode(false), mHTMLMediaMode(false),
@ -1799,6 +1804,22 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
} }
mParsingMode = mSheet->ParsingMode(); mParsingMode = mSheet->ParsingMode();
switch (mParsingMode) {
case css::eAgentSheetFeatures:
mLevel = mozilla::SheetType::Agent;
break;
case css::eUserSheetFeatures:
mLevel = mozilla::SheetType::User;
break;
case css::eAuthorSheetFeatures:
mLevel = mozilla::SheetType::Doc;
break;
default:
MOZ_CRASH("impossible value for aType");
}
mIsChrome = dom::IsChromeURI(aSheetURI); mIsChrome = dom::IsChromeURI(aSheetURI);
mReusableSheets = aReusableSheets; mReusableSheets = aReusableSheets;
@ -1824,6 +1845,7 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
ReleaseScanner(); ReleaseScanner();
mParsingMode = css::eAuthorSheetFeatures; mParsingMode = css::eAuthorSheetFeatures;
mLevel = mozilla::SheetType::Doc;
mIsChrome = false; mIsChrome = false;
mReusableSheets = nullptr; mReusableSheets = nullptr;
@ -8185,6 +8207,10 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
aValue.SetUnsetValue(); aValue.SetUnsetValue();
return CSSParseResult::Ok; return CSSParseResult::Ok;
} }
else if (eCSSKeyword_revert == keyword) {
aValue.SetRevertValue(mLevel);
return CSSParseResult::Ok;
}
} }
if ((aVariantMask & VARIANT_NONE) != 0) { if ((aVariantMask & VARIANT_NONE) != 0) {
if (eCSSKeyword_none == keyword) { if (eCSSKeyword_none == keyword) {
@ -8384,7 +8410,8 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
!(tk->mIdent.LowerCaseEqualsLiteral("inherit") || !(tk->mIdent.LowerCaseEqualsLiteral("inherit") ||
tk->mIdent.LowerCaseEqualsLiteral("initial") || tk->mIdent.LowerCaseEqualsLiteral("initial") ||
(tk->mIdent.LowerCaseEqualsLiteral("unset") && (tk->mIdent.LowerCaseEqualsLiteral("unset") &&
nsLayoutUtils::UnsetValueEnabled())))) { nsLayoutUtils::UnsetValueEnabled()) ||
tk->mIdent.LowerCaseEqualsLiteral("revert")))) {
aValue.SetStringValue(tk->mIdent, eCSSUnit_Ident); aValue.SetStringValue(tk->mIdent, eCSSUnit_Ident);
return CSSParseResult::Ok; return CSSParseResult::Ok;
} }
@ -8454,6 +8481,7 @@ CSSParserImpl::ParseCustomIdent(nsCSSValue& aValue,
if (keyword == eCSSKeyword_inherit || if (keyword == eCSSKeyword_inherit ||
keyword == eCSSKeyword_initial || keyword == eCSSKeyword_initial ||
keyword == eCSSKeyword_unset || keyword == eCSSKeyword_unset ||
keyword == eCSSKeyword_revert ||
keyword == eCSSKeyword_default || keyword == eCSSKeyword_default ||
(aPropertyKTable && (aPropertyKTable &&
nsCSSProps::FindIndexOfKeyword(keyword, aPropertyKTable) >= 0)) { nsCSSProps::FindIndexOfKeyword(keyword, aPropertyKTable) >= 0)) {
@ -8675,7 +8703,7 @@ bool
CSSParserImpl::ParseImageOrientation(nsCSSValue& aValue) CSSParserImpl::ParseImageOrientation(nsCSSValue& aValue)
{ {
if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT, nullptr)) {
// 'inherit', 'initial' and 'unset' must be alone // 'inherit', 'initial', 'unset', and 'revert' must be alone
return true; return true;
} }
@ -8789,7 +8817,7 @@ CSSParserImpl::ParseElement(nsCSSValue& aValue)
bool bool
CSSParserImpl::ParseFlex() CSSParserImpl::ParseFlex()
{ {
// First check for inherit / initial / unset // First check for inherit / initial / unset / revert
nsCSSValue tmpVal; nsCSSValue tmpVal;
if (ParseSingleTokenVariant(tmpVal, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(tmpVal, VARIANT_INHERIT, nullptr)) {
AppendValue(eCSSProperty_flex_grow, tmpVal); AppendValue(eCSSProperty_flex_grow, tmpVal);
@ -10297,7 +10325,8 @@ bool
CSSParserImpl::ParseInitialLetter() CSSParserImpl::ParseInitialLetter()
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset', 'none', and 'normal' must be alone // 'inherit', 'initial', 'unset', 'revert', 'none', and 'normal'
// must be alone
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NORMAL, if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NORMAL,
nullptr)) { nullptr)) {
nsCSSValue first, second; nsCSSValue first, second;
@ -11551,8 +11580,14 @@ CSSParserImpl::ParseChoice(nsCSSValue aValues[],
} }
found = ((1 << aNumIDs) - 1); found = ((1 << aNumIDs) - 1);
} }
else if (eCSSUnit_Revert == aValues[0].GetUnit()) { // one revert, all revert
for (loop = 1; loop < aNumIDs; loop++) {
aValues[loop].SetRevertValue(mLevel);
} }
else { // more than one value, verify no inherits, initials or unsets found = ((1 << aNumIDs) - 1);
}
}
else { // more than one value, verify no inherits, initials, unsets, or reverts
for (loop = 0; loop < aNumIDs; loop++) { for (loop = 0; loop < aNumIDs; loop++) {
if (eCSSUnit_Inherit == aValues[loop].GetUnit()) { if (eCSSUnit_Inherit == aValues[loop].GetUnit()) {
found = -1; found = -1;
@ -11566,6 +11601,10 @@ CSSParserImpl::ParseChoice(nsCSSValue aValues[],
found = -1; found = -1;
break; break;
} }
else if (eCSSUnit_Revert == aValues[loop].GetUnit()) {
found = -1;
break;
}
} }
} }
} }
@ -11604,12 +11643,13 @@ CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[])
return false; return false;
} }
if (1 < count) { // verify no more than single inherit, initial or unset if (1 < count) { // verify no more than single inherit, initial, unset, or revert
NS_FOR_CSS_SIDES (index) { NS_FOR_CSS_SIDES (index) {
nsCSSUnit unit = (result.*(nsCSSRect::sides[index])).GetUnit(); nsCSSUnit unit = (result.*(nsCSSRect::sides[index])).GetUnit();
if (eCSSUnit_Inherit == unit || if (eCSSUnit_Inherit == unit ||
eCSSUnit_Initial == unit || eCSSUnit_Initial == unit ||
eCSSUnit_Unset == unit) { eCSSUnit_Unset == unit ||
eCSSUnit_Revert == unit) {
return false; return false;
} }
} }
@ -11713,10 +11753,11 @@ CSSParserImpl::ParseBoxCornerRadius(nsCSSPropertyID aPropID)
return false; return false;
} }
// optional second value (forbidden if first value is inherit/initial/unset) // optional second value (forbidden if first value is inherit/initial/unset/revert)
if (dimenX.GetUnit() != eCSSUnit_Inherit && if (dimenX.GetUnit() != eCSSUnit_Inherit &&
dimenX.GetUnit() != eCSSUnit_Initial && dimenX.GetUnit() != eCSSUnit_Initial &&
dimenX.GetUnit() != eCSSUnit_Unset) { dimenX.GetUnit() != eCSSUnit_Unset &&
dimenX.GetUnit() != eCSSUnit_Revert) {
if (ParseNonNegativeVariant(dimenY, VARIANT_LP | VARIANT_CALC, nullptr) == if (ParseNonNegativeVariant(dimenY, VARIANT_LP | VARIANT_CALC, nullptr) ==
CSSParseResult::Error) { CSSParseResult::Error) {
return false; return false;
@ -11774,12 +11815,14 @@ CSSParserImpl::ParseBoxCornerRadiiInternals(nsCSSValue array[])
return false; return false;
} }
// if 'initial', 'inherit' or 'unset' was used, it must be the only value // if 'initial', 'inherit', 'unset', or 'revert' was used, it
// must be the only value
if (countX > 1 || countY > 0) { if (countX > 1 || countY > 0) {
nsCSSUnit unit = dimenX.mTop.GetUnit(); nsCSSUnit unit = dimenX.mTop.GetUnit();
if (eCSSUnit_Inherit == unit || if (eCSSUnit_Inherit == unit ||
eCSSUnit_Initial == unit || eCSSUnit_Initial == unit ||
eCSSUnit_Unset == unit) eCSSUnit_Unset == unit ||
eCSSUnit_Revert == unit)
return false; return false;
} }
@ -12526,6 +12569,7 @@ CSSParserImpl::ParseFontDescriptorValue(nsCSSFontDesc aDescID,
aValue.GetUnit() != eCSSUnit_Inherit && aValue.GetUnit() != eCSSUnit_Inherit &&
aValue.GetUnit() != eCSSUnit_Initial && aValue.GetUnit() != eCSSUnit_Initial &&
aValue.GetUnit() != eCSSUnit_Unset && aValue.GetUnit() != eCSSUnit_Unset &&
aValue.GetUnit() != eCSSUnit_Revert &&
(aValue.GetUnit() != eCSSUnit_Enumerated || (aValue.GetUnit() != eCSSUnit_Enumerated ||
(aValue.GetIntValue() != NS_STYLE_FONT_WEIGHT_BOLDER && (aValue.GetIntValue() != NS_STYLE_FONT_WEIGHT_BOLDER &&
aValue.GetIntValue() != NS_STYLE_FONT_WEIGHT_LIGHTER))); aValue.GetIntValue() != NS_STYLE_FONT_WEIGHT_LIGHTER)));
@ -12590,7 +12634,7 @@ CSSParserImpl::ParseImageLayers(const nsCSSPropertyID aTable[])
// background-color can only be set once, so it's not a list. // background-color can only be set once, so it's not a list.
nsCSSValue color; nsCSSValue color;
// Check first for inherit/initial/unset. // Check first for inherit/initial/unset/revert.
if (ParseSingleTokenVariant(color, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(color, VARIANT_INHERIT, nullptr)) {
// must be alone // must be alone
for (const nsCSSPropertyID* subprops = for (const nsCSSPropertyID* subprops =
@ -12787,7 +12831,8 @@ CSSParserImpl::ParseImageLayersItem(
int32_t dummy; int32_t dummy;
if (keyword == eCSSKeyword_inherit || if (keyword == eCSSKeyword_inherit ||
keyword == eCSSKeyword_initial || keyword == eCSSKeyword_initial ||
keyword == eCSSKeyword_unset) { keyword == eCSSKeyword_unset ||
keyword == eCSSKeyword_revert) {
return false; return false;
} else if (keyword == eCSSKeyword_none) { } else if (keyword == eCSSKeyword_none) {
if (haveImage) if (haveImage)
@ -12950,7 +12995,7 @@ CSSParserImpl::ParseImageLayersItem(
if (haveColor) if (haveColor)
return false; return false;
haveColor = true; haveColor = true;
// Note: This parses 'inherit', 'initial' and 'unset', but // Note: This parses 'inherit', 'initial', 'unset', and 'revert', but
// we've already checked for them, so it's ok. // we've already checked for them, so it's ok.
if (ParseSingleValueProperty(aState.mColor, if (ParseSingleValueProperty(aState.mColor,
aTable[nsStyleImageLayers::color]) != aTable[nsStyleImageLayers::color]) !=
@ -12974,7 +13019,7 @@ CSSParserImpl::ParseValueList(nsCSSPropertyID aPropID)
{ {
// aPropID is a single value prop-id // aPropID is a single value prop-id
nsCSSValue value; nsCSSValue value;
// 'initial', 'inherit' and 'unset' stand alone, no list permitted. // 'initial', 'inherit', 'unset', and 'revert' stand alone, no list permitted.
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValueList* item = value.SetListValue(); nsCSSValueList* item = value.SetListValue();
for (;;) { for (;;) {
@ -12997,7 +13042,7 @@ bool
CSSParserImpl::ParseImageLayerRepeat(nsCSSPropertyID aPropID) CSSParserImpl::ParseImageLayerRepeat(nsCSSPropertyID aPropID)
{ {
nsCSSValue value; nsCSSValue value;
// 'initial', 'inherit' and 'unset' stand alone, no list permitted. // 'initial', 'inherit', 'unset', and 'revert' stand alone, no list permitted.
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValuePair valuePair; nsCSSValuePair valuePair;
if (!ParseImageLayerRepeatValues(valuePair)) { if (!ParseImageLayerRepeatValues(valuePair)) {
@ -13047,7 +13092,7 @@ CSSParserImpl::ParseImageLayerRepeatValues(nsCSSValuePair& aValue)
bool bool
CSSParserImpl::ParseImageLayerPosition(const nsCSSPropertyID aTable[]) CSSParserImpl::ParseImageLayerPosition(const nsCSSPropertyID aTable[])
{ {
// 'initial', 'inherit' and 'unset' stand alone, no list permitted. // 'initial', 'inherit', 'unset', and 'revert' stand alone, no list permitted.
nsCSSValue position; nsCSSValue position;
if (ParseSingleTokenVariant(position, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(position, VARIANT_INHERIT, nullptr)) {
AppendValue(aTable[nsStyleImageLayers::positionX], position); AppendValue(aTable[nsStyleImageLayers::positionX], position);
@ -13088,7 +13133,7 @@ bool
CSSParserImpl::ParseImageLayerPositionCoord(nsCSSPropertyID aPropID, bool aIsHorizontal) CSSParserImpl::ParseImageLayerPositionCoord(nsCSSPropertyID aPropID, bool aIsHorizontal)
{ {
nsCSSValue value; nsCSSValue value;
// 'initial', 'inherit' and 'unset' stand alone, no list permitted. // 'initial', 'inherit', 'unset', and 'revert' stand alone, no list permitted.
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValue itemValue; nsCSSValue itemValue;
if (!ParseImageLayerPositionCoordItem(itemValue, aIsHorizontal)) { if (!ParseImageLayerPositionCoordItem(itemValue, aIsHorizontal)) {
@ -13123,8 +13168,8 @@ CSSParserImpl::ParseImageLayerPositionCoord(nsCSSPropertyID aPropID, bool aIsHor
* like "top," "left center," etc. * like "top," "left center," etc.
* *
* @param aOut The nsCSSValuePair in which to place the result. * @param aOut The nsCSSValuePair in which to place the result.
* @param aAcceptsInherit If true, 'inherit', 'initial' and 'unset' are * @param aAcceptsInherit If true, 'inherit', 'initial', 'unset', and 'revert'
* legal values * are legal values
* @param aAllowExplicitCenter If true, 'center' is a legal value * @param aAllowExplicitCenter If true, 'center' is a legal value
* @return Whether or not the operation succeeded. * @return Whether or not the operation succeeded.
*/ */
@ -13143,7 +13188,8 @@ bool CSSParserImpl::ParseBoxPositionValues(nsCSSValuePair &aOut,
} else if (result == CSSParseResult::Ok) { } else if (result == CSSParseResult::Ok) {
if (eCSSUnit_Inherit == xValue.GetUnit() || if (eCSSUnit_Inherit == xValue.GetUnit() ||
eCSSUnit_Initial == xValue.GetUnit() || eCSSUnit_Initial == xValue.GetUnit() ||
eCSSUnit_Unset == xValue.GetUnit()) { // both are inherit, initial or unset eCSSUnit_Unset == xValue.GetUnit() ||
eCSSUnit_Revert == xValue.GetUnit()) { // both are inherit, initial, unset, or revert
yValue = xValue; yValue = xValue;
return true; return true;
} }
@ -13557,7 +13603,7 @@ bool
CSSParserImpl::ParseImageLayerSize(nsCSSPropertyID aPropID) CSSParserImpl::ParseImageLayerSize(nsCSSPropertyID aPropID)
{ {
nsCSSValue value; nsCSSValue value;
// 'initial', 'inherit' and 'unset' stand alone, no list permitted. // 'initial', 'inherit', 'unset', and 'revert' stand alone, no list permitted.
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValuePair valuePair; nsCSSValuePair valuePair;
if (!ParseImageLayerSizeValues(valuePair)) { if (!ParseImageLayerSizeValues(valuePair)) {
@ -13585,8 +13631,8 @@ CSSParserImpl::ParseImageLayerSize(nsCSSPropertyID aPropID)
* Parses two values that correspond to lengths for the background-size * Parses two values that correspond to lengths for the background-size
* property. These can be one or two lengths (or the 'auto' keyword) or * property. These can be one or two lengths (or the 'auto' keyword) or
* percentages corresponding to the element's dimensions or the single keywords * percentages corresponding to the element's dimensions or the single keywords
* 'contain' or 'cover'. 'initial', 'inherit' and 'unset' must be handled by * 'contain' or 'cover'. 'initial', 'inherit', 'unset', and 'revert' must be
* the caller if desired. * handled by the caller if desired.
* *
* @param aOut The nsCSSValuePair in which to place the result. * @param aOut The nsCSSValuePair in which to place the result.
* @return Whether or not the operation succeeded. * @return Whether or not the operation succeeded.
@ -13684,8 +13730,8 @@ CSSParserImpl::ParseBorderImageSlice(bool aAcceptsInherit,
if (aAcceptsInherit && if (aAcceptsInherit &&
ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
// Keywords "inherit", "initial" and "unset" can not be mixed, so we // Keywords "inherit", "initial", "unset", and "revert" can not be
// are done. // mixed, so we are done.
AppendValue(eCSSProperty_border_image_slice, value); AppendValue(eCSSProperty_border_image_slice, value);
return true; return true;
} }
@ -13735,8 +13781,8 @@ CSSParserImpl::ParseBorderImageWidth(bool aAcceptsInherit)
if (aAcceptsInherit && if (aAcceptsInherit &&
ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
// Keywords "inherit", "initial" and "unset" can not be mixed, so we // Keywords "inherit", "initial", "unset", and "revert" can not be
// are done. // mixed, so we are done.
AppendValue(eCSSProperty_border_image_width, value); AppendValue(eCSSProperty_border_image_width, value);
return true; return true;
} }
@ -13758,8 +13804,8 @@ CSSParserImpl::ParseBorderImageOutset(bool aAcceptsInherit)
if (aAcceptsInherit && if (aAcceptsInherit &&
ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
// Keywords "inherit", "initial" and "unset" can not be mixed, so we // Keywords "inherit", "initial", "unset", and "revert" can not be
// are done. // mixed, so we are done.
AppendValue(eCSSProperty_border_image_outset, value); AppendValue(eCSSProperty_border_image_outset, value);
return true; return true;
} }
@ -13779,8 +13825,8 @@ CSSParserImpl::ParseBorderImageRepeat(bool aAcceptsInherit)
nsCSSValue value; nsCSSValue value;
if (aAcceptsInherit && if (aAcceptsInherit &&
ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
// Keywords "inherit", "initial" and "unset" can not be mixed, so we // Keywords "inherit", "initial", "unset", and "revert" can not be
// are done. // mixed, so we are done.
AppendValue(eCSSProperty_border_image_repeat, value); AppendValue(eCSSProperty_border_image_repeat, value);
return true; return true;
} }
@ -13819,7 +13865,8 @@ CSSParserImpl::ParseBorderImage()
AppendValue(eCSSProperty_border_image_width, value); AppendValue(eCSSProperty_border_image_width, value);
AppendValue(eCSSProperty_border_image_outset, value); AppendValue(eCSSProperty_border_image_outset, value);
AppendValue(eCSSProperty_border_image_repeat, value); AppendValue(eCSSProperty_border_image_repeat, value);
// Keywords "inherit", "initial" and "unset" can't be mixed, so we are done. // Keywords "inherit", "initial", "unset", and "revert" can not be
// mixed, so we are done.
return true; return true;
} }
@ -13973,8 +14020,9 @@ CSSParserImpl::ParseBorderSide(const nsCSSPropertyID aPropIDs[],
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
extraValue = values[0]; extraValue = values[0];
// Set value of border-image properties to initial/inherit/unset // Set value of border-image properties to initial/inherit/unset/revert
AppendValue(eCSSProperty_border_image_source, extraValue); AppendValue(eCSSProperty_border_image_source, extraValue);
AppendValue(eCSSProperty_border_image_slice, extraValue); AppendValue(eCSSProperty_border_image_slice, extraValue);
AppendValue(eCSSProperty_border_image_width, extraValue); AppendValue(eCSSProperty_border_image_width, extraValue);
@ -14015,7 +14063,8 @@ bool
CSSParserImpl::ParseBorderColors(nsCSSPropertyID aProperty) CSSParserImpl::ParseBorderColors(nsCSSPropertyID aProperty)
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' are only allowed on their own // 'inherit', 'initial', 'unset', 'revert', and 'none' are only allowed
// on their own
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE, if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE,
nullptr)) { nullptr)) {
nsCSSValueList *cur = value.SetListValue(); nsCSSValueList *cur = value.SetListValue();
@ -14402,8 +14451,8 @@ CSSParserImpl::ParseContent()
"content keyword tables out of sync"); "content keyword tables out of sync");
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset', 'normal', 'none', and 'alt-content' must // 'inherit', 'initial', 'unset', 'revert', 'normal', 'none', and
// be alone // 'alt-content' must be alone
if (!ParseSingleTokenVariant(value, VARIANT_HMK | VARIANT_NONE, if (!ParseSingleTokenVariant(value, VARIANT_HMK | VARIANT_NONE,
kContentSolitaryKWs)) { kContentSolitaryKWs)) {
nsCSSValueList* cur = value.SetListValue(); nsCSSValueList* cur = value.SetListValue();
@ -14473,7 +14522,7 @@ bool
CSSParserImpl::ParseCursor() CSSParserImpl::ParseCursor()
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial' and 'unset' must be alone // 'inherit', 'initial', 'unset', and 'revert' must be alone
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) { if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValueList* cur = value.SetListValue(); nsCSSValueList* cur = value.SetListValue();
for (;;) { for (;;) {
@ -14517,7 +14566,8 @@ CSSParserImpl::ParseFont()
if (ParseSingleTokenVariant(family, VARIANT_HK, nsCSSProps::kFontKTable)) { if (ParseSingleTokenVariant(family, VARIANT_HK, nsCSSProps::kFontKTable)) {
if (eCSSUnit_Inherit == family.GetUnit() || if (eCSSUnit_Inherit == family.GetUnit() ||
eCSSUnit_Initial == family.GetUnit() || eCSSUnit_Initial == family.GetUnit() ||
eCSSUnit_Unset == family.GetUnit()) { eCSSUnit_Unset == family.GetUnit() ||
eCSSUnit_Revert == family.GetUnit()) {
AppendValue(eCSSProperty__x_system_font, nsCSSValue(eCSSUnit_None)); AppendValue(eCSSProperty__x_system_font, nsCSSValue(eCSSUnit_None));
AppendValue(eCSSProperty_font_family, family); AppendValue(eCSSProperty_font_family, family);
AppendValue(eCSSProperty_font_style, family); AppendValue(eCSSProperty_font_style, family);
@ -14585,7 +14635,8 @@ CSSParserImpl::ParseFont()
if (found < 0 || if (found < 0 ||
eCSSUnit_Inherit == values[kFontStyleIndex].GetUnit() || eCSSUnit_Inherit == values[kFontStyleIndex].GetUnit() ||
eCSSUnit_Initial == values[kFontStyleIndex].GetUnit() || eCSSUnit_Initial == values[kFontStyleIndex].GetUnit() ||
eCSSUnit_Unset == values[kFontStyleIndex].GetUnit()) { // illegal data eCSSUnit_Unset == values[kFontStyleIndex].GetUnit() ||
eCSSUnit_Revert == values[kFontStyleIndex].GetUnit() ) { // illegal data
return false; return false;
} }
if ((found & (1 << kFontStyleIndex)) == 0) { if ((found & (1 << kFontStyleIndex)) == 0) {
@ -14643,7 +14694,8 @@ CSSParserImpl::ParseFont()
if (ParseFamily(family)) { if (ParseFamily(family)) {
if (eCSSUnit_Inherit != family.GetUnit() && if (eCSSUnit_Inherit != family.GetUnit() &&
eCSSUnit_Initial != family.GetUnit() && eCSSUnit_Initial != family.GetUnit() &&
eCSSUnit_Unset != family.GetUnit()) { eCSSUnit_Unset != family.GetUnit() &&
eCSSUnit_Revert != family.GetUnit()) {
AppendValue(eCSSProperty__x_system_font, nsCSSValue(eCSSUnit_None)); AppendValue(eCSSProperty__x_system_font, nsCSSValue(eCSSUnit_None));
AppendValue(eCSSProperty_font_family, family); AppendValue(eCSSProperty_font_family, family);
AppendValue(eCSSProperty_font_style, values[kFontStyleIndex]); AppendValue(eCSSProperty_font_style, values[kFontStyleIndex]);
@ -14688,7 +14740,8 @@ CSSParserImpl::ParseFontSynthesis(nsCSSValue& aValue)
if (eCSSUnit_None == aValue.GetUnit() || if (eCSSUnit_None == aValue.GetUnit() ||
eCSSUnit_Initial == aValue.GetUnit() || eCSSUnit_Initial == aValue.GetUnit() ||
eCSSUnit_Inherit == aValue.GetUnit() || eCSSUnit_Inherit == aValue.GetUnit() ||
eCSSUnit_Unset == aValue.GetUnit()) eCSSUnit_Unset == aValue.GetUnit() ||
eCSSUnit_Revert == aValue.GetUnit() )
{ {
return true; return true;
} }
@ -15308,6 +15361,9 @@ CSSParserImpl::ParseFamily(nsCSSValue& aValue)
return true; return true;
} }
break; break;
case eCSSKeyword_revert:
aValue.SetRevertValue(mLevel);
return true;
case eCSSKeyword__moz_use_system_font: case eCSSKeyword__moz_use_system_font:
if (!IsParsingCompoundProperty()) { if (!IsParsingCompoundProperty()) {
aValue.SetSystemFontValue(); aValue.SetSystemFontValue();
@ -15341,6 +15397,7 @@ CSSParserImpl::ParseFamily(nsCSSValue& aValue)
case eCSSKeyword_inherit: case eCSSKeyword_inherit:
case eCSSKeyword_initial: case eCSSKeyword_initial:
case eCSSKeyword_default: case eCSSKeyword_default:
case eCSSKeyword_revert:
case eCSSKeyword__moz_use_system_font: case eCSSKeyword__moz_use_system_font:
return false; return false;
case eCSSKeyword_unset: case eCSSKeyword_unset:
@ -15790,25 +15847,41 @@ CSSParserImpl::ParseOutline()
bool bool
CSSParserImpl::ParseOverflow() CSSParserImpl::ParseOverflow()
{ {
nsCSSValue overflow; nsCSSValue overflowX, overflowY;
if (!ParseSingleTokenVariant(overflow, VARIANT_HK, // Parse the first value
nsCSSProps::kOverflowKTable)) { if (!ParseSingleTokenVariant(overflowX, VARIANT_HK, nsCSSProps::kOverflowKTable)) {
return false; return false;
} }
nsCSSValue overflowX(overflow); // Try to parse a second value (optional)
nsCSSValue overflowY(overflow); bool haveSecond = ParseSingleTokenVariant(overflowY, VARIANT_HK, nsCSSProps::kOverflowKTable);
if (eCSSUnit_Enumerated == overflow.GetUnit()) if (!haveSecond) {
switch(overflow.GetIntValue()) { overflowY = overflowX;
}
// Handle legacy scrollbars keywords for each axis
auto fix_legacy = [](nsCSSValue& v, bool isX) {
if (v.GetUnit() == eCSSUnit_Enumerated) {
switch (v.GetIntValue()) {
case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL: case NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL:
overflowX.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated); if (isX) {
overflowY.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated); v.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated);
} else {
v.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated);
}
break; break;
case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL: case NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL:
overflowX.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated); if (isX) {
overflowY.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated); v.SetIntValue(NS_STYLE_OVERFLOW_HIDDEN, eCSSUnit_Enumerated);
} else {
v.SetIntValue(NS_STYLE_OVERFLOW_SCROLL, eCSSUnit_Enumerated);
}
break; break;
} }
}
};
fix_legacy(overflowX, true);
fix_legacy(overflowY, false);
AppendValue(eCSSProperty_overflow_x, overflowX); AppendValue(eCSSProperty_overflow_x, overflowX);
AppendValue(eCSSProperty_overflow_y, overflowY); AppendValue(eCSSProperty_overflow_y, overflowY);
return true; return true;
@ -16013,7 +16086,7 @@ bool
CSSParserImpl::ParseTextAlign(nsCSSValue& aValue, const KTableEntry aTable[]) CSSParserImpl::ParseTextAlign(nsCSSValue& aValue, const KTableEntry aTable[])
{ {
if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT, nullptr)) {
// 'inherit', 'initial' and 'unset' must be alone // 'inherit', 'initial', 'unset', and 'revert' must be alone
return true; return true;
} }
@ -16108,7 +16181,7 @@ bool
CSSParserImpl::ParseTextOverflow(nsCSSValue& aValue) CSSParserImpl::ParseTextOverflow(nsCSSValue& aValue)
{ {
if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(aValue, VARIANT_INHERIT, nullptr)) {
// 'inherit', 'initial' and 'unset' must be alone // 'inherit', 'initial', 'unset', and 'revert' must be alone
return true; return true;
} }
@ -16139,7 +16212,7 @@ CSSParserImpl::ParseTouchAction(nsCSSValue& aValue)
} }
// Auto and None keywords aren't allowed in conjunction with others. // Auto and None keywords aren't allowed in conjunction with others.
// Also inherit, initial and unset values are available. // Also inherit, initial, unset, and revert values are available.
if (eCSSUnit_Enumerated != aValue.GetUnit()) { if (eCSSUnit_Enumerated != aValue.GetUnit()) {
return true; return true;
} }
@ -16644,7 +16717,7 @@ bool
CSSParserImpl::ParseTransform(bool aIsPrefixed, bool aDisallowRelativeValues) CSSParserImpl::ParseTransform(bool aIsPrefixed, bool aDisallowRelativeValues)
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' must be alone // 'inherit', 'initial', 'unset', 'revert', and 'none' must be alone
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE, if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE,
nullptr)) { nullptr)) {
nsCSSValueSharedList* list = new nsCSSValueSharedList; nsCSSValueSharedList* list = new nsCSSValueSharedList;
@ -16930,7 +17003,8 @@ bool
CSSParserImpl::ParseShapeOutside(nsCSSValue& aValue) CSSParserImpl::ParseShapeOutside(nsCSSValue& aValue)
{ {
if (ParseSingleTokenVariant(aValue, VARIANT_HUO, nullptr)) { if (ParseSingleTokenVariant(aValue, VARIANT_HUO, nullptr)) {
// 'inherit', 'initial', 'unset', 'none', and <image> url must be alone. // 'inherit', 'initial', 'unset', 'revert', 'none', and
// <image> url must be alone.
return true; return true;
} }
@ -16954,9 +17028,10 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective)
// a pair, and to keep the computation code simple. // a pair, and to keep the computation code simple.
if (position.mXValue.GetUnit() == eCSSUnit_Inherit || if (position.mXValue.GetUnit() == eCSSUnit_Inherit ||
position.mXValue.GetUnit() == eCSSUnit_Initial || position.mXValue.GetUnit() == eCSSUnit_Initial ||
position.mXValue.GetUnit() == eCSSUnit_Unset) { position.mXValue.GetUnit() == eCSSUnit_Unset ||
position.mXValue.GetUnit() == eCSSUnit_Revert) {
MOZ_ASSERT(position.mXValue == position.mYValue, MOZ_ASSERT(position.mXValue == position.mYValue,
"inherit/initial/unset only half?"); "inherit/initial/unset/revert only half?");
AppendValue(prop, position.mXValue); AppendValue(prop, position.mXValue);
} else { } else {
nsCSSValue value; nsCSSValue value;
@ -17133,7 +17208,7 @@ bool
CSSParserImpl::ParseFilter() CSSParserImpl::ParseFilter()
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' must be alone // 'inherit', 'initial', 'unset', 'revert', and 'none' must be alone
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE, if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE,
nullptr)) { nullptr)) {
nsCSSValueList* cur = value.SetListValue(); nsCSSValueList* cur = value.SetListValue();
@ -17162,7 +17237,7 @@ bool
CSSParserImpl::ParseTransitionProperty() CSSParserImpl::ParseTransitionProperty()
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' must be alone // 'inherit', 'initial', 'unset', 'revert', and 'none' must be alone
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE, if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE,
nullptr)) { nullptr)) {
// Accept a list of arbitrary identifiers. They should be // Accept a list of arbitrary identifiers. They should be
@ -17178,13 +17253,14 @@ CSSParserImpl::ParseTransitionProperty()
} }
if (cur->mValue.GetUnit() == eCSSUnit_Ident) { if (cur->mValue.GetUnit() == eCSSUnit_Ident) {
nsDependentString str(cur->mValue.GetStringBufferValue()); nsDependentString str(cur->mValue.GetStringBufferValue());
// Exclude 'none', 'inherit', 'initial' and 'unset' according to the // Exclude 'none', 'inherit', 'initial', 'unset', and 'revert'
// same rules as for 'counter-reset' in CSS 2.1. // according to the same rules as for 'counter-reset' in CSS 2.1.
if (str.LowerCaseEqualsLiteral("none") || if (str.LowerCaseEqualsLiteral("none") ||
str.LowerCaseEqualsLiteral("inherit") || str.LowerCaseEqualsLiteral("inherit") ||
str.LowerCaseEqualsLiteral("initial") || str.LowerCaseEqualsLiteral("initial") ||
(str.LowerCaseEqualsLiteral("unset") && (str.LowerCaseEqualsLiteral("unset") &&
nsLayoutUtils::UnsetValueEnabled())) { nsLayoutUtils::UnsetValueEnabled()) ||
str.LowerCaseEqualsLiteral("revert")) {
return false; return false;
} }
} }
@ -17325,9 +17401,9 @@ CSSParserImpl::ParseAnimationOrTransitionShorthand(
size_t aNumProperties) size_t aNumProperties)
{ {
nsCSSValue tempValue; nsCSSValue tempValue;
// first see if 'inherit', 'initial' or 'unset' is specified. If one is, // first see if 'inherit', 'initial', 'unset', or 'revert' is specified.
// it can be the only thing specified, so don't attempt to parse any // If one is, it can be the only thing specified, so don't attempt to
// additional properties // parse any additional properties
if (ParseSingleTokenVariant(tempValue, VARIANT_INHERIT, nullptr)) { if (ParseSingleTokenVariant(tempValue, VARIANT_INHERIT, nullptr)) {
for (uint32_t i = 0; i < aNumProperties; ++i) { for (uint32_t i = 0; i < aNumProperties; ++i) {
AppendValue(aProperties[i], tempValue); AppendValue(aProperties[i], tempValue);
@ -17452,7 +17528,7 @@ CSSParserImpl::ParseTransition()
// Make two checks on the list for 'transition-property': // Make two checks on the list for 'transition-property':
// + If there is more than one item, then none of the items can be // + If there is more than one item, then none of the items can be
// 'none'. // 'none'.
// + None of the items can be 'inherit', 'initial' or 'unset'. // + None of the items can be 'inherit', 'initial', 'unset', or 'revert'.
{ {
MOZ_ASSERT(kTransitionProperties[3] == eCSSProperty_transition_property, MOZ_ASSERT(kTransitionProperties[3] == eCSSProperty_transition_property,
"array index mismatch"); "array index mismatch");
@ -17475,7 +17551,8 @@ CSSParserImpl::ParseTransition()
if (str.EqualsLiteral("inherit") || if (str.EqualsLiteral("inherit") ||
str.EqualsLiteral("initial") || str.EqualsLiteral("initial") ||
(str.EqualsLiteral("unset") && (str.EqualsLiteral("unset") &&
nsLayoutUtils::UnsetValueEnabled())) { nsLayoutUtils::UnsetValueEnabled()) ||
str.EqualsLiteral("revert")) {
return false; return false;
} }
} }
@ -17644,7 +17721,7 @@ CSSParserImpl::ParseShadowList(nsCSSPropertyID aProperty)
bool isBoxShadow = aProperty == eCSSProperty_box_shadow; bool isBoxShadow = aProperty == eCSSProperty_box_shadow;
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' must be alone // 'inherit', 'initial', 'unset', 'revert', and 'none' must be alone
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE, if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE,
nullptr)) { nullptr)) {
nsCSSValueList* cur = value.SetListValue(); nsCSSValueList* cur = value.SetListValue();
@ -17731,7 +17808,8 @@ CSSParserImpl::ParseDasharray()
{ {
nsCSSValue value; nsCSSValue value;
// 'inherit', 'initial', 'unset' and 'none' are only allowed on their own // 'inherit', 'initial', 'unset', 'revert' and 'none' are only allowed
// on their own
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE | if (!ParseSingleTokenVariant(value, VARIANT_INHERIT | VARIANT_NONE |
VARIANT_OPENTYPE_SVG_KEYWORD, VARIANT_OPENTYPE_SVG_KEYWORD,
nsCSSProps::kStrokeContextValueKTable)) { nsCSSProps::kStrokeContextValueKTable)) {
@ -18095,8 +18173,8 @@ CSSParserImpl::ParseValueWithVariables(CSSVariableDeclarations::Type* aType,
} }
} }
// Look for 'initial', 'inherit' or 'unset' as the first non-white space // Look for 'initial', 'inherit', 'unset', or 'revert' as the first
// token. // non-white space token.
CSSVariableDeclarations::Type type = CSSVariableDeclarations::eTokenStream; CSSVariableDeclarations::Type type = CSSVariableDeclarations::eTokenStream;
if (mToken.mType == eCSSToken_Ident) { if (mToken.mType == eCSSToken_Ident) {
if (mToken.mIdent.LowerCaseEqualsLiteral("initial")) { if (mToken.mIdent.LowerCaseEqualsLiteral("initial")) {
@ -18105,6 +18183,8 @@ CSSParserImpl::ParseValueWithVariables(CSSVariableDeclarations::Type* aType,
type = CSSVariableDeclarations::eInherit; type = CSSVariableDeclarations::eInherit;
} else if (mToken.mIdent.LowerCaseEqualsLiteral("unset")) { } else if (mToken.mIdent.LowerCaseEqualsLiteral("unset")) {
type = CSSVariableDeclarations::eUnset; type = CSSVariableDeclarations::eUnset;
} else if (mToken.mIdent.LowerCaseEqualsLiteral("revert")) {
type = CSSVariableDeclarations::eRevert;
} }
} }

View file

@ -4391,9 +4391,9 @@ CSS_PROP_USERINTERFACE(
CSS_PROP_NO_OFFSET, CSS_PROP_NO_OFFSET,
eStyleAnimType_Discrete) // XXX bug 3935 eStyleAnimType_Discrete) // XXX bug 3935
CSS_PROP_UIRESET( CSS_PROP_UIRESET(
-moz-user-select, user-select,
user_select, user_select,
CSS_PROP_DOMPROP_PREFIXED(UserSelect), UserSelect,
CSS_PROPERTY_PARSE_VALUE, CSS_PROPERTY_PARSE_VALUE,
"", "",
VARIANT_HK, VARIANT_HK,

View file

@ -54,3 +54,4 @@ CSS_PROP_LOGICAL_GROUP_BOX(Offset)
CSS_PROP_LOGICAL_GROUP_SHORTHAND(Padding) CSS_PROP_LOGICAL_GROUP_SHORTHAND(Padding)
CSS_PROP_LOGICAL_GROUP_AXIS(MinSize) CSS_PROP_LOGICAL_GROUP_AXIS(MinSize)
CSS_PROP_LOGICAL_GROUP_AXIS(Size) CSS_PROP_LOGICAL_GROUP_AXIS(Size)
CSS_PROP_LOGICAL_GROUP_AXIS(Overflow)

View file

@ -2216,6 +2216,7 @@ const KTableEntry nsCSSProps::kUserSelectKTable[] = {
{ eCSSKeyword_auto, StyleUserSelect::Auto }, { eCSSKeyword_auto, StyleUserSelect::Auto },
{ eCSSKeyword_text, StyleUserSelect::Text }, { eCSSKeyword_text, StyleUserSelect::Text },
{ eCSSKeyword_element, StyleUserSelect::Element }, { eCSSKeyword_element, StyleUserSelect::Element },
{ eCSSKeyword_contain, StyleUserSelect::Contain },
{ eCSSKeyword_elements, StyleUserSelect::Elements }, { eCSSKeyword_elements, StyleUserSelect::Elements },
{ eCSSKeyword_all, StyleUserSelect::All }, { eCSSKeyword_all, StyleUserSelect::All },
{ eCSSKeyword_toggle, StyleUserSelect::Toggle }, { eCSSKeyword_toggle, StyleUserSelect::Toggle },
@ -3180,6 +3181,13 @@ static const nsCSSPropertyID gSizeLogicalGroupTable[] = {
eCSSProperty_UNKNOWN eCSSProperty_UNKNOWN
}; };
static const nsCSSPropertyID gOverflowLogicalGroupTable[] = {
eCSSProperty_overflow_y,
eCSSProperty_overflow_x,
eCSSProperty_UNKNOWN
};
const nsCSSPropertyID* const const nsCSSPropertyID* const
nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = { nsCSSProps::kLogicalGroupTable[eCSSPropertyLogicalGroup_COUNT] = {
#define CSS_PROP_LOGICAL_GROUP_SHORTHAND(id_) g##id_##SubpropTable, #define CSS_PROP_LOGICAL_GROUP_SHORTHAND(id_) g##id_##SubpropTable,

View file

@ -44,7 +44,7 @@
// 'inherit' and 'initial' // 'inherit' and 'initial'
#define VARIANT_OPACITY 0x008000 // Take floats and percents as input, output float. #define VARIANT_OPACITY 0x008000 // Take floats and percents as input, output float.
#define VARIANT_AUTO 0x010000 // A #define VARIANT_AUTO 0x010000 // A
#define VARIANT_INHERIT 0x020000 // H eCSSUnit_Initial, eCSSUnit_Inherit, eCSSUnit_Unset #define VARIANT_INHERIT 0x020000 // H eCSSUnit_Initial, eCSSUnit_Inherit, eCSSUnit_Unset, eCSSUnit_Revert
#define VARIANT_NONE 0x040000 // O #define VARIANT_NONE 0x040000 // O
#define VARIANT_NORMAL 0x080000 // M #define VARIANT_NORMAL 0x080000 // M
#define VARIANT_SYSFONT 0x100000 // eCSSUnit_System_Font #define VARIANT_SYSFONT 0x100000 // eCSSUnit_System_Font

View file

@ -166,6 +166,9 @@ nsCSSValue::nsCSSValue(const nsCSSValue& aCopy)
mValue.mComplexColor = aCopy.mValue.mComplexColor; mValue.mComplexColor = aCopy.mValue.mComplexColor;
mValue.mComplexColor->AddRef(); mValue.mComplexColor->AddRef();
} }
else if (eCSSUnit_Revert == mUnit) {
mValue.mCascadeOrigin = aCopy.mValue.mCascadeOrigin;
}
else if (UnitHasArrayValue()) { else if (UnitHasArrayValue()) {
mValue.mArray = aCopy.mValue.mArray; mValue.mArray = aCopy.mValue.mArray;
mValue.mArray->AddRef(); mValue.mArray->AddRef();
@ -279,6 +282,9 @@ bool nsCSSValue::operator==(const nsCSSValue& aOther) const
else if (eCSSUnit_ComplexColor == mUnit) { else if (eCSSUnit_ComplexColor == mUnit) {
return *mValue.mComplexColor == *aOther.mValue.mComplexColor; return *mValue.mComplexColor == *aOther.mValue.mComplexColor;
} }
else if (eCSSUnit_Revert == mUnit) {
return mValue.mCascadeOrigin == aOther.mValue.mCascadeOrigin;
}
else if (UnitHasArrayValue()) { else if (UnitHasArrayValue()) {
return *mValue.mArray == *aOther.mValue.mArray; return *mValue.mArray == *aOther.mValue.mArray;
} }
@ -539,6 +545,15 @@ nsCSSValue::SetComplexColorValue(already_AddRefed<ComplexColorValue> aValue)
mValue.mComplexColor = aValue.take(); mValue.mComplexColor = aValue.take();
} }
void
nsCSSValue::SetCascadeOriginValue(mozilla::SheetType aValue, nsCSSUnit aUnit)
{
MOZ_ASSERT(aUnit == eCSSUnit_Revert, "bad unit");
Reset();
mUnit = aUnit;
mValue.mCascadeOrigin = aValue;
}
void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit) void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit)
{ {
Reset(); Reset();
@ -598,7 +613,7 @@ void nsCSSValue::SetFontFamilyListValue(css::FontFamilyListRefCnt* aValue)
void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue) void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
{ {
// pairs should not be used for null/inherit/initial values // pairs should not be used for null/inherit/initial/unset/revert values
MOZ_ASSERT(aValue && MOZ_ASSERT(aValue &&
aValue->mXValue.GetUnit() != eCSSUnit_Null && aValue->mXValue.GetUnit() != eCSSUnit_Null &&
aValue->mYValue.GetUnit() != eCSSUnit_Null && aValue->mYValue.GetUnit() != eCSSUnit_Null &&
@ -607,7 +622,9 @@ void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue)
aValue->mXValue.GetUnit() != eCSSUnit_Initial && aValue->mXValue.GetUnit() != eCSSUnit_Initial &&
aValue->mYValue.GetUnit() != eCSSUnit_Initial && aValue->mYValue.GetUnit() != eCSSUnit_Initial &&
aValue->mXValue.GetUnit() != eCSSUnit_Unset && aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
aValue->mYValue.GetUnit() != eCSSUnit_Unset, aValue->mYValue.GetUnit() != eCSSUnit_Unset &&
aValue->mXValue.GetUnit() != eCSSUnit_Revert &&
aValue->mYValue.GetUnit() != eCSSUnit_Revert,
"missing or inappropriate pair value"); "missing or inappropriate pair value");
Reset(); Reset();
mUnit = eCSSUnit_Pair; mUnit = eCSSUnit_Pair;
@ -625,7 +642,9 @@ void nsCSSValue::SetPairValue(const nsCSSValue& xValue,
xValue.GetUnit() != eCSSUnit_Initial && xValue.GetUnit() != eCSSUnit_Initial &&
yValue.GetUnit() != eCSSUnit_Initial && yValue.GetUnit() != eCSSUnit_Initial &&
xValue.GetUnit() != eCSSUnit_Unset && xValue.GetUnit() != eCSSUnit_Unset &&
yValue.GetUnit() != eCSSUnit_Unset, yValue.GetUnit() != eCSSUnit_Unset &&
xValue.GetUnit() != eCSSUnit_Revert &&
yValue.GetUnit() != eCSSUnit_Revert,
"inappropriate pair value"); "inappropriate pair value");
Reset(); Reset();
mUnit = eCSSUnit_Pair; mUnit = eCSSUnit_Pair;
@ -635,7 +654,7 @@ void nsCSSValue::SetPairValue(const nsCSSValue& xValue,
void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue) void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue)
{ {
// triplet should not be used for null/inherit/initial values // triplet should not be used for null/inherit/initial/unset/revert values
MOZ_ASSERT(aValue && MOZ_ASSERT(aValue &&
aValue->mXValue.GetUnit() != eCSSUnit_Null && aValue->mXValue.GetUnit() != eCSSUnit_Null &&
aValue->mYValue.GetUnit() != eCSSUnit_Null && aValue->mYValue.GetUnit() != eCSSUnit_Null &&
@ -648,7 +667,10 @@ void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue)
aValue->mZValue.GetUnit() != eCSSUnit_Initial && aValue->mZValue.GetUnit() != eCSSUnit_Initial &&
aValue->mXValue.GetUnit() != eCSSUnit_Unset && aValue->mXValue.GetUnit() != eCSSUnit_Unset &&
aValue->mYValue.GetUnit() != eCSSUnit_Unset && aValue->mYValue.GetUnit() != eCSSUnit_Unset &&
aValue->mZValue.GetUnit() != eCSSUnit_Unset, aValue->mZValue.GetUnit() != eCSSUnit_Unset &&
aValue->mXValue.GetUnit() != eCSSUnit_Revert &&
aValue->mYValue.GetUnit() != eCSSUnit_Revert &&
aValue->mZValue.GetUnit() != eCSSUnit_Revert,
"missing or inappropriate triplet value"); "missing or inappropriate triplet value");
Reset(); Reset();
mUnit = eCSSUnit_Triplet; mUnit = eCSSUnit_Triplet;
@ -671,7 +693,10 @@ void nsCSSValue::SetTripletValue(const nsCSSValue& xValue,
zValue.GetUnit() != eCSSUnit_Initial && zValue.GetUnit() != eCSSUnit_Initial &&
xValue.GetUnit() != eCSSUnit_Unset && xValue.GetUnit() != eCSSUnit_Unset &&
yValue.GetUnit() != eCSSUnit_Unset && yValue.GetUnit() != eCSSUnit_Unset &&
zValue.GetUnit() != eCSSUnit_Unset, zValue.GetUnit() != eCSSUnit_Unset &&
xValue.GetUnit() != eCSSUnit_Revert &&
yValue.GetUnit() != eCSSUnit_Revert &&
zValue.GetUnit() != eCSSUnit_Revert,
"inappropriate triplet value"); "inappropriate triplet value");
Reset(); Reset();
mUnit = eCSSUnit_Triplet; mUnit = eCSSUnit_Triplet;
@ -781,6 +806,12 @@ void nsCSSValue::SetUnsetValue()
mUnit = eCSSUnit_Unset; mUnit = eCSSUnit_Unset;
} }
void
nsCSSValue::SetRevertValue(mozilla::SheetType aValue)
{
SetCascadeOriginValue(aValue, eCSSUnit_Revert);
}
void nsCSSValue::SetNoneValue() void nsCSSValue::SetNoneValue()
{ {
Reset(); Reset();
@ -1930,6 +1961,7 @@ nsCSSValue::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult,
case eCSSUnit_Inherit: aResult.AppendLiteral("inherit"); break; case eCSSUnit_Inherit: aResult.AppendLiteral("inherit"); break;
case eCSSUnit_Initial: aResult.AppendLiteral("initial"); break; case eCSSUnit_Initial: aResult.AppendLiteral("initial"); break;
case eCSSUnit_Unset: aResult.AppendLiteral("unset"); break; case eCSSUnit_Unset: aResult.AppendLiteral("unset"); break;
case eCSSUnit_Revert: aResult.AppendLiteral("revert"); break;
case eCSSUnit_None: aResult.AppendLiteral("none"); break; case eCSSUnit_None: aResult.AppendLiteral("none"); break;
case eCSSUnit_Normal: aResult.AppendLiteral("normal"); break; case eCSSUnit_Normal: aResult.AppendLiteral("normal"); break;
case eCSSUnit_System_Font: aResult.AppendLiteral("-moz-use-system-font"); break; case eCSSUnit_System_Font: aResult.AppendLiteral("-moz-use-system-font"); break;
@ -2189,6 +2221,10 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
n += mValue.mComplexColor->SizeOfIncludingThis(aMallocSizeOf); n += mValue.mComplexColor->SizeOfIncludingThis(aMallocSizeOf);
break; break;
// Cascade Origin: nothing extra to measure.
case eCSSUnit_Revert:
break;
// Float: nothing extra to measure. // Float: nothing extra to measure.
case eCSSUnit_Percent: case eCSSUnit_Percent:
case eCSSUnit_Number: case eCSSUnit_Number:
@ -2511,7 +2547,8 @@ nsCSSRect::AppendToString(nsCSSPropertyID aProperty, nsAString& aResult,
MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null && MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null &&
mTop.GetUnit() != eCSSUnit_Inherit && mTop.GetUnit() != eCSSUnit_Inherit &&
mTop.GetUnit() != eCSSUnit_Initial && mTop.GetUnit() != eCSSUnit_Initial &&
mTop.GetUnit() != eCSSUnit_Unset, mTop.GetUnit() != eCSSUnit_Unset &&
mTop.GetUnit() != eCSSUnit_Revert,
"parser should have used a bare value"); "parser should have used a bare value");
if (eCSSProperty_border_image_slice == aProperty || if (eCSSProperty_border_image_slice == aProperty ||
@ -2681,6 +2718,7 @@ nsCSSValuePairList::AppendToString(nsCSSPropertyID aProperty,
if (item->mXValue.GetUnit() != eCSSUnit_Inherit && if (item->mXValue.GetUnit() != eCSSUnit_Inherit &&
item->mXValue.GetUnit() != eCSSUnit_Initial && item->mXValue.GetUnit() != eCSSUnit_Initial &&
item->mXValue.GetUnit() != eCSSUnit_Unset && item->mXValue.GetUnit() != eCSSUnit_Unset &&
item->mXValue.GetUnit() != eCSSUnit_Revert &&
item->mYValue.GetUnit() != eCSSUnit_Null) { item->mYValue.GetUnit() != eCSSUnit_Null) {
aResult.Append(char16_t(' ')); aResult.Append(char16_t(' '));
item->mYValue.AppendToString(aProperty, aResult, aSerialization); item->mYValue.AppendToString(aProperty, aResult, aSerialization);

View file

@ -484,6 +484,7 @@ enum nsCSSUnit {
eCSSUnit_TokenStream = 43, // (nsCSSValueTokenStream*) value eCSSUnit_TokenStream = 43, // (nsCSSValueTokenStream*) value
eCSSUnit_GridTemplateAreas = 44, // (GridTemplateAreasValue*) eCSSUnit_GridTemplateAreas = 44, // (GridTemplateAreasValue*)
// for grid-template-areas // for grid-template-areas
eCSSUnit_Revert = 45, // (SheetType) value is the current cascade origin
eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values eCSSUnit_Pair = 50, // (nsCSSValuePair*) pair of values
eCSSUnit_Triplet = 51, // (nsCSSValueTriplet*) triplet of values eCSSUnit_Triplet = 51, // (nsCSSValueTriplet*) triplet of values
@ -911,6 +912,12 @@ public:
return mValue.mFloatColor; return mValue.mFloatColor;
} }
mozilla::SheetType GetCascadeOriginValue() const
{
MOZ_ASSERT(mUnit == eCSSUnit_Revert, "not a cascade origin value");
return mValue.mCascadeOrigin;
}
void Reset() // sets to null void Reset() // sets to null
{ {
if (mUnit != eCSSUnit_Null) if (mUnit != eCSSUnit_Null)
@ -943,6 +950,7 @@ public:
void SetRGBAColorValue(const mozilla::css::RGBAColorData& aValue); void SetRGBAColorValue(const mozilla::css::RGBAColorData& aValue);
void SetComplexColorValue( void SetComplexColorValue(
already_AddRefed<mozilla::css::ComplexColorValue> aValue); already_AddRefed<mozilla::css::ComplexColorValue> aValue);
void SetCascadeOriginValue(mozilla::SheetType aValue, nsCSSUnit aUnit);
void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit); void SetArrayValue(nsCSSValue::Array* aArray, nsCSSUnit aUnit);
void SetURLValue(mozilla::css::URLValue* aURI); void SetURLValue(mozilla::css::URLValue* aURI);
void SetImageValue(mozilla::css::ImageValue* aImage); void SetImageValue(mozilla::css::ImageValue* aImage);
@ -961,6 +969,7 @@ public:
void SetInheritValue(); void SetInheritValue();
void SetInitialValue(); void SetInitialValue();
void SetUnsetValue(); void SetUnsetValue();
void SetRevertValue(mozilla::SheetType aValue);
void SetNoneValue(); void SetNoneValue();
void SetAllValue(); void SetAllValue();
void SetNormalValue(); void SetNormalValue();
@ -1054,6 +1063,7 @@ protected:
nsCSSValueFloatColor* MOZ_OWNING_REF mFloatColor; nsCSSValueFloatColor* MOZ_OWNING_REF mFloatColor;
mozilla::css::FontFamilyListRefCnt* MOZ_OWNING_REF mFontFamilyList; mozilla::css::FontFamilyListRefCnt* MOZ_OWNING_REF mFontFamilyList;
mozilla::css::ComplexColorValue* MOZ_OWNING_REF mComplexColor; mozilla::css::ComplexColorValue* MOZ_OWNING_REF mComplexColor;
mozilla::SheetType mCascadeOrigin;
} mValue; } mValue;
}; };

View file

@ -4750,16 +4750,27 @@ nsComputedDOMStyle::DoGetOverflow()
{ {
const nsStyleDisplay* display = StyleDisplay(); const nsStyleDisplay* display = StyleDisplay();
if (display->mOverflowX != display->mOverflowY) { if (display->mOverflowX == display->mOverflowY) {
// No value to return. We can't express this combination of
// values as a shorthand.
return nullptr;
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue; RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX, val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
nsCSSProps::kOverflowKTable)); nsCSSProps::kOverflowKTable));
return val.forget(); return val.forget();
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
nsAutoString result;
nsCSSKeyword xKeyword = nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
nsCSSProps::kOverflowKTable);
nsCSSKeyword yKeyword = nsCSSProps::ValueToKeywordEnum(display->mOverflowY,
nsCSSProps::kOverflowKTable);
result.AppendASCII(nsCSSKeywords::GetStringValue(xKeyword).get());
result.Append(char16_t(' '));
result.AppendASCII(nsCSSKeywords::GetStringValue(yKeyword).get());
val->SetString(result);
return val.forget();
} }
already_AddRefed<CSSValue> already_AddRefed<CSSValue>

View file

@ -46,10 +46,12 @@ nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
{ {
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) { if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) {
nsCSSValue* color = aRuleData->ValueForColor(); nsCSSValue* color = aRuleData->ValueForColor();
if (color->GetUnit() == eCSSUnit_Null && if ((color->GetUnit() == eCSSUnit_Null ||
aRuleData->mPresContext->UseDocumentColors()) color->GetUnit() == eCSSUnit_Revert) &&
aRuleData->mPresContext->UseDocumentColors()) {
color->SetColorValue(mColor); color->SetColorValue(mColor);
} }
}
} }
/* virtual */ bool /* virtual */ bool
@ -98,7 +100,8 @@ nsHTMLStyleSheet::TableTHRule::MapRuleInfoInto(nsRuleData* aRuleData)
{ {
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) { if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
nsCSSValue* textAlign = aRuleData->ValueForTextAlign(); nsCSSValue* textAlign = aRuleData->ValueForTextAlign();
if (textAlign->GetUnit() == eCSSUnit_Null) { if (textAlign->GetUnit() == eCSSUnit_Null ||
textAlign->GetUnit() == eCSSUnit_Revert) {
textAlign->SetIntValue(NS_STYLE_TEXT_ALIGN_MOZ_CENTER_OR_INHERIT, textAlign->SetIntValue(NS_STYLE_TEXT_ALIGN_MOZ_CENTER_OR_INHERIT,
eCSSUnit_Enumerated); eCSSUnit_Enumerated);
} }
@ -126,10 +129,12 @@ nsHTMLStyleSheet::TableQuirkColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
nsCSSValue* color = aRuleData->ValueForColor(); nsCSSValue* color = aRuleData->ValueForColor();
// We do not check UseDocumentColors() here, because we want to // We do not check UseDocumentColors() here, because we want to
// use the body color no matter what. // use the body color no matter what.
if (color->GetUnit() == eCSSUnit_Null) if (color->GetUnit() == eCSSUnit_Null ||
color->GetUnit() == eCSSUnit_Revert) {
color->SetIntValue(NS_STYLE_COLOR_INHERIT_FROM_BODY, color->SetIntValue(NS_STYLE_COLOR_INHERIT_FROM_BODY,
eCSSUnit_Enumerated); eCSSUnit_Enumerated);
} }
}
} }
/* virtual */ bool /* virtual */ bool
@ -153,7 +158,8 @@ nsHTMLStyleSheet::LangRule::MapRuleInfoInto(nsRuleData* aRuleData)
{ {
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) { if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
nsCSSValue* lang = aRuleData->ValueForLang(); nsCSSValue* lang = aRuleData->ValueForLang();
if (lang->GetUnit() == eCSSUnit_Null) { if (lang->GetUnit() == eCSSUnit_Null ||
lang->GetUnit() == eCSSUnit_Revert) {
lang->SetStringValue(mLang, eCSSUnit_Ident); lang->SetStringValue(mLang, eCSSUnit_Ident);
} }
} }

View file

@ -945,7 +945,9 @@ static bool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
} else if ((((aMask & SETCOORD_INHERIT) != 0) && } else if ((((aMask & SETCOORD_INHERIT) != 0) &&
aValue.GetUnit() == eCSSUnit_Inherit) || aValue.GetUnit() == eCSSUnit_Inherit) ||
(((aMask & SETCOORD_UNSET_INHERIT) != 0) && (((aMask & SETCOORD_UNSET_INHERIT) != 0) &&
aValue.GetUnit() == eCSSUnit_Unset)) { aValue.GetUnit() == eCSSUnit_Unset) ||
(((aMask & SETCOORD_UNSET_INHERIT) != 0) &&
aValue.GetUnit() == eCSSUnit_Revert)) {
aCoord = aParentCoord; // just inherit value from parent aCoord = aParentCoord; // just inherit value from parent
aConditions.SetUncacheable(); aConditions.SetUncacheable();
} else if (((aMask & SETCOORD_NORMAL) != 0) && } else if (((aMask & SETCOORD_NORMAL) != 0) &&
@ -963,6 +965,8 @@ static bool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
aConditions); aConditions);
} else if (aValue.GetUnit() == eCSSUnit_Initial || } else if (aValue.GetUnit() == eCSSUnit_Initial ||
(aValue.GetUnit() == eCSSUnit_Unset && (aValue.GetUnit() == eCSSUnit_Unset &&
((aMask & SETCOORD_UNSET_INITIAL) != 0)) ||
(aValue.GetUnit() == eCSSUnit_Revert &&
((aMask & SETCOORD_UNSET_INITIAL) != 0))) { ((aMask & SETCOORD_UNSET_INITIAL) != 0))) {
if ((aMask & SETCOORD_INITIAL_AUTO) != 0) { if ((aMask & SETCOORD_INITIAL_AUTO) != 0) {
aCoord.SetAutoValue(); aCoord.SetAutoValue();
@ -1161,10 +1165,12 @@ SetComplexColor(const nsCSSValue& aValue,
return; return;
} }
if (unit == eCSSUnit_Initial || if (unit == eCSSUnit_Initial ||
(UnsetTo == eUnsetInitial && unit == eCSSUnit_Unset)) { (UnsetTo == eUnsetInitial && unit == eCSSUnit_Unset) ||
(UnsetTo == eUnsetInitial && unit == eCSSUnit_Revert)) {
aResult = aInitialColor; aResult = aInitialColor;
} else if (unit == eCSSUnit_Inherit || } else if (unit == eCSSUnit_Inherit ||
(UnsetTo == eUnsetInherit && unit == eCSSUnit_Unset)) { (UnsetTo == eUnsetInherit && unit == eCSSUnit_Unset) ||
(UnsetTo == eUnsetInherit && unit == eCSSUnit_Revert)) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aResult = aParentColor; aResult = aParentColor;
} else if (unit == eCSSUnit_EnumColor && } else if (unit == eCSSUnit_EnumColor &&
@ -1369,6 +1375,7 @@ static void SetStyleImage(nsStyleContext* aStyleContext,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
break; break;
case eCSSUnit_URL: case eCSSUnit_URL:
@ -1560,6 +1567,7 @@ SetValue(const nsCSSValue& aValue, FieldT& aField,
return; return;
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
if (aMask & SETVAL_UNSET_INHERIT) { if (aMask & SETVAL_UNSET_INHERIT) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aField = aParentValue; aField = aParentValue;
@ -1638,6 +1646,7 @@ SetFactor(const nsCSSValue& aValue, float& aField, RuleNodeCacheConditions& aCon
break; break;
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
if (aFlags & SETFCT_UNSET_INHERIT) { if (aFlags & SETFCT_UNSET_INHERIT) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aField = aParentValue; aField = aParentValue;
@ -1940,12 +1949,14 @@ typedef nsRuleNode::RuleDetail
* @param aSpecifiedCount to be incremented by one if the value is specified * @param aSpecifiedCount to be incremented by one if the value is specified
* @param aInheritedCount to be incremented by one if the value is set to inherit * @param aInheritedCount to be incremented by one if the value is set to inherit
* @param aUnsetCount to be incremented by one if the value is set to unset * @param aUnsetCount to be incremented by one if the value is set to unset
* @param aRevertCount to be incremented by one if the value is set to revert
*/ */
inline void inline void
ExamineCSSValue(const nsCSSValue& aValue, ExamineCSSValue(const nsCSSValue& aValue,
uint32_t& aSpecifiedCount, uint32_t& aSpecifiedCount,
uint32_t& aInheritedCount, uint32_t& aInheritedCount,
uint32_t& aUnsetCount) uint32_t& aUnsetCount,
uint32_t& aRevertCount)
{ {
if (aValue.GetUnit() != eCSSUnit_Null) { if (aValue.GetUnit() != eCSSUnit_Null) {
++aSpecifiedCount; ++aSpecifiedCount;
@ -1953,6 +1964,8 @@ ExamineCSSValue(const nsCSSValue& aValue,
++aInheritedCount; ++aInheritedCount;
} else if (aValue.GetUnit() == eCSSUnit_Unset) { } else if (aValue.GetUnit() == eCSSUnit_Unset) {
++aUnsetCount; ++aUnsetCount;
} else if (aValue.GetUnit() == eCSSUnit_Revert) {
++aRevertCount;
} }
} }
} }
@ -2235,14 +2248,16 @@ AreAllMathMLPropertiesUndefined(const nsRuleData* aRuleData)
inline nsRuleNode::RuleDetail inline nsRuleNode::RuleDetail
nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID, nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
const nsRuleData* aRuleData) const nsRuleData* aRuleData,
bool& ignoreRuleCache)
{ {
// Build a count of the: // Build a count of the:
uint32_t total = 0, // total number of props in the struct uint32_t total = 0, // total number of props in the struct
specified = 0, // number that were specified for this node specified = 0, // number that were specified for this node
inherited = 0, // number that were 'inherit' (and not inherited = 0, // number that were 'inherit' (and not
// eCSSUnit_Inherit) for this node // eCSSUnit_Inherit) for this node
unset = 0; // number that were 'unset' unset = 0, // number that were 'unset'
revert = 0; // number that were 'revert'
// See comment in nsRuleData.h above mValueOffsets. // See comment in nsRuleData.h above mValueOffsets.
MOZ_ASSERT(aRuleData->mValueOffsets[aSID] == 0, MOZ_ASSERT(aRuleData->mValueOffsets[aSID] == 0,
@ -2251,7 +2266,7 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
*values_end = values + nsCSSProps::PropertyCountInStruct(aSID); *values_end = values + nsCSSProps::PropertyCountInStruct(aSID);
values != values_end; ++values) { values != values_end; ++values) {
++total; ++total;
ExamineCSSValue(*values, specified, inherited, unset); ExamineCSSValue(*values, specified, inherited, unset, revert);
} }
if (!nsCachedStyleData::IsReset(aSID)) { if (!nsCachedStyleData::IsReset(aSID)) {
@ -2309,6 +2324,8 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
result = (*cb)(aRuleData, result); result = (*cb)(aRuleData, result);
} }
ignoreRuleCache = revert > 0;
return result; return result;
} }
@ -2477,6 +2494,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// will be the root. (XXX misnamed) // will be the root. (XXX misnamed)
RuleDetail detail = eRuleNone; RuleDetail detail = eRuleNone;
uint32_t bit = nsCachedStyleData::GetBitForSID(aSID); uint32_t bit = nsCachedStyleData::GetBitForSID(aSID);
bool ignoreRuleCache = false;
while (ruleNode) { while (ruleNode) {
// See if this rule node has cached the fact that the remaining // See if this rule node has cached the fact that the remaining
@ -2503,9 +2521,16 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// we'll miss it. // we'll miss it.
startStruct = ruleNode->mStyleData.GetStyleData(aSID); startStruct = ruleNode->mStyleData.GetStyleData(aSID);
if (startStruct) { if (startStruct) {
break; // We found a rule with fully specified data. We don't // XXX: Ignore cached data if the previous rule node has revert values.
} // need to go up the tree any further, since the remainder if (ignoreRuleCache) {
startStruct = nullptr;
} else {
// We found a rule with fully specified data. We don't
// need to go up the tree any further, since the remainder
// of this branch has already been computed. // of this branch has already been computed.
break;
}
}
// Ask the rule to fill in the properties that it specifies. // Ask the rule to fill in the properties that it specifies.
nsIStyleRule *rule = ruleNode->mRule; nsIStyleRule *rule = ruleNode->mRule;
@ -2518,15 +2543,15 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// Now we check to see how many properties have been specified by // Now we check to see how many properties have been specified by
// the rules we've examined so far. // the rules we've examined so far.
RuleDetail oldDetail = detail; RuleDetail oldDetail = detail;
detail = CheckSpecifiedProperties(aSID, &ruleData); detail = CheckSpecifiedProperties(aSID, &ruleData, ignoreRuleCache);
if (oldDetail == eRuleNone && detail != eRuleNone) { if (oldDetail == eRuleNone && (detail != eRuleNone || ignoreRuleCache)) {
highestNode = ruleNode; highestNode = ruleNode;
} }
if (detail == eRuleFullReset || if (!ignoreRuleCache && (detail == eRuleFullReset ||
detail == eRuleFullMixed || detail == eRuleFullMixed ||
detail == eRuleFullInherited) { detail == eRuleFullInherited)) {
break; // We don't need to examine any more rules. All properties break; // We don't need to examine any more rules. All properties
} // have been fully specified. } // have been fully specified.
@ -2562,7 +2587,7 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
} }
if (recomputeDetail) { if (recomputeDetail) {
detail = CheckSpecifiedProperties(aSID, &ruleData); detail = CheckSpecifiedProperties(aSID, &ruleData, ignoreRuleCache);
} }
NS_ASSERTION(!startStruct || (detail != eRuleFullReset && NS_ASSERTION(!startStruct || (detail != eRuleFullReset &&
@ -3542,7 +3567,8 @@ nsRuleNode::SetFontSize(nsPresContext* aPresContext,
// this becomes our cascading size // this becomes our cascading size
*aSize = aSystemFont.size; *aSize = aSystemFont.size;
} else if (eCSSUnit_Inherit == sizeValue->GetUnit() || } else if (eCSSUnit_Inherit == sizeValue->GetUnit() ||
eCSSUnit_Unset == sizeValue->GetUnit()) { eCSSUnit_Unset == sizeValue->GetUnit() ||
eCSSUnit_Revert == sizeValue->GetUnit()) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
// We apply scriptlevel change for this case, because the default is // We apply scriptlevel change for this case, because the default is
// to inherit and we don't want explicit "inherit" to differ from the // to inherit and we don't want explicit "inherit" to differ from the
@ -3753,7 +3779,8 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
aFont->mFont.systemFont = true; aFont->mFont.systemFont = true;
aFont->mGenericID = kGenericFont_NONE; aFont->mGenericID = kGenericFont_NONE;
} else if (eCSSUnit_Inherit == familyValue->GetUnit() || } else if (eCSSUnit_Inherit == familyValue->GetUnit() ||
eCSSUnit_Unset == familyValue->GetUnit()) { eCSSUnit_Unset == familyValue->GetUnit() ||
eCSSUnit_Revert == familyValue->GetUnit()) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aFont->mFont.fontlist = aParentFont->mFont.fontlist; aFont->mFont.fontlist = aParentFont->mFont.fontlist;
aFont->mFont.systemFont = aParentFont->mFont.systemFont; aFont->mFont.systemFont = aParentFont->mFont.systemFont;
@ -3842,12 +3869,13 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
break; break;
} }
} }
} else } else {
SetValue(*weightValue, aFont->mFont.weight, aConditions, SetValue(*weightValue, aFont->mFont.weight, aConditions,
SETVAL_INTEGER | SETVAL_UNSET_INHERIT, SETVAL_INTEGER | SETVAL_UNSET_INHERIT,
aParentFont->mFont.weight, aParentFont->mFont.weight,
defaultVariableFont->weight, defaultVariableFont->weight,
Unused, Unused, Unused, systemFont.weight); Unused, Unused, Unused, systemFont.weight);
}
// font-stretch: enum, inherit, initial, -moz-system-font // font-stretch: enum, inherit, initial, -moz-system-font
SetValue(*aRuleData->ValueForFontStretch(), SetValue(*aRuleData->ValueForFontStretch(),
@ -3896,7 +3924,8 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
(aParentFont->mMathDisplay == (aParentFont->mMathDisplay ==
NS_MATHML_DISPLAYSTYLE_INLINE ? 1 : 0)); NS_MATHML_DISPLAYSTYLE_INLINE ? 1 : 0));
} else if (eCSSUnit_Inherit == scriptLevelValue->GetUnit() || } else if (eCSSUnit_Inherit == scriptLevelValue->GetUnit() ||
eCSSUnit_Unset == scriptLevelValue->GetUnit()) { eCSSUnit_Unset == scriptLevelValue->GetUnit() ||
eCSSUnit_Revert == scriptLevelValue->GetUnit()) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aFont->mScriptLevel = aParentFont->mScriptLevel; aFont->mScriptLevel = aParentFont->mScriptLevel;
} else if (eCSSUnit_Initial == scriptLevelValue->GetUnit()) { } else if (eCSSUnit_Initial == scriptLevelValue->GetUnit()) {
@ -3928,6 +3957,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
switch (variantAlternatesValue->GetUnit()) { switch (variantAlternatesValue->GetUnit()) {
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aFont->mFont.CopyAlternates(aParentFont->mFont); aFont->mFont.CopyAlternates(aParentFont->mFont);
aConditions.SetUncacheable(); aConditions.SetUncacheable();
break; break;
@ -4023,6 +4053,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aFont->mFont.fontFeatureSettings = aParentFont->mFont.fontFeatureSettings; aFont->mFont.fontFeatureSettings = aParentFont->mFont.fontFeatureSettings;
break; break;
@ -4046,7 +4077,8 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
const nsCSSValue* languageOverrideValue = const nsCSSValue* languageOverrideValue =
aRuleData->ValueForFontLanguageOverride(); aRuleData->ValueForFontLanguageOverride();
if (eCSSUnit_Inherit == languageOverrideValue->GetUnit() || if (eCSSUnit_Inherit == languageOverrideValue->GetUnit() ||
eCSSUnit_Unset == languageOverrideValue->GetUnit()) { eCSSUnit_Unset == languageOverrideValue->GetUnit() ||
eCSSUnit_Revert == languageOverrideValue->GetUnit()) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aFont->mFont.languageOverride = aParentFont->mFont.languageOverride; aFont->mFont.languageOverride = aParentFont->mFont.languageOverride;
} else if (eCSSUnit_Normal == languageOverrideValue->GetUnit() || } else if (eCSSUnit_Normal == languageOverrideValue->GetUnit() ||
@ -4063,8 +4095,9 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
switch (minFontSizeRatio->GetUnit()) { switch (minFontSizeRatio->GetUnit()) {
case eCSSUnit_Null: case eCSSUnit_Null:
break; break;
case eCSSUnit_Unset:
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset:
case eCSSUnit_Revert:
aFont->mMinFontSizeRatio = aParentFont->mMinFontSizeRatio; aFont->mMinFontSizeRatio = aParentFont->mMinFontSizeRatio;
aConditions.SetUncacheable(); aConditions.SetUncacheable();
break; break;
@ -4909,7 +4942,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
NS_NOTYETIMPLEMENTED("align string"); NS_NOTYETIMPLEMENTED("align string");
} }
} else if (eCSSUnit_Inherit == textAlignValue->GetUnit() || } else if (eCSSUnit_Inherit == textAlignValue->GetUnit() ||
eCSSUnit_Unset == textAlignValue->GetUnit()) { eCSSUnit_Unset == textAlignValue->GetUnit() ||
eCSSUnit_Revert == textAlignValue->GetUnit()) {
text->mTextAlignTrue = parentText->mTextAlignTrue; text->mTextAlignTrue = parentText->mTextAlignTrue;
} }
SetValue(*textAlignValue, text->mTextAlign, conditions, SetValue(*textAlignValue, text->mTextAlign, conditions,
@ -4932,7 +4966,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
} }
} }
} else if (eCSSUnit_Inherit == textAlignLastValue->GetUnit() || } else if (eCSSUnit_Inherit == textAlignLastValue->GetUnit() ||
eCSSUnit_Unset == textAlignLastValue->GetUnit()) { eCSSUnit_Unset == textAlignLastValue->GetUnit() ||
eCSSUnit_Revert == textAlignLastValue->GetUnit()) {
text->mTextAlignLastTrue = parentText->mTextAlignLastTrue; text->mTextAlignLastTrue = parentText->mTextAlignLastTrue;
} }
SetValue(*textAlignLastValue, text->mTextAlignLast, SetValue(*textAlignLastValue, text->mTextAlignLast,
@ -5052,7 +5087,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
break; break;
} }
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: { case eCSSUnit_Unset:
case eCSSUnit_Revert: {
conditions.SetUncacheable(); conditions.SetUncacheable();
text->mTextEmphasisStyle = parentText->mTextEmphasisStyle; text->mTextEmphasisStyle = parentText->mTextEmphasisStyle;
text->mTextEmphasisStyleString = parentText->mTextEmphasisStyleString; text->mTextEmphasisStyleString = parentText->mTextEmphasisStyleString;
@ -5168,7 +5204,8 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct,
conditions.SetUncacheable(); conditions.SetUncacheable();
text->mTextDecorationLine = parentText->mTextDecorationLine; text->mTextDecorationLine = parentText->mTextDecorationLine;
} else if (eCSSUnit_Initial == decorationLineValue->GetUnit() || } else if (eCSSUnit_Initial == decorationLineValue->GetUnit() ||
eCSSUnit_Unset == decorationLineValue->GetUnit()) { eCSSUnit_Unset == decorationLineValue->GetUnit() ||
eCSSUnit_Revert == decorationLineValue->GetUnit()) {
text->mTextDecorationLine = NS_STYLE_TEXT_DECORATION_LINE_NONE; text->mTextDecorationLine = NS_STYLE_TEXT_DECORATION_LINE_NONE;
} }
@ -5188,7 +5225,8 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct,
text->mTextDecorationStyle = parentText->mTextDecorationStyle; text->mTextDecorationStyle = parentText->mTextDecorationStyle;
conditions.SetUncacheable(); conditions.SetUncacheable();
} else if (eCSSUnit_Initial == decorationStyleValue->GetUnit() || } else if (eCSSUnit_Initial == decorationStyleValue->GetUnit() ||
eCSSUnit_Unset == decorationStyleValue->GetUnit()) { eCSSUnit_Unset == decorationStyleValue->GetUnit() ||
eCSSUnit_Revert == decorationStyleValue->GetUnit()) {
text->mTextDecorationStyle = NS_STYLE_TEXT_DECORATION_STYLE_SOLID; text->mTextDecorationStyle = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
} }
@ -5196,7 +5234,8 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct,
const nsCSSValue* textOverflowValue = const nsCSSValue* textOverflowValue =
aRuleData->ValueForTextOverflow(); aRuleData->ValueForTextOverflow();
if (eCSSUnit_Initial == textOverflowValue->GetUnit() || if (eCSSUnit_Initial == textOverflowValue->GetUnit() ||
eCSSUnit_Unset == textOverflowValue->GetUnit()) { eCSSUnit_Unset == textOverflowValue->GetUnit() ||
eCSSUnit_Revert == textOverflowValue->GetUnit()) {
text->mTextOverflow = nsStyleTextOverflow(); text->mTextOverflow = nsStyleTextOverflow();
} else if (eCSSUnit_Inherit == textOverflowValue->GetUnit()) { } else if (eCSSUnit_Inherit == textOverflowValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -5265,6 +5304,7 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct,
text->mInitialLetterSize = parentText->mInitialLetterSize; text->mInitialLetterSize = parentText->mInitialLetterSize;
} else if (initialLetterValue->GetUnit() == eCSSUnit_Initial || } else if (initialLetterValue->GetUnit() == eCSSUnit_Initial ||
initialLetterValue->GetUnit() == eCSSUnit_Unset || initialLetterValue->GetUnit() == eCSSUnit_Unset ||
initialLetterValue->GetUnit() == eCSSUnit_Revert ||
initialLetterValue->GetUnit() == eCSSUnit_Normal) { initialLetterValue->GetUnit() == eCSSUnit_Normal) {
// Use invalid values in initial-letter property to mean normal. So we can // Use invalid values in initial-letter property to mean normal. So we can
// determine whether it is normal by checking mInitialLetterSink == 0. // determine whether it is normal by checking mInitialLetterSink == 0.
@ -5312,7 +5352,8 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
ui->mCursorImages.Clear(); ui->mCursorImages.Clear();
if (cursorUnit == eCSSUnit_Inherit || if (cursorUnit == eCSSUnit_Inherit ||
cursorUnit == eCSSUnit_Unset) { cursorUnit == eCSSUnit_Unset ||
cursorUnit == eCSSUnit_Revert) {
conditions.SetUncacheable(); conditions.SetUncacheable();
ui->mCursor = parentUI->mCursor; ui->mCursor = parentUI->mCursor;
ui->mCursorImages = parentUI->mCursorImages; ui->mCursorImages = parentUI->mCursorImages;
@ -5694,7 +5735,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
transition->SetDelay(parentDisplay->mTransitions[i].GetDelay()); transition->SetDelay(parentDisplay->mTransitions[i].GetDelay());
} else if (delay.unit == eCSSUnit_Initial || } else if (delay.unit == eCSSUnit_Initial ||
delay.unit == eCSSUnit_Unset) { delay.unit == eCSSUnit_Unset ||
delay.unit == eCSSUnit_Revert) {
transition->SetDelay(0.0); transition->SetDelay(0.0);
} else if (delay.list) { } else if (delay.list) {
switch (delay.list->mValue.GetUnit()) { switch (delay.list->mValue.GetUnit()) {
@ -5721,7 +5763,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
transition->SetDuration(parentDisplay->mTransitions[i].GetDuration()); transition->SetDuration(parentDisplay->mTransitions[i].GetDuration());
} else if (duration.unit == eCSSUnit_Initial || } else if (duration.unit == eCSSUnit_Initial ||
duration.unit == eCSSUnit_Unset) { duration.unit == eCSSUnit_Unset ||
duration.unit == eCSSUnit_Revert) {
transition->SetDuration(0.0); transition->SetDuration(0.0);
} else if (duration.list) { } else if (duration.list) {
switch (duration.list->mValue.GetUnit()) { switch (duration.list->mValue.GetUnit()) {
@ -5747,7 +5790,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
transition->CopyPropertyFrom(parentDisplay->mTransitions[i]); transition->CopyPropertyFrom(parentDisplay->mTransitions[i]);
} else if (property.unit == eCSSUnit_Initial || } else if (property.unit == eCSSUnit_Initial ||
property.unit == eCSSUnit_Unset) { property.unit == eCSSUnit_Unset ||
property.unit == eCSSUnit_Revert) {
transition->SetProperty(eCSSPropertyExtra_all_properties); transition->SetProperty(eCSSPropertyExtra_all_properties);
} else if (property.unit == eCSSUnit_None) { } else if (property.unit == eCSSUnit_None) {
transition->SetProperty(eCSSPropertyExtra_no_properties); transition->SetProperty(eCSSPropertyExtra_no_properties);
@ -5786,7 +5830,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
transition->SetTimingFunction( transition->SetTimingFunction(
parentDisplay->mTransitions[i].GetTimingFunction()); parentDisplay->mTransitions[i].GetTimingFunction());
} else if (timingFunction.unit == eCSSUnit_Initial || } else if (timingFunction.unit == eCSSUnit_Initial ||
timingFunction.unit == eCSSUnit_Unset) { timingFunction.unit == eCSSUnit_Unset ||
timingFunction.unit == eCSSUnit_Revert) {
transition->SetTimingFunction( transition->SetTimingFunction(
nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE)); nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE));
} else if (timingFunction.list) { } else if (timingFunction.list) {
@ -5856,7 +5901,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetDelay(parentDisplay->mAnimations[i].GetDelay()); animation->SetDelay(parentDisplay->mAnimations[i].GetDelay());
} else if (animDelay.unit == eCSSUnit_Initial || } else if (animDelay.unit == eCSSUnit_Initial ||
animDelay.unit == eCSSUnit_Unset) { animDelay.unit == eCSSUnit_Unset ||
animDelay.unit == eCSSUnit_Revert) {
animation->SetDelay(0.0); animation->SetDelay(0.0);
} else if (animDelay.list) { } else if (animDelay.list) {
switch (animDelay.list->mValue.GetUnit()) { switch (animDelay.list->mValue.GetUnit()) {
@ -5883,7 +5929,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetDuration(parentDisplay->mAnimations[i].GetDuration()); animation->SetDuration(parentDisplay->mAnimations[i].GetDuration());
} else if (animDuration.unit == eCSSUnit_Initial || } else if (animDuration.unit == eCSSUnit_Initial ||
animDuration.unit == eCSSUnit_Unset) { animDuration.unit == eCSSUnit_Unset ||
animDuration.unit == eCSSUnit_Revert) {
animation->SetDuration(0.0); animation->SetDuration(0.0);
} else if (animDuration.list) { } else if (animDuration.list) {
switch (animDuration.list->mValue.GetUnit()) { switch (animDuration.list->mValue.GetUnit()) {
@ -5909,7 +5956,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetName(parentDisplay->mAnimations[i].GetName()); animation->SetName(parentDisplay->mAnimations[i].GetName());
} else if (animName.unit == eCSSUnit_Initial || } else if (animName.unit == eCSSUnit_Initial ||
animName.unit == eCSSUnit_Unset) { animName.unit == eCSSUnit_Unset ||
animName.unit == eCSSUnit_Revert) {
animation->SetName(EmptyString()); animation->SetName(EmptyString());
} else if (animName.list) { } else if (animName.list) {
switch (animName.list->mValue.GetUnit()) { switch (animName.list->mValue.GetUnit()) {
@ -5941,7 +5989,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
animation->SetTimingFunction( animation->SetTimingFunction(
parentDisplay->mAnimations[i].GetTimingFunction()); parentDisplay->mAnimations[i].GetTimingFunction());
} else if (animTimingFunction.unit == eCSSUnit_Initial || } else if (animTimingFunction.unit == eCSSUnit_Initial ||
animTimingFunction.unit == eCSSUnit_Unset) { animTimingFunction.unit == eCSSUnit_Unset ||
animTimingFunction.unit == eCSSUnit_Revert) {
animation->SetTimingFunction( animation->SetTimingFunction(
nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE)); nsTimingFunction(NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE));
} else if (animTimingFunction.list) { } else if (animTimingFunction.list) {
@ -5960,7 +6009,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetDirection(parentDisplay->mAnimations[i].GetDirection()); animation->SetDirection(parentDisplay->mAnimations[i].GetDirection());
} else if (animDirection.unit == eCSSUnit_Initial || } else if (animDirection.unit == eCSSUnit_Initial ||
animDirection.unit == eCSSUnit_Unset) { animDirection.unit == eCSSUnit_Unset ||
animDirection.unit == eCSSUnit_Revert) {
animation->SetDirection(dom::PlaybackDirection::Normal); animation->SetDirection(dom::PlaybackDirection::Normal);
} else if (animDirection.list) { } else if (animDirection.list) {
MOZ_ASSERT(animDirection.list->mValue.GetUnit() == eCSSUnit_Enumerated, MOZ_ASSERT(animDirection.list->mValue.GetUnit() == eCSSUnit_Enumerated,
@ -5980,7 +6030,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetFillMode(parentDisplay->mAnimations[i].GetFillMode()); animation->SetFillMode(parentDisplay->mAnimations[i].GetFillMode());
} else if (animFillMode.unit == eCSSUnit_Initial || } else if (animFillMode.unit == eCSSUnit_Initial ||
animFillMode.unit == eCSSUnit_Unset) { animFillMode.unit == eCSSUnit_Unset ||
animFillMode.unit == eCSSUnit_Revert) {
animation->SetFillMode(dom::FillMode::None); animation->SetFillMode(dom::FillMode::None);
} else if (animFillMode.list) { } else if (animFillMode.list) {
MOZ_ASSERT(animFillMode.list->mValue.GetUnit() == eCSSUnit_Enumerated, MOZ_ASSERT(animFillMode.list->mValue.GetUnit() == eCSSUnit_Enumerated,
@ -6001,7 +6052,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetPlayState(parentDisplay->mAnimations[i].GetPlayState()); animation->SetPlayState(parentDisplay->mAnimations[i].GetPlayState());
} else if (animPlayState.unit == eCSSUnit_Initial || } else if (animPlayState.unit == eCSSUnit_Initial ||
animPlayState.unit == eCSSUnit_Unset) { animPlayState.unit == eCSSUnit_Unset ||
animPlayState.unit == eCSSUnit_Revert) {
animation->SetPlayState(NS_STYLE_ANIMATION_PLAY_STATE_RUNNING); animation->SetPlayState(NS_STYLE_ANIMATION_PLAY_STATE_RUNNING);
} else if (animPlayState.list) { } else if (animPlayState.list) {
MOZ_ASSERT(animPlayState.list->mValue.GetUnit() == eCSSUnit_Enumerated, MOZ_ASSERT(animPlayState.list->mValue.GetUnit() == eCSSUnit_Enumerated,
@ -6021,7 +6073,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
"should have made conditions.Cacheable() false above"); "should have made conditions.Cacheable() false above");
animation->SetIterationCount(parentDisplay->mAnimations[i].GetIterationCount()); animation->SetIterationCount(parentDisplay->mAnimations[i].GetIterationCount());
} else if (animIterationCount.unit == eCSSUnit_Initial || } else if (animIterationCount.unit == eCSSUnit_Initial ||
animIterationCount.unit == eCSSUnit_Unset) { animIterationCount.unit == eCSSUnit_Unset ||
animIterationCount.unit == eCSSUnit_Revert) {
animation->SetIterationCount(1.0f); animation->SetIterationCount(1.0f);
} else if (animIterationCount.list) { } else if (animIterationCount.list) {
switch (animIterationCount.list->mValue.GetUnit()) { switch (animIterationCount.list->mValue.GetUnit()) {
@ -6092,6 +6145,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
display->mScrollSnapPointsX.SetNoneValue(); display->mScrollSnapPointsX.SetNoneValue();
break; break;
@ -6127,6 +6181,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
display->mScrollSnapPointsY.SetNoneValue(); display->mScrollSnapPointsY.SetNoneValue();
break; break;
@ -6162,6 +6217,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
display->mScrollSnapDestination.SetInitialZeroValues(); display->mScrollSnapDestination.SetInitialZeroValues();
break; break;
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
@ -6181,8 +6237,9 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
// Unset and Initial is none, indicated by an empty array // Initial, Unset, and Revert are none, indicated by an empty array
display->mScrollSnapCoordinate.Clear(); display->mScrollSnapCoordinate.Clear();
break; break;
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
@ -6196,7 +6253,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null && NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null &&
item->mValue.GetUnit() != eCSSUnit_Inherit && item->mValue.GetUnit() != eCSSUnit_Inherit &&
item->mValue.GetUnit() != eCSSUnit_Initial && item->mValue.GetUnit() != eCSSUnit_Initial &&
item->mValue.GetUnit() != eCSSUnit_Unset, item->mValue.GetUnit() != eCSSUnit_Unset &&
item->mValue.GetUnit() != eCSSUnit_Revert,
"unexpected unit"); "unexpected unit");
Position* pos = display->mScrollSnapCoordinate.AppendElement(); Position* pos = display->mScrollSnapCoordinate.AppendElement();
ComputePositionValue(aContext, item->mValue, *pos, conditions); ComputePositionValue(aContext, item->mValue, *pos, conditions);
@ -6245,7 +6303,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
} }
} else if (eCSSUnit_None == bindingValue->GetUnit() || } else if (eCSSUnit_None == bindingValue->GetUnit() ||
eCSSUnit_Initial == bindingValue->GetUnit() || eCSSUnit_Initial == bindingValue->GetUnit() ||
eCSSUnit_Unset == bindingValue->GetUnit()) { eCSSUnit_Unset == bindingValue->GetUnit() ||
eCSSUnit_Revert == bindingValue->GetUnit()) {
display->mBinding = nullptr; display->mBinding = nullptr;
} else if (eCSSUnit_Inherit == bindingValue->GetUnit()) { } else if (eCSSUnit_Inherit == bindingValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -6285,7 +6344,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
(NS_STYLE_PAGE_BREAK_AVOID != breakBeforeValue->GetIntValue() && (NS_STYLE_PAGE_BREAK_AVOID != breakBeforeValue->GetIntValue() &&
NS_STYLE_PAGE_BREAK_AUTO != breakBeforeValue->GetIntValue()); NS_STYLE_PAGE_BREAK_AUTO != breakBeforeValue->GetIntValue());
} else if (eCSSUnit_Initial == breakBeforeValue->GetUnit() || } else if (eCSSUnit_Initial == breakBeforeValue->GetUnit() ||
eCSSUnit_Unset == breakBeforeValue->GetUnit()) { eCSSUnit_Unset == breakBeforeValue->GetUnit() ||
eCSSUnit_Revert == breakBeforeValue->GetUnit()) {
display->mBreakBefore = false; display->mBreakBefore = false;
} else if (eCSSUnit_Inherit == breakBeforeValue->GetUnit()) { } else if (eCSSUnit_Inherit == breakBeforeValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -6298,7 +6358,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
(NS_STYLE_PAGE_BREAK_AVOID != breakAfterValue->GetIntValue() && (NS_STYLE_PAGE_BREAK_AVOID != breakAfterValue->GetIntValue() &&
NS_STYLE_PAGE_BREAK_AUTO != breakAfterValue->GetIntValue()); NS_STYLE_PAGE_BREAK_AUTO != breakAfterValue->GetIntValue());
} else if (eCSSUnit_Initial == breakAfterValue->GetUnit() || } else if (eCSSUnit_Initial == breakAfterValue->GetUnit() ||
eCSSUnit_Unset == breakAfterValue->GetUnit()) { eCSSUnit_Unset == breakAfterValue->GetUnit() ||
eCSSUnit_Revert == breakAfterValue->GetUnit()) {
display->mBreakAfter = false; display->mBreakAfter = false;
} else if (eCSSUnit_Inherit == breakAfterValue->GetUnit()) { } else if (eCSSUnit_Inherit == breakAfterValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -6366,14 +6427,6 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN; display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN;
} }
// If 'visible' is specified but doesn't match the other dimension, it
// turns into 'auto'.
if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
display->mOverflowX = NS_STYLE_OVERFLOW_AUTO;
}
if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
display->mOverflowY = NS_STYLE_OVERFLOW_AUTO;
}
} }
// When 'contain: paint', update overflow from 'visible' to 'clip'. // When 'contain: paint', update overflow from 'visible' to 'clip'.
@ -6500,6 +6553,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
display->mSpecifiedTransform = nullptr; display->mSpecifiedTransform = nullptr;
break; break;
@ -6584,6 +6638,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_Auto: case eCSSUnit_Auto:
display->mWillChange.Clear(); display->mWillChange.Clear();
display->mWillChangeBitField = 0; display->mWillChangeBitField = 0;
@ -6600,7 +6655,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
SETCOORD_LPH | SETCOORD_ENUMERATED | SETCOORD_STORE_CALC, SETCOORD_LPH | SETCOORD_ENUMERATED | SETCOORD_STORE_CALC,
aContext, mPresContext, conditions)) { aContext, mPresContext, conditions)) {
if (eCSSUnit_Initial == verticalAlignValue->GetUnit() || if (eCSSUnit_Initial == verticalAlignValue->GetUnit() ||
eCSSUnit_Unset == verticalAlignValue->GetUnit()) { eCSSUnit_Unset == verticalAlignValue->GetUnit() ||
eCSSUnit_Revert == verticalAlignValue->GetUnit()) {
display->mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_BASELINE, display->mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_BASELINE,
eStyleUnit_Enumerated); eStyleUnit_Enumerated);
} }
@ -6711,6 +6767,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
case eCSSUnit_None: case eCSSUnit_None:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
display->mShapeOutside = StyleShapeOutside(); display->mShapeOutside = StyleShapeOutside();
break; break;
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
@ -6789,7 +6846,8 @@ nsRuleNode::ComputeVisibilityData(void* aStartStruct,
// image-orientation: enum, inherit, initial // image-orientation: enum, inherit, initial
const nsCSSValue* orientation = aRuleData->ValueForImageOrientation(); const nsCSSValue* orientation = aRuleData->ValueForImageOrientation();
if (orientation->GetUnit() == eCSSUnit_Inherit || if (orientation->GetUnit() == eCSSUnit_Inherit ||
orientation->GetUnit() == eCSSUnit_Unset) { orientation->GetUnit() == eCSSUnit_Unset ||
orientation->GetUnit() == eCSSUnit_Revert) {
conditions.SetUncacheable(); conditions.SetUncacheable();
visibility->mImageOrientation = parentVisibility->mImageOrientation; visibility->mImageOrientation = parentVisibility->mImageOrientation;
} else if (orientation->GetUnit() == eCSSUnit_Initial) { } else if (orientation->GetUnit() == eCSSUnit_Initial) {
@ -6849,7 +6907,8 @@ nsRuleNode::ComputeColorData(void* aStartStruct,
const nsCSSValue* colorValue = aRuleData->ValueForColor(); const nsCSSValue* colorValue = aRuleData->ValueForColor();
if ((colorValue->GetUnit() == eCSSUnit_EnumColor && if ((colorValue->GetUnit() == eCSSUnit_EnumColor &&
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR) || colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR) ||
colorValue->GetUnit() == eCSSUnit_Unset) { colorValue->GetUnit() == eCSSUnit_Unset ||
colorValue->GetUnit() == eCSSUnit_Revert) {
color->mColor = parentColor->mColor; color->mColor = parentColor->mColor;
conditions.SetUncacheable(); conditions.SetUncacheable();
} else if (colorValue->GetUnit() == eCSSUnit_Initial) { } else if (colorValue->GetUnit() == eCSSUnit_Initial) {
@ -7158,7 +7217,8 @@ struct BackgroundItemComputer<nsCSSValuePairList, nsStyleImageLayers::Size>
const nsCSSValue &widthValue = aSpecifiedValue->mXValue; const nsCSSValue &widthValue = aSpecifiedValue->mXValue;
MOZ_ASSERT(widthValue.GetUnit() != eCSSUnit_Inherit && MOZ_ASSERT(widthValue.GetUnit() != eCSSUnit_Inherit &&
widthValue.GetUnit() != eCSSUnit_Initial && widthValue.GetUnit() != eCSSUnit_Initial &&
widthValue.GetUnit() != eCSSUnit_Unset, widthValue.GetUnit() != eCSSUnit_Unset &&
widthValue.GetUnit() != eCSSUnit_Revert,
"initial/inherit/unset should already have been handled"); "initial/inherit/unset should already have been handled");
MOZ_ASSERT(widthValue.GetUnit() == eCSSUnit_Enumerated && MOZ_ASSERT(widthValue.GetUnit() == eCSSUnit_Enumerated &&
(widthValue.GetIntValue() == NS_STYLE_IMAGELAYER_SIZE_CONTAIN || (widthValue.GetIntValue() == NS_STYLE_IMAGELAYER_SIZE_CONTAIN ||
@ -7234,6 +7294,7 @@ SetImageLayerList(nsStyleContext* aStyleContext,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aRebuild = true; aRebuild = true;
aItemCount = 1; aItemCount = 1;
aLayers[0].*aResultLocation = aInitialValue; aLayers[0].*aResultLocation = aInitialValue;
@ -7248,7 +7309,8 @@ SetImageLayerList(nsStyleContext* aStyleContext,
NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null && NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null &&
item->mValue.GetUnit() != eCSSUnit_Inherit && item->mValue.GetUnit() != eCSSUnit_Inherit &&
item->mValue.GetUnit() != eCSSUnit_Initial && item->mValue.GetUnit() != eCSSUnit_Initial &&
item->mValue.GetUnit() != eCSSUnit_Unset, item->mValue.GetUnit() != eCSSUnit_Unset &&
item->mValue.GetUnit() != eCSSUnit_Revert,
"unexpected unit"); "unexpected unit");
++aItemCount; ++aItemCount;
aLayers.EnsureLengthAtLeast(aItemCount); aLayers.EnsureLengthAtLeast(aItemCount);
@ -7305,6 +7367,7 @@ SetImageLayerPositionCoordList(
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aRebuild = true; aRebuild = true;
aItemCount = 1; aItemCount = 1;
aLayers[0].mPosition.*aResultLocation = aInitialValue; aLayers[0].mPosition.*aResultLocation = aInitialValue;
@ -7319,7 +7382,8 @@ SetImageLayerPositionCoordList(
NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null && NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null &&
item->mValue.GetUnit() != eCSSUnit_Inherit && item->mValue.GetUnit() != eCSSUnit_Inherit &&
item->mValue.GetUnit() != eCSSUnit_Initial && item->mValue.GetUnit() != eCSSUnit_Initial &&
item->mValue.GetUnit() != eCSSUnit_Unset, item->mValue.GetUnit() != eCSSUnit_Unset &&
item->mValue.GetUnit() != eCSSUnit_Revert,
"unexpected unit"); "unexpected unit");
++aItemCount; ++aItemCount;
aLayers.EnsureLengthAtLeast(aItemCount); aLayers.EnsureLengthAtLeast(aItemCount);
@ -7372,6 +7436,7 @@ SetImageLayerPairList(nsStyleContext* aStyleContext,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aRebuild = true; aRebuild = true;
aItemCount = 1; aItemCount = 1;
aLayers[0].*aResultLocation = aInitialValue; aLayers[0].*aResultLocation = aInitialValue;
@ -7386,9 +7451,11 @@ SetImageLayerPairList(nsStyleContext* aStyleContext,
NS_ASSERTION(item->mXValue.GetUnit() != eCSSUnit_Inherit && NS_ASSERTION(item->mXValue.GetUnit() != eCSSUnit_Inherit &&
item->mXValue.GetUnit() != eCSSUnit_Initial && item->mXValue.GetUnit() != eCSSUnit_Initial &&
item->mXValue.GetUnit() != eCSSUnit_Unset && item->mXValue.GetUnit() != eCSSUnit_Unset &&
item->mXValue.GetUnit() != eCSSUnit_Revert &&
item->mYValue.GetUnit() != eCSSUnit_Inherit && item->mYValue.GetUnit() != eCSSUnit_Inherit &&
item->mYValue.GetUnit() != eCSSUnit_Initial && item->mYValue.GetUnit() != eCSSUnit_Initial &&
item->mYValue.GetUnit() != eCSSUnit_Unset, item->mYValue.GetUnit() != eCSSUnit_Unset &&
item->mYValue.GetUnit() != eCSSUnit_Revert,
"unexpected unit"); "unexpected unit");
++aItemCount; ++aItemCount;
aLayers.EnsureLengthAtLeast(aItemCount); aLayers.EnsureLengthAtLeast(aItemCount);
@ -7496,7 +7563,8 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
// background-color: color, string, inherit // background-color: color, string, inherit
const nsCSSValue* backColorValue = aRuleData->ValueForBackgroundColor(); const nsCSSValue* backColorValue = aRuleData->ValueForBackgroundColor();
if (eCSSUnit_Initial == backColorValue->GetUnit() || if (eCSSUnit_Initial == backColorValue->GetUnit() ||
eCSSUnit_Unset == backColorValue->GetUnit()) { eCSSUnit_Unset == backColorValue->GetUnit() ||
eCSSUnit_Revert == backColorValue->GetUnit()) {
bg->mBackgroundColor = NS_RGBA(0, 0, 0, 0); bg->mBackgroundColor = NS_RGBA(0, 0, 0, 0);
} else if (!SetColor(*backColorValue, parentBG->mBackgroundColor, } else if (!SetColor(*backColorValue, parentBG->mBackgroundColor,
mPresContext, aContext, bg->mBackgroundColor, mPresContext, aContext, bg->mBackgroundColor,
@ -7650,6 +7718,7 @@ SetBorderImageRect(const nsCSSValue& aValue,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aRect.SetAllSidesTo(aValue); aRect.SetAllSidesTo(aValue);
break; break;
default: default:
@ -7671,6 +7740,7 @@ SetBorderImagePair(const nsCSSValue& aValue,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aPair.SetBothValuesTo(aValue); aPair.SetBothValuesTo(aValue);
break; break;
default: default:
@ -7705,6 +7775,7 @@ SetBorderImageSlice(const nsCSSValue& aValue,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
aSlice = aValue; aSlice = aValue;
aFill = aValue; aFill = aValue;
break; break;
@ -7764,7 +7835,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
border->SetBorderWidth(side, border->SetBorderWidth(side,
parentBorder->GetComputedBorder().Side(side)); parentBorder->GetComputedBorder().Side(side));
} else if (eCSSUnit_Initial == value.GetUnit() || } else if (eCSSUnit_Initial == value.GetUnit() ||
eCSSUnit_Unset == value.GetUnit()) { eCSSUnit_Unset == value.GetUnit() ||
eCSSUnit_Revert == value.GetUnit()) {
border->SetBorderWidth(side, border->SetBorderWidth(side,
(mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]); (mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]);
} else { } else {
@ -7786,7 +7858,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
if (eCSSUnit_Enumerated == unit) { if (eCSSUnit_Enumerated == unit) {
border->SetBorderStyle(side, value.GetIntValue()); border->SetBorderStyle(side, value.GetIntValue());
} else if (eCSSUnit_Initial == unit || } else if (eCSSUnit_Initial == unit ||
eCSSUnit_Unset == unit) { eCSSUnit_Unset == unit ||
eCSSUnit_Revert == unit) {
border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE); border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE);
} else if (eCSSUnit_Inherit == unit) { } else if (eCSSUnit_Inherit == unit) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -7814,6 +7887,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
border->ClearBorderColors(side); border->ClearBorderColors(side);
break; break;
@ -8029,7 +8103,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct,
// outline-width: length, enum, inherit // outline-width: length, enum, inherit
const nsCSSValue* outlineWidthValue = aRuleData->ValueForOutlineWidth(); const nsCSSValue* outlineWidthValue = aRuleData->ValueForOutlineWidth();
if (eCSSUnit_Initial == outlineWidthValue->GetUnit() || if (eCSSUnit_Initial == outlineWidthValue->GetUnit() ||
eCSSUnit_Unset == outlineWidthValue->GetUnit()) { eCSSUnit_Unset == outlineWidthValue->GetUnit() ||
eCSSUnit_Revert == outlineWidthValue->GetUnit()) {
outline->mOutlineWidth = outline->mOutlineWidth =
nsStyleCoord(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated); nsStyleCoord(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated);
} else { } else {
@ -8092,7 +8167,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct,
if (eCSSUnit_Enumerated == unit) { if (eCSSUnit_Enumerated == unit) {
outline->mOutlineStyle = outlineStyleValue->GetIntValue(); outline->mOutlineStyle = outlineStyleValue->GetIntValue();
} else if (eCSSUnit_Initial == unit || } else if (eCSSUnit_Initial == unit ||
eCSSUnit_Unset == unit) { eCSSUnit_Unset == unit ||
eCSSUnit_Revert == unit) {
outline->mOutlineStyle = NS_STYLE_BORDER_STYLE_NONE; outline->mOutlineStyle = NS_STYLE_BORDER_STYLE_NONE;
} else if (eCSSUnit_Inherit == unit) { } else if (eCSSUnit_Inherit == unit) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -8120,6 +8196,7 @@ nsRuleNode::ComputeListData(void* aStartStruct,
break; break;
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
conditions.SetUncacheable(); conditions.SetUncacheable();
list->SetQuotesInherit(parentList); list->SetQuotesInherit(parentList);
break; break;
@ -8157,8 +8234,9 @@ nsRuleNode::ComputeListData(void* aStartStruct,
// list-style-type: string, none, inherit, initial // list-style-type: string, none, inherit, initial
const nsCSSValue* typeValue = aRuleData->ValueForListStyleType(); const nsCSSValue* typeValue = aRuleData->ValueForListStyleType();
switch (typeValue->GetUnit()) { switch (typeValue->GetUnit()) {
case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Inherit: { case eCSSUnit_Revert: {
conditions.SetUncacheable(); conditions.SetUncacheable();
list->SetCounterStyle(parentList->GetCounterStyle()); list->SetCounterStyle(parentList->GetCounterStyle());
break; break;
@ -8223,7 +8301,8 @@ nsRuleNode::ComputeListData(void* aStartStruct,
eCSSUnit_Initial == imageValue->GetUnit()) { eCSSUnit_Initial == imageValue->GetUnit()) {
list->mListStyleImage = nullptr; list->mListStyleImage = nullptr;
} else if (eCSSUnit_Inherit == imageValue->GetUnit() || } else if (eCSSUnit_Inherit == imageValue->GetUnit() ||
eCSSUnit_Unset == imageValue->GetUnit()) { eCSSUnit_Unset == imageValue->GetUnit() ||
eCSSUnit_Revert == imageValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
list->mListStyleImage = parentList->mListStyleImage; list->mListStyleImage = parentList->mListStyleImage;
} }
@ -8240,6 +8319,7 @@ nsRuleNode::ComputeListData(void* aStartStruct,
switch (imageRegionValue->GetUnit()) { switch (imageRegionValue->GetUnit()) {
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
conditions.SetUncacheable(); conditions.SetUncacheable();
list->mImageRegion = parentList->mImageRegion; list->mImageRegion = parentList->mImageRegion;
break; break;
@ -8310,7 +8390,9 @@ SetGridTrackBreadth(const nsCSSValue& aValue,
// For fit-content(). // For fit-content().
aResult.SetNoneValue(); aResult.SetNoneValue();
} else { } else {
MOZ_ASSERT(unit != eCSSUnit_Inherit && unit != eCSSUnit_Unset, MOZ_ASSERT(unit != eCSSUnit_Inherit &&
unit != eCSSUnit_Unset &&
unit != eCSSUnit_Revert,
"Unexpected value that would use dummyParentCoord"); "Unexpected value that would use dummyParentCoord");
const nsStyleCoord dummyParentCoord; const nsStyleCoord dummyParentCoord;
DebugOnly<bool> stored = DebugOnly<bool> stored =
@ -8378,6 +8460,7 @@ SetGridAutoColumnsRows(const nsCSSValue& aValue,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
// The initial value is 'auto', // The initial value is 'auto',
// which computes to 'minmax(auto, auto)'. // which computes to 'minmax(auto, auto)'.
// (Explicitly-specified 'auto' values are handled in SetGridTrackSize.) // (Explicitly-specified 'auto' values are handled in SetGridTrackSize.)
@ -8434,6 +8517,7 @@ SetGridTrackList(const nsCSSValue& aValue,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
aResult.mIsSubgrid = false; aResult.mIsSubgrid = false;
aResult.mLineNameLists.Clear(); aResult.mLineNameLists.Clear();
@ -8554,6 +8638,7 @@ SetGridTemplateAreas(const nsCSSValue& aValue,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
*aResult = nullptr; *aResult = nullptr;
break; break;
@ -8581,6 +8666,7 @@ SetGridLine(const nsCSSValue& aValue,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_Auto: case eCSSUnit_Auto:
aResult.SetAuto(); aResult.SetAuto();
break; break;
@ -8837,6 +8923,7 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
pos->mObjectPosition.SetInitialPercentValues(0.5f); pos->mObjectPosition.SetInitialPercentValues(0.5f);
break; break;
default: default:
@ -8855,6 +8942,7 @@ nsRuleNode::ComputePositionData(void* aStartStruct,
break; break;
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
pos->mGridAutoFlow = NS_STYLE_GRID_AUTO_FLOW_ROW; pos->mGridAutoFlow = NS_STYLE_GRID_AUTO_FLOW_ROW;
break; break;
default: default:
@ -9065,6 +9153,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
case eCSSUnit_None: case eCSSUnit_None:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
// "normal", "none", "initial" and "unset" all mean no content // "normal", "none", "initial" and "unset" all mean no content
content->AllocateContents(0); content->AllocateContents(0);
break; break;
@ -9163,6 +9252,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
case eCSSUnit_None: case eCSSUnit_None:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
content->AllocateCounterIncrements(0); content->AllocateCounterIncrements(0);
break; break;
@ -9212,6 +9302,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct,
case eCSSUnit_None: case eCSSUnit_None:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
content->AllocateCounterResets(0); content->AllocateCounterResets(0);
break; break;
@ -9318,7 +9409,8 @@ nsRuleNode::ComputeXULData(void* aStartStruct,
conditions.SetUncacheable(); conditions.SetUncacheable();
xul->mStretchStack = parentXUL->mStretchStack; xul->mStretchStack = parentXUL->mStretchStack;
} else if (eCSSUnit_Initial == stackSizingValue->GetUnit() || } else if (eCSSUnit_Initial == stackSizingValue->GetUnit() ||
eCSSUnit_Unset == stackSizingValue->GetUnit()) { eCSSUnit_Unset == stackSizingValue->GetUnit() ||
eCSSUnit_Revert == stackSizingValue->GetUnit()) {
xul->mStretchStack = true; xul->mStretchStack = true;
} else if (eCSSUnit_Enumerated == stackSizingValue->GetUnit()) { } else if (eCSSUnit_Enumerated == stackSizingValue->GetUnit()) {
xul->mStretchStack = stackSizingValue->GetIntValue() == xul->mStretchStack = stackSizingValue->GetIntValue() ==
@ -9350,7 +9442,8 @@ nsRuleNode::ComputeColumnData(void* aStartStruct,
const nsCSSValue* columnCountValue = aRuleData->ValueForColumnCount(); const nsCSSValue* columnCountValue = aRuleData->ValueForColumnCount();
if (eCSSUnit_Auto == columnCountValue->GetUnit() || if (eCSSUnit_Auto == columnCountValue->GetUnit() ||
eCSSUnit_Initial == columnCountValue->GetUnit() || eCSSUnit_Initial == columnCountValue->GetUnit() ||
eCSSUnit_Unset == columnCountValue->GetUnit()) { eCSSUnit_Unset == columnCountValue->GetUnit() ||
eCSSUnit_Revert == columnCountValue->GetUnit()) {
column->mColumnCount = NS_STYLE_COLUMN_COUNT_AUTO; column->mColumnCount = NS_STYLE_COLUMN_COUNT_AUTO;
} else if (eCSSUnit_Integer == columnCountValue->GetUnit()) { } else if (eCSSUnit_Integer == columnCountValue->GetUnit()) {
column->mColumnCount = columnCountValue->GetIntValue(); column->mColumnCount = columnCountValue->GetIntValue();
@ -9365,7 +9458,8 @@ nsRuleNode::ComputeColumnData(void* aStartStruct,
// column-rule-width: length, enum, inherit // column-rule-width: length, enum, inherit
const nsCSSValue& widthValue = *aRuleData->ValueForColumnRuleWidth(); const nsCSSValue& widthValue = *aRuleData->ValueForColumnRuleWidth();
if (eCSSUnit_Initial == widthValue.GetUnit() || if (eCSSUnit_Initial == widthValue.GetUnit() ||
eCSSUnit_Unset == widthValue.GetUnit()) { eCSSUnit_Unset == widthValue.GetUnit() ||
eCSSUnit_Revert == widthValue.GetUnit()) {
column->SetColumnRuleWidth( column->SetColumnRuleWidth(
(mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]); (mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]);
} else if (eCSSUnit_Enumerated == widthValue.GetUnit()) { } else if (eCSSUnit_Enumerated == widthValue.GetUnit()) {
@ -9399,7 +9493,8 @@ nsRuleNode::ComputeColumnData(void* aStartStruct,
if (eCSSUnit_Enumerated == styleValue.GetUnit()) { if (eCSSUnit_Enumerated == styleValue.GetUnit()) {
column->mColumnRuleStyle = styleValue.GetIntValue(); column->mColumnRuleStyle = styleValue.GetIntValue();
} else if (eCSSUnit_Initial == styleValue.GetUnit() || } else if (eCSSUnit_Initial == styleValue.GetUnit() ||
eCSSUnit_Unset == styleValue.GetUnit()) { eCSSUnit_Unset == styleValue.GetUnit() ||
eCSSUnit_Revert == styleValue.GetUnit()) {
column->mColumnRuleStyle = NS_STYLE_BORDER_STYLE_NONE; column->mColumnRuleStyle = NS_STYLE_BORDER_STYLE_NONE;
} else if (eCSSUnit_Inherit == styleValue.GetUnit()) { } else if (eCSSUnit_Inherit == styleValue.GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -9438,7 +9533,8 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
nscolor color; nscolor color;
if (aValue.GetUnit() == eCSSUnit_Inherit || if (aValue.GetUnit() == eCSSUnit_Inherit ||
aValue.GetUnit() == eCSSUnit_Unset) { aValue.GetUnit() == eCSSUnit_Unset ||
aValue.GetUnit() == eCSSUnit_Revert) {
aResult = parentPaint; aResult = parentPaint;
aConditions.SetUncacheable(); aConditions.SetUncacheable();
} else if (aValue.GetUnit() == eCSSUnit_None) { } else if (aValue.GetUnit() == eCSSUnit_None) {
@ -9510,7 +9606,8 @@ SetSVGOpacity(const nsCSSValue& aValue,
// Fall back on fully opaque // Fall back on fully opaque
aOpacityField = 1.0f; aOpacityField = 1.0f;
} else if (eCSSUnit_Inherit == aValue.GetUnit() || } else if (eCSSUnit_Inherit == aValue.GetUnit() ||
eCSSUnit_Unset == aValue.GetUnit()) { eCSSUnit_Unset == aValue.GetUnit() ||
eCSSUnit_Revert == aValue.GetUnit()) {
aConditions.SetUncacheable(); aConditions.SetUncacheable();
aOpacityField = aParentOpacity; aOpacityField = aParentOpacity;
aOpacityTypeField = aParentOpacityType; aOpacityTypeField = aParentOpacityType;
@ -9580,7 +9677,8 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
eCSSUnit_Initial == markerEndValue->GetUnit()) { eCSSUnit_Initial == markerEndValue->GetUnit()) {
svg->mMarkerEnd = nullptr; svg->mMarkerEnd = nullptr;
} else if (eCSSUnit_Inherit == markerEndValue->GetUnit() || } else if (eCSSUnit_Inherit == markerEndValue->GetUnit() ||
eCSSUnit_Unset == markerEndValue->GetUnit()) { eCSSUnit_Unset == markerEndValue->GetUnit() ||
eCSSUnit_Revert == markerEndValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
svg->mMarkerEnd = parentSVG->mMarkerEnd; svg->mMarkerEnd = parentSVG->mMarkerEnd;
} }
@ -9593,7 +9691,8 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
eCSSUnit_Initial == markerMidValue->GetUnit()) { eCSSUnit_Initial == markerMidValue->GetUnit()) {
svg->mMarkerMid = nullptr; svg->mMarkerMid = nullptr;
} else if (eCSSUnit_Inherit == markerMidValue->GetUnit() || } else if (eCSSUnit_Inherit == markerMidValue->GetUnit() ||
eCSSUnit_Unset == markerMidValue->GetUnit()) { eCSSUnit_Unset == markerMidValue->GetUnit() ||
eCSSUnit_Revert == markerMidValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
svg->mMarkerMid = parentSVG->mMarkerMid; svg->mMarkerMid = parentSVG->mMarkerMid;
} }
@ -9605,6 +9704,8 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
} else if (eCSSUnit_None == markerStartValue->GetUnit() || } else if (eCSSUnit_None == markerStartValue->GetUnit() ||
eCSSUnit_Initial == markerStartValue->GetUnit()) { eCSSUnit_Initial == markerStartValue->GetUnit()) {
svg->mMarkerStart = nullptr; svg->mMarkerStart = nullptr;
} else if (eCSSUnit_Inherit == markerStartValue->GetUnit()) {
} else if (eCSSUnit_Inherit == markerStartValue->GetUnit() || } else if (eCSSUnit_Inherit == markerStartValue->GetUnit() ||
eCSSUnit_Unset == markerStartValue->GetUnit()) { eCSSUnit_Unset == markerStartValue->GetUnit()) {
conditions.SetUncacheable(); conditions.SetUncacheable();
@ -9626,6 +9727,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
conditions.SetUncacheable(); conditions.SetUncacheable();
svg->mPaintOrder = parentSVG->mPaintOrder; svg->mPaintOrder = parentSVG->mPaintOrder;
break; break;
@ -9658,6 +9760,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
conditions.SetUncacheable(); conditions.SetUncacheable();
svg->SetStrokeDasharrayFromObject(parentSVG->StrokeDasharrayFromObject()); svg->SetStrokeDasharrayFromObject(parentSVG->StrokeDasharrayFromObject());
svg->mStrokeDasharray = parentSVG->mStrokeDasharray; svg->mStrokeDasharray = parentSVG->mStrokeDasharray;
@ -10057,7 +10160,8 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
// stop-color: // stop-color:
const nsCSSValue* stopColorValue = aRuleData->ValueForStopColor(); const nsCSSValue* stopColorValue = aRuleData->ValueForStopColor();
if (eCSSUnit_Initial == stopColorValue->GetUnit() || if (eCSSUnit_Initial == stopColorValue->GetUnit() ||
eCSSUnit_Unset == stopColorValue->GetUnit()) { eCSSUnit_Unset == stopColorValue->GetUnit() ||
eCSSUnit_Revert == stopColorValue->GetUnit()) {
svgReset->mStopColor = NS_RGB(0, 0, 0); svgReset->mStopColor = NS_RGB(0, 0, 0);
} else { } else {
SetColor(*stopColorValue, parentSVGReset->mStopColor, SetColor(*stopColorValue, parentSVGReset->mStopColor,
@ -10067,7 +10171,8 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
// flood-color: // flood-color:
const nsCSSValue* floodColorValue = aRuleData->ValueForFloodColor(); const nsCSSValue* floodColorValue = aRuleData->ValueForFloodColor();
if (eCSSUnit_Initial == floodColorValue->GetUnit() || if (eCSSUnit_Initial == floodColorValue->GetUnit() ||
eCSSUnit_Unset == floodColorValue->GetUnit()) { eCSSUnit_Unset == floodColorValue->GetUnit() ||
eCSSUnit_Revert == floodColorValue->GetUnit()) {
svgReset->mFloodColor = NS_RGB(0, 0, 0); svgReset->mFloodColor = NS_RGB(0, 0, 0);
} else { } else {
SetColor(*floodColorValue, parentSVGReset->mFloodColor, SetColor(*floodColorValue, parentSVGReset->mFloodColor,
@ -10077,7 +10182,8 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
// lighting-color: // lighting-color:
const nsCSSValue* lightingColorValue = aRuleData->ValueForLightingColor(); const nsCSSValue* lightingColorValue = aRuleData->ValueForLightingColor();
if (eCSSUnit_Initial == lightingColorValue->GetUnit() || if (eCSSUnit_Initial == lightingColorValue->GetUnit() ||
eCSSUnit_Unset == lightingColorValue->GetUnit()) { eCSSUnit_Unset == lightingColorValue->GetUnit() ||
eCSSUnit_Revert == lightingColorValue->GetUnit()) {
svgReset->mLightingColor = NS_RGB(255, 255, 255); svgReset->mLightingColor = NS_RGB(255, 255, 255);
} else { } else {
SetColor(*lightingColorValue, parentSVGReset->mLightingColor, SetColor(*lightingColorValue, parentSVGReset->mLightingColor,
@ -10093,6 +10199,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
case eCSSUnit_None: case eCSSUnit_None:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
svgReset->mClipPath = StyleClipPath(); svgReset->mClipPath = StyleClipPath();
break; break;
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
@ -10301,6 +10408,7 @@ nsRuleNode::ComputeEffectsData(void* aStartStruct,
case eCSSUnit_None: case eCSSUnit_None:
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
effects->mFilters.Clear(); effects->mFilters.Clear();
break; break;
case eCSSUnit_Inherit: case eCSSUnit_Inherit:
@ -10337,6 +10445,7 @@ nsRuleNode::ComputeEffectsData(void* aStartStruct,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_None: case eCSSUnit_None:
effects->mBoxShadow = nullptr; effects->mBoxShadow = nullptr;
break; break;
@ -10367,6 +10476,7 @@ nsRuleNode::ComputeEffectsData(void* aStartStruct,
case eCSSUnit_Initial: case eCSSUnit_Initial:
case eCSSUnit_Unset: case eCSSUnit_Unset:
case eCSSUnit_Revert:
case eCSSUnit_Auto: case eCSSUnit_Auto:
effects->mClipFlags = NS_STYLE_CLIP_AUTO; effects->mClipFlags = NS_STYLE_CLIP_AUTO;
effects->mClip.SetRect(0,0,0,0); effects->mClip.SetRect(0,0,0,0);
@ -10678,10 +10788,12 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
for (uint32_t i = 0; i < nValues; ++i) { for (uint32_t i = 0; i < nValues; ++i) {
nsCSSUnit unit = values[i]->GetUnit(); nsCSSUnit unit = values[i]->GetUnit();
if (unit != eCSSUnit_Null && if (unit != eCSSUnit_Null &&
unit != eCSSUnit_Revert &&
unit != eCSSUnit_Dummy && unit != eCSSUnit_Dummy &&
unit != eCSSUnit_DummyInherit) { unit != eCSSUnit_DummyInherit) {
if (unit == eCSSUnit_Inherit || if (unit == eCSSUnit_Inherit ||
(i >= inheritedOffset && unit == eCSSUnit_Unset)) { (i >= inheritedOffset && unit == eCSSUnit_Unset) ||
(i >= inheritedOffset && unit == eCSSUnit_Revert)) {
haveExplicitUAInherit = true; haveExplicitUAInherit = true;
values[i]->SetDummyInheritValue(); values[i]->SetDummyInheritValue();
} else { } else {
@ -10695,7 +10807,8 @@ nsRuleNode::HasAuthorSpecifiedRules(nsStyleContext* aStyleContext,
for (uint32_t i = 0; i < nValues; ++i) { for (uint32_t i = 0; i < nValues; ++i) {
if (values[i]->GetUnit() != eCSSUnit_Null && if (values[i]->GetUnit() != eCSSUnit_Null &&
values[i]->GetUnit() != eCSSUnit_Dummy && // see above values[i]->GetUnit() != eCSSUnit_Dummy && // see above
values[i]->GetUnit() != eCSSUnit_DummyInherit) { values[i]->GetUnit() != eCSSUnit_DummyInherit &&
values[i]->GetUnit() != eCSSUnit_Revert) {
// If author colors are not allowed, only claim to have // If author colors are not allowed, only claim to have
// author-specified rules if we're looking at a non-color // author-specified rules if we're looking at a non-color
// property or if we're looking at the background color and it's // property or if we're looking at the background color and it's
@ -10833,6 +10946,8 @@ nsRuleNode::ComputeColor(const nsCSSValue& aValue, nsPresContext* aPresContext,
"aValue shouldn't have eCSSUnit_Initial"); "aValue shouldn't have eCSSUnit_Initial");
MOZ_ASSERT(aValue.GetUnit() != eCSSUnit_Unset, MOZ_ASSERT(aValue.GetUnit() != eCSSUnit_Unset,
"aValue shouldn't have eCSSUnit_Unset"); "aValue shouldn't have eCSSUnit_Unset");
MOZ_ASSERT(aValue.GetUnit() != eCSSUnit_Revert,
"aValue shouldn't have eCSSUnit_Revert");
RuleNodeCacheConditions conditions; RuleNodeCacheConditions conditions;
bool ok = SetColor(aValue, NS_RGB(0, 0, 0), aPresContext, aStyleContext, bool ok = SetColor(aValue, NS_RGB(0, 0, 0), aPresContext, aStyleContext,

View file

@ -787,7 +787,8 @@ protected:
nsStyleFont* aFont); nsStyleFont* aFont);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID,
const nsRuleData* aRuleData); const nsRuleData* aRuleData,
bool& ignoreRuleCache);
private: private:
nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent, nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,

View file

@ -186,6 +186,7 @@ enum class StyleUserSelect : uint8_t {
None, None,
Text, Text,
Element, Element,
Contain,
Elements, Elements,
All, All,
Toggle, Toggle,

View file

@ -720,12 +720,12 @@ canvas {
/* hidden elements */ /* hidden elements */
base, basefont, datalist, head, meta, script, style, title, base, basefont, datalist, head, meta, script, style, title,
noembed, param, template { noembed, param, template {
display: none !important; display: none;
} }
area { area {
/* Don't give it frames other than its imageframe */ /* Don't give it frames other than its imageframe */
display: none !important; display: none ! important;
} }
iframe:fullscreen { iframe:fullscreen {

View file

@ -16,7 +16,7 @@ body {
div.ancillary { div.ancillary {
margin: 0.5em 0; margin: 0.5em 0;
-moz-user-select: none; user-select: none;
} }
div.section { div.section {
@ -71,7 +71,7 @@ h3 {
a.upDownArrow { a.upDownArrow {
font-size: 130%; font-size: 130%;
text-decoration: none; text-decoration: none;
-moz-user-select: none; /* no need to include this when cutting+pasting */ user-select: none; /* no need to include this when cutting+pasting */
} }
.accuracyWarning { .accuracyWarning {
@ -114,17 +114,17 @@ a.upDownArrow {
} }
.noselect { .noselect {
-moz-user-select: none; /* no need to include this when cutting+pasting */ user-select: none; /* no need to include this when cutting+pasting */
} }
.option { .option {
font-size: 80%; font-size: 80%;
-moz-user-select: none; /* no need to include this when cutting+pasting */ user-select: none; /* no need to include this when cutting+pasting */
} }
.legend { .legend {
font-size: 80%; font-size: 80%;
-moz-user-select: none; /* no need to include this when cutting+pasting */ user-select: none; /* no need to include this when cutting+pasting */
} }
.debug { .debug {

View file

@ -23,7 +23,7 @@
* { * {
-moz-user-focus: ignore; -moz-user-focus: ignore;
-moz-user-select: none; user-select: none;
display: -moz-box; display: -moz-box;
box-sizing: border-box; box-sizing: border-box;
} }
@ -97,7 +97,7 @@ thumb {
} }
scrollbar, scrollbarbutton, scrollcorner, slider, thumb, scale { scrollbar, scrollbarbutton, scrollcorner, slider, thumb, scale {
-moz-user-select: none; user-select: none;
} }
scrollcorner { scrollcorner {

View file

@ -658,7 +658,7 @@ treecol.treecol-image {
tree > treechildren { tree > treechildren {
display: -moz-box; display: -moz-box;
-moz-binding: url("chrome://global/content/bindings/tree.xml#treebody"); -moz-binding: url("chrome://global/content/bindings/tree.xml#treebody");
-moz-user-select: none; user-select: none;
-moz-box-flex: 1; -moz-box-flex: 1;
} }
@ -763,7 +763,7 @@ progressmeter {
textbox { textbox {
-moz-binding: url("chrome://global/content/bindings/textbox.xml#textbox"); -moz-binding: url("chrome://global/content/bindings/textbox.xml#textbox");
-moz-user-select: text; user-select: text;
text-shadow: none; text-shadow: none;
} }

View file

@ -61,7 +61,7 @@ xhtml|link {
.text-list { .text-list {
white-space: pre-line; white-space: pre-line;
-moz-user-select: element; user-select: contain;
} }
setting, row[unsupported="true"] { setting, row[unsupported="true"] {
@ -203,10 +203,10 @@ setting[type="menulist"] {
} }
.addon .relnotes { .addon .relnotes {
-moz-user-select: text; user-select: text;
} }
#detail-name, #detail-desc, #detail-fulldesc { #detail-name, #detail-desc, #detail-fulldesc {
-moz-user-select: text; user-select: text;
} }
/* Make sure we're not animating hidden images. See bug 623739. */ /* Make sure we're not animating hidden images. See bug 623739. */

View file

@ -216,7 +216,7 @@ body:not(.loaded) .toolbar:-moz-locale-dir(rtl) {
padding: 0; padding: 0;
list-style: none; list-style: none;
background-color: #fbfbfb; background-color: #fbfbfb;
-moz-user-select: none; user-select: none;
border-right: 1px solid #b5b5b5; border-right: 1px solid #b5b5b5;
z-index: 1; z-index: 1;
} }

View file

@ -315,7 +315,7 @@ button.month-year.active::after {
padding: calc((var(--spinner-item-height) - var(--font-size-default)) / 2) 0; padding: calc((var(--spinner-item-height) - var(--font-size-default)) / 2) 0;
margin-bottom: var(--spinner-item-margin-bottom); margin-bottom: var(--spinner-item-margin-bottom);
height: var(--spinner-item-height); height: var(--spinner-item-height);
-moz-user-select: none; user-select: none;
scroll-snap-coordinate: 0 0; scroll-snap-coordinate: 0 0;
} }

View file

@ -655,7 +655,7 @@ xul|*.radio-label-box {
padding-bottom: 2px; padding-bottom: 2px;
padding-inline-start: 9px; padding-inline-start: 9px;
margin: 0; margin: 0;
-moz-user-select: none; user-select: none;
} }
*|*.category-icon { *|*.category-icon {
@ -678,7 +678,7 @@ xul|*.radio-label-box {
font-weight: normal; font-weight: normal;
line-height: 40px; line-height: 40px;
margin: 0; margin: 0;
-moz-user-select: none; user-select: none;
} }
/* File fields */ /* File fields */

View file

@ -15,7 +15,7 @@
height: 100%; height: 100%;
background-color: rgb(72,72,72); background-color: rgb(72,72,72);
color: white; color: white;
-moz-user-select: none; user-select: none;
} }
.hoverBox { .hoverBox {