mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 921731 - Part 9: Serialize shorthands using "unset" like those containing "inherit" or "initial". r=bzbarsky
This commit is contained in:
parent
5dbe100782
commit
ec446e54ac
@ -161,10 +161,10 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
|
|||||||
// (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' and 'initial' can only be specified as the
|
// (2) Since 'inherit', 'initial' and 'unset' can only be specified
|
||||||
// values for entire properties, we need to return the empty
|
// as the values for entire properties, we need to return the
|
||||||
// string if some but not all of the subproperties have one of
|
// empty string if some but not all of the subproperties have one
|
||||||
// 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
|
||||||
// !important and some are not.
|
// !important and some are not.
|
||||||
@ -172,7 +172,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
|
|||||||
// we can also simplify the property serialization code by serializing
|
// we can also simplify the property serialization code by serializing
|
||||||
// those values up front as well.
|
// those values up front as well.
|
||||||
uint32_t totalCount = 0, importantCount = 0,
|
uint32_t totalCount = 0, importantCount = 0,
|
||||||
initialCount = 0, inheritCount = 0;
|
initialCount = 0, inheritCount = 0, unsetCount = 0;
|
||||||
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty) {
|
CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty) {
|
||||||
if (*p == eCSSProperty__x_system_font ||
|
if (*p == eCSSProperty__x_system_font ||
|
||||||
nsCSSProps::PropHasFlags(*p, CSS_PROPERTY_DIRECTIONAL_SOURCE)) {
|
nsCSSProps::PropHasFlags(*p, CSS_PROPERTY_DIRECTIONAL_SOURCE)) {
|
||||||
@ -195,6 +195,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
|
|||||||
++inheritCount;
|
++inheritCount;
|
||||||
} else if (val->GetUnit() == eCSSUnit_Initial) {
|
} else if (val->GetUnit() == eCSSUnit_Initial) {
|
||||||
++initialCount;
|
++initialCount;
|
||||||
|
} else if (val->GetUnit() == eCSSUnit_Unset) {
|
||||||
|
++unsetCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (importantCount != 0 && importantCount != totalCount) {
|
if (importantCount != 0 && importantCount != totalCount) {
|
||||||
@ -211,8 +213,13 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
|
|||||||
nsCSSValue(eCSSUnit_Inherit).AppendToString(eCSSProperty_UNKNOWN, aValue);
|
nsCSSValue(eCSSUnit_Inherit).AppendToString(eCSSProperty_UNKNOWN, aValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (initialCount != 0 || inheritCount != 0) {
|
if (unsetCount == totalCount) {
|
||||||
// Case (2): partially initial or inherit.
|
// Simplify serialization below by serializing unset up-front.
|
||||||
|
nsCSSValue(eCSSUnit_Unset).AppendToString(eCSSProperty_UNKNOWN, aValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (initialCount != 0 || inheritCount != 0 || unsetCount != 0) {
|
||||||
|
// Case (2): partially initial, inherit or unset.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user