Backed out 10 changesets (bug 550426) for failures in browser_css_autocompletion.js

Backed out changeset 6ff2e12738ca (bug 550426)
Backed out changeset 10ee68fd318e (bug 550426)
Backed out changeset 324f4f602730 (bug 550426)
Backed out changeset 81306e78ccaa (bug 550426)
Backed out changeset 44b820f6fb3d (bug 550426)
Backed out changeset 987b6ff7262e (bug 550426)
Backed out changeset d505646974c7 (bug 550426)
Backed out changeset 2162ecc18859 (bug 550426)
Backed out changeset 1a030aba3acc (bug 550426)
Backed out changeset 3655883e7faf (bug 550426)

MozReview-Commit-ID: AlUihrLtlhL

--HG--
rename : layout/reftests/backgrounds/background-position-6b.html => layout/reftests/backgrounds/background-position-6.html
This commit is contained in:
Wes Kocher 2016-04-29 14:47:43 -07:00
Родитель 94283af013
Коммит 6521757101
38 изменённых файлов: 146 добавлений и 1406 удалений

Просмотреть файл

@ -9,8 +9,7 @@
const EXPECTED_PROPERTIES = [
"background-color",
"background-position-x",
"background-position-y",
"background-position",
"background-size",
"border-bottom-left-radius",
"border-bottom-right-radius",

Просмотреть файл

@ -85,8 +85,6 @@ public:
case eCSSProperty_margin_right: return ACTIVITY_MARGIN_RIGHT;
case eCSSProperty_margin_bottom: return ACTIVITY_MARGIN_BOTTOM;
case eCSSProperty_background_position: return ACTIVITY_BACKGROUND_POSITION;
case eCSSProperty_background_position_x: return ACTIVITY_BACKGROUND_POSITION;
case eCSSProperty_background_position_y: return ACTIVITY_BACKGROUND_POSITION;
default: MOZ_ASSERT(false); return ACTIVITY_OPACITY;
}
}
@ -386,14 +384,6 @@ ActiveLayerTracker::IsStyleMaybeAnimated(nsIFrame* aFrame, nsCSSProperty aProper
return IsStyleAnimated(nullptr, aFrame, aProperty);
}
/* static */ bool
ActiveLayerTracker::IsBackgroundPositionAnimated(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame)
{
return IsStyleAnimated(aBuilder, aFrame, eCSSProperty_background_position_x) ||
IsStyleAnimated(aBuilder, aFrame, eCSSProperty_background_position_y);
}
static bool
CheckScrollInducedActivity(LayerActivity* aLayerActivity,
LayerActivity::ActivityIndex aActivityIndex,

Просмотреть файл

@ -87,12 +87,7 @@ public:
* as being animated for constructing active layers.
*/
static bool IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame);
/**
* Return true if aFrame's background-position-x or background-position-y
* property is animated.
*/
static bool IsBackgroundPositionAnimated(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame);
/**
* Return true if aFrame either has an animated scale now, or is likely to
* have one in the future because it has a CSS animation or transition

Просмотреть файл

@ -2653,8 +2653,8 @@ nsDisplayBackgroundImage::ShouldCreateOwnLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager)
{
nsIFrame* backgroundStyleFrame = nsCSSRendering::FindBackgroundStyleFrame(mFrame);
if (ActiveLayerTracker::IsBackgroundPositionAnimated(aBuilder,
backgroundStyleFrame)) {
if (ActiveLayerTracker::IsStyleAnimated(aBuilder, backgroundStyleFrame,
eCSSProperty_background_position)) {
return WHENEVER_POSSIBLE;
}

Просмотреть файл

@ -774,13 +774,9 @@ PropertySupportsVariant(nsCSSProperty aPropertyID, uint32_t aVariant)
case eCSSProperty_border_bottom_left_radius:
case eCSSProperty_border_bottom_right_radius:
case eCSSProperty_background_position:
case eCSSProperty_background_position_x:
case eCSSProperty_background_position_y:
case eCSSProperty_background_size:
#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
case eCSSProperty_mask_position:
case eCSSProperty_mask_position_x:
case eCSSProperty_mask_position_y:
case eCSSProperty_mask_size:
#endif
case eCSSProperty_grid_auto_columns:

Просмотреть файл

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: right 25% bottom 75%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: right 25%;
background-position-y: bottom 75%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner2
{
width: 128px;
height: 128px;
background-position-x: right 25%;
background-position-y: bottom 75%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner3
{
width: 128px;
height: 128px;
background-position-x: right 24px;
background-position-y: bottom 72px;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner4
{
width: 128px;
height: 128px;
background-position-x: right 24px;
background-position-y: bottom 72px;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
<div id="outer"><div id="inner2"></div></div>
<div id="outer"><div id="inner3"></div></div>
<div id="outer"><div id="inner4"></div></div>
</body>
</html>

Просмотреть файл

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: left 75% top 25%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: left 75%;
background-position-y: top 25%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner2
{
width: 128px;
height: 128px;
background-position-x: left 75%;
background-position-y: top 25%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner3
{
width: 128px;
height: 128px;
background-position-x: left 72px;
background-position-y: top 24px;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner4
{
width: 128px;
height: 128px;
background-position-x: left 72px;
background-position-y: top 24px;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
<div id="outer"><div id="inner2"></div></div>
<div id="outer"><div id="inner3"></div></div>
<div id="outer"><div id="inner4"></div></div>
</body>
</html>

Просмотреть файл

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: left 75% bottom 75%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: left 75%;
background-position-y: bottom 75%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner2
{
width: 128px;
height: 128px;
background-position-x: right 25%;
background-position-y: top 25%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner3
{
width: 128px;
height: 128px;
background-position-x: left 75%;
background-position-y: bottom 75%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
#inner4
{
width: 128px;
height: 128px;
background-position-x: right 25%;
background-position-y: top 25%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
<div id="outer"><div id="inner2"></div></div>
<div id="outer"><div id="inner3"></div></div>
<div id="outer"><div id="inner4"></div></div>
</body>
</html>

Просмотреть файл

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: left 25% bottom 75%</title>
<title>background-position: center bottom 75%</title>
<style type="text/css">
#outer
{

Просмотреть файл

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: left 25% bottom 75%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: left 25%;
background-position-y: bottom 75%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: 25% 25%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: 25%;
background-position-y: 25%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: center bottom 75%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: center;
background-position-y: bottom 75%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position: center 25%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-x: center;
background-position-y: 25%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position-y: bottom 50%</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-y: bottom 50%;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position-y: center</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position-y: center;
background-image: url(aqua-32x32.png);
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>background-position-y: top, bottom</title>
<style type="text/css">
#outer
{
border: 1px solid black;
width: 128px;
height: 128px;
}
#inner1
{
width: 128px;
height: 128px;
background-position: top; /* sets background-position-x to center */
background-position-y: top, bottom;
background-image: url(aqua-32x32.png), url(aqua-32x32.png);
background-repeat: no-repeat, no-repeat;
}
</style>
</head>
<body>
<div id="outer"><div id="inner1"></div></div>
</body>
</html>

Просмотреть файл

@ -35,25 +35,15 @@ skip-if(B2G||Mulet) == continuous-inline-4b.html continuous-inline-4-ref.html #
skip-if(B2G||Mulet) == background-position-1a.html background-position-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
== background-position-1b.html background-position-1-ref.html
== background-position-1c.html background-position-1-ref.html
skip-if(B2G||Mulet) == background-position-1d.html background-position-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
== background-position-1e.html background-position-1-ref.html
== background-position-1f.html background-position-1-ref.html
== background-position-2a.html background-position-2-ref.html
== background-position-2b.html background-position-2-ref.html
== background-position-2c.html background-position-2-ref.html
== background-position-2d.html background-position-2-ref.html
== background-position-3a.html background-position-3-ref.html
== background-position-3b.html background-position-3-ref.html
== background-position-3c.html background-position-3-ref.html
== background-position-3d.html background-position-3-ref.html
== background-position-4a.html background-position-4-ref.html
== background-position-4b.html background-position-4-ref.html
== background-position-4c.html background-position-4-ref.html
== background-position-4d.html background-position-4-ref.html
== background-position-4e.html background-position-4-ref.html
== background-position-5.html background-position-5-ref.html
== background-position-6a.html background-position-6-ref.html
== background-position-6b.html background-position-6-ref.html
== background-position-6.html background-position-6-ref.html
== background-position-7.html background-position-7-ref.html
== background-position-8.html background-position-8-ref.html

Просмотреть файл

@ -201,41 +201,6 @@ Declaration::GetAuthoredValue(nsCSSProperty aProperty, nsAString& aValue) const
GetValue(aProperty, aValue, nsCSSValue::eAuthorSpecified);
}
static void
AppendSingleImageLayerPositionValue(const nsCSSValue& aPositionX,
const nsCSSValue& aPositionY,
const nsCSSProperty aTable[],
nsAString& aValue,
nsCSSValue::Serialization aSerialization)
{
// We need to make sure that we don't serialize to an invalid 3-value form.
// The 3-value form is only valid if both edges are present.
const nsCSSValue &xEdge = aPositionX.GetArrayValue()->Item(0);
const nsCSSValue &xOffset = aPositionX.GetArrayValue()->Item(1);
const nsCSSValue &yEdge = aPositionY.GetArrayValue()->Item(0);
const nsCSSValue &yOffset = aPositionY.GetArrayValue()->Item(1);
bool xHasEdge = (eCSSUnit_Enumerated == xEdge.GetUnit());
bool xHasBoth = xHasEdge && (eCSSUnit_Null != xOffset.GetUnit());
bool yHasEdge = (eCSSUnit_Enumerated == yEdge.GetUnit());
bool yHasBoth = yHasEdge && (eCSSUnit_Null != yOffset.GetUnit());
if (yHasBoth && !xHasEdge) {
// Output 4-value form by adding the x edge.
aValue.AppendLiteral("left ");
}
aPositionX.AppendToString(aTable[nsStyleImageLayers::positionX],
aValue, aSerialization);
aValue.Append(char16_t(' '));
if (xHasBoth && !yHasEdge) {
// Output 4-value form by adding the y edge.
aValue.AppendLiteral("top ");
}
aPositionY.AppendToString(aTable[nsStyleImageLayers::positionY],
aValue, aSerialization);
}
void
Declaration::GetImageLayerValue(
nsCSSCompressedDataBlock *data,
@ -256,10 +221,8 @@ Declaration::GetImageLayerValue(
data->ValueFor(aTable[nsStyleImageLayers::image])->GetListValue();
const nsCSSValuePairList *repeat =
data->ValueFor(aTable[nsStyleImageLayers::repeat])->GetPairListValue();
const nsCSSValueList *positionX =
data->ValueFor(aTable[nsStyleImageLayers::positionX])->GetListValue();
const nsCSSValueList *positionY =
data->ValueFor(aTable[nsStyleImageLayers::positionY])->GetListValue();
const nsCSSValueList *position =
data->ValueFor(aTable[nsStyleImageLayers::position])->GetListValue();
const nsCSSValueList *clip =
data->ValueFor(aTable[nsStyleImageLayers::clip])->GetListValue();
const nsCSSValueList *origin =
@ -311,8 +274,8 @@ Declaration::GetImageLayerValue(
}
aValue.Append(char16_t(' '));
AppendSingleImageLayerPositionValue(positionX->mValue, positionY->mValue,
aTable, aValue, aSerialization);
position->mValue.AppendToString(aTable[nsStyleImageLayers::position],
aValue, aSerialization);
if (size->mXValue.GetUnit() != eCSSUnit_Auto ||
size->mYValue.GetUnit() != eCSSUnit_Auto) {
@ -374,8 +337,7 @@ Declaration::GetImageLayerValue(
image = image->mNext;
repeat = repeat->mNext;
positionX = positionX->mNext;
positionY = positionY->mNext;
position = position->mNext;
clip = clip->mNext;
origin = origin->mNext;
size = size->mNext;
@ -386,8 +348,7 @@ Declaration::GetImageLayerValue(
if (!image) {
// This layer is an background layer
if (aTable == nsStyleImageLayers::kBackgroundLayerTable) {
if (repeat || positionX || positionY || clip || origin || size ||
attachment) {
if (repeat || position || clip || origin || size || attachment) {
// Uneven length lists, so can't be serialized as shorthand.
aValue.Truncate();
return;
@ -399,8 +360,7 @@ Declaration::GetImageLayerValue(
#else
MOZ_ASSERT_UNREACHABLE("Should never get here when mask-as-shorthand is disable");
#endif
if (repeat || positionX || positionY || clip || origin || size ||
composite || mode) {
if (repeat || position || clip || origin || size || composite || mode) {
// Uneven length lists, so can't be serialized as shorthand.
aValue.Truncate();
return;
@ -411,8 +371,7 @@ Declaration::GetImageLayerValue(
// This layer is an background layer
if (aTable == nsStyleImageLayers::kBackgroundLayerTable) {
if (!repeat || !positionX || !positionY || !clip || !origin || !size ||
!attachment) {
if (!repeat || !position || !clip || !origin || !size || !attachment) {
// Uneven length lists, so can't be serialized as shorthand.
aValue.Truncate();
return;
@ -424,7 +383,7 @@ Declaration::GetImageLayerValue(
#else
MOZ_ASSERT_UNREACHABLE("Should never get here when mask-as-shorthand is disable");
#endif
if (!repeat || !positionX || !positionY || !clip || !origin || !size ||
if (!repeat || !position || !clip || !origin || !size ||
!composite || !mode) {
// Uneven length lists, so can't be serialized as shorthand.
aValue.Truncate();
@ -436,39 +395,6 @@ Declaration::GetImageLayerValue(
}
}
void
Declaration::GetImageLayerPositionValue(
nsCSSCompressedDataBlock *data,
nsAString& aValue,
nsCSSValue::Serialization aSerialization,
const nsCSSProperty aTable[]) const
{
// We know from above that all subproperties were specified.
// However, we still can't represent that in the shorthand unless
// they're all lists of the same length. So if they're different
// lengths, we need to bail out.
const nsCSSValueList *positionX =
data->ValueFor(aTable[nsStyleImageLayers::positionX])->GetListValue();
const nsCSSValueList *positionY =
data->ValueFor(aTable[nsStyleImageLayers::positionY])->GetListValue();
for (;;) {
AppendSingleImageLayerPositionValue(positionX->mValue, positionY->mValue,
aTable, aValue, aSerialization);
positionX = positionX->mNext;
positionY = positionY->mNext;
if (!positionX || !positionY) {
if (positionX || positionY) {
// Uneven length lists, so can't be serialized as shorthand.
aValue.Truncate();
}
return;
}
aValue.Append(char16_t(','));
aValue.Append(char16_t(' '));
}
}
void
Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
nsCSSValue::Serialization aSerialization) const
@ -743,22 +669,12 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue,
nsStyleImageLayers::kBackgroundLayerTable);
break;
}
case eCSSProperty_background_position: {
GetImageLayerPositionValue(data, aValue, aSerialization,
nsStyleImageLayers::kBackgroundLayerTable);
break;
}
#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
case eCSSProperty_mask: {
GetImageLayerValue(data, aValue, aSerialization,
nsStyleImageLayers::kMaskLayerTable);
break;
}
case eCSSProperty_mask_position: {
GetImageLayerPositionValue(data, aValue, aSerialization,
nsStyleImageLayers::kMaskLayerTable);
break;
}
#endif
case eCSSProperty_font: {
// systemFont might not be present; other values are guaranteed to be

Просмотреть файл

@ -375,11 +375,6 @@ private:
nsCSSValue::Serialization aSerialization,
const nsCSSProperty aTable[]) const;
void GetImageLayerPositionValue(nsCSSCompressedDataBlock *data,
nsAString& aValue,
nsCSSValue::Serialization aSerialization,
const nsCSSProperty aTable[]) const;
public:
/**
* Returns the property at the given index in the ordered list of

Просмотреть файл

@ -449,32 +449,6 @@ CalcPositionSquareDistance(const nsCSSValue& aPos1,
return squareDistance;
}
static PixelCalcValue
CalcBackgroundCoord(const nsCSSValue& aCoord)
{
NS_ASSERTION(aCoord.GetUnit() == eCSSUnit_Array,
"Expected array");
nsCSSValue::Array* array = aCoord.GetArrayValue();
MOZ_ASSERT(array->Count() == 2 &&
array->Item(0).GetUnit() == eCSSUnit_Null &&
array->Item(1).GetUnit() != eCSSUnit_Null,
"Invalid position value");
return ExtractCalcValue(array->Item(1));
}
double
CalcPositionCoordSquareDistance(const nsCSSValue& aPos1,
const nsCSSValue& aPos2)
{
PixelCalcValue calcVal1 = CalcBackgroundCoord(aPos1);
PixelCalcValue calcVal2 = CalcBackgroundCoord(aPos2);
float difflen = calcVal2.mLength - calcVal1.mLength;
float diffpct = calcVal2.mPercent - calcVal1.mPercent;
return difflen * difflen + diffpct * diffpct;
}
// CLASS METHODS
// -------------
@ -870,7 +844,7 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty,
case eUnit_Transform: {
return false;
}
case eUnit_BackgroundPositionCoord: {
case eUnit_BackgroundPosition: {
const nsCSSValueList *position1 = aStartValue.GetCSSValueListValue();
const nsCSSValueList *position2 = aEndValue.GetCSSValueListValue();
@ -878,8 +852,8 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty,
MOZ_ASSERT(!position1 == !position2, "lists should be same length");
while (position1 && position2) {
squareDistance += CalcPositionCoordSquareDistance(position1->mValue,
position2->mValue);
squareDistance += CalcPositionSquareDistance(position1->mValue,
position2->mValue);
position1 = position1->mNext;
position2 = position2->mNext;
}
@ -2217,26 +2191,6 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1,
return result.forget();
}
static void
AddPositionCoords(double aCoeff1, const nsCSSValue& aPos1,
double aCoeff2, const nsCSSValue& aPos2,
nsCSSValue& aResultPos)
{
const nsCSSValue::Array* posArray1 = aPos1.GetArrayValue();
const nsCSSValue::Array* posArray2 = aPos2.GetArrayValue();
nsCSSValue::Array* resultPosArray = nsCSSValue::Array::Create(2);
aResultPos.SetArrayValue(resultPosArray, eCSSUnit_Array);
/* Only compute element 1. The <position-coord> is
* 'uncomputed' to only that element.
*/
const nsCSSValue& v1 = posArray1->Item(1);
const nsCSSValue& v2 = posArray2->Item(1);
nsCSSValue& vr = resultPosArray->Item(1);
AddCSSValueCanonicalCalc(aCoeff1, v1,
aCoeff2, v2, vr);
}
bool
StyleAnimationValue::AddWeighted(nsCSSProperty aProperty,
double aCoeff1,
@ -2711,7 +2665,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty,
aResultValue.SetTransformValue(new nsCSSValueSharedList(result.forget()));
return true;
}
case eUnit_BackgroundPositionCoord: {
case eUnit_BackgroundPosition: {
const nsCSSValueList *position1 = aValue1.GetCSSValueListValue();
const nsCSSValueList *position2 = aValue2.GetCSSValueListValue();
nsAutoPtr<nsCSSValueList> result;
@ -2721,8 +2675,8 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty,
*resultTail = item;
resultTail = &item->mNext;
AddPositionCoords(aCoeff1, position1->mValue,
aCoeff2, position2->mValue, item->mValue);
AddPositions(aCoeff1, position1->mValue,
aCoeff2, position2->mValue, item->mValue);
position1 = position1->mNext;
position2 = position2->mNext;
@ -2734,7 +2688,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty,
}
aResultValue.SetAndAdoptCSSValueListValue(result.forget(),
eUnit_BackgroundPositionCoord);
eUnit_BackgroundPosition);
return true;
}
case eUnit_CSSValuePairList: {
@ -3103,7 +3057,7 @@ StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty,
case eUnit_Dasharray:
case eUnit_Shadow:
case eUnit_Filter:
case eUnit_BackgroundPositionCoord:
case eUnit_BackgroundPosition:
{
nsCSSValueList* computedList = aComputedValue.GetCSSValueListValue();
if (computedList) {
@ -3142,7 +3096,7 @@ StyleAnimationValue::UncomputeValue(nsCSSProperty aProperty,
case eUnit_Dasharray:
case eUnit_Shadow:
case eUnit_Filter:
case eUnit_BackgroundPositionCoord:
case eUnit_BackgroundPosition:
{
UniquePtr<nsCSSValueList> computedList =
aComputedValue.TakeCSSValueListValue();
@ -3322,23 +3276,6 @@ SetPositionValue(const nsStyleImageLayers::Position& aPos, nsCSSValue& aCSSValue
SetCalcValue(&aPos.mYPosition, yValue);
}
static void
SetPositionCoordValue(const nsStyleImageLayers::Position::PositionCoord& aPosCoord,
nsCSSValue& aCSSValue)
{
RefPtr<nsCSSValue::Array> posArray = nsCSSValue::Array::Create(2);
aCSSValue.SetArrayValue(posArray.get(), eCSSUnit_Array);
// NOTE: Array entry #0 here is intentionally left untouched, with
// eCSSUnit_Null. The purpose of this entry in our specified-style
// <position-coord> representation is to store edge names. But for values
// extracted from computed style (which is what we're dealing with here),
// we'll just have a normalized "x"/"y" position, with no edge names needed.
nsCSSValue& value = posArray->Item(1);
SetCalcValue(&aPosCoord, value);
}
/*
* Assign |aOutput = aInput|, except with any non-pixel lengths
* replaced with the equivalent in pixels, and any non-canonical calc()
@ -3382,43 +3319,22 @@ SubstitutePixelValues(nsStyleContext* aStyleContext,
}
static void
ExtractImageLayerPositionXList(const nsStyleImageLayers& aLayer,
StyleAnimationValue& aComputedValue)
ExtractImageLayerPositionList(const nsStyleImageLayers& aLayer,
StyleAnimationValue& aComputedValue)
{
MOZ_ASSERT(aLayer.mPositionXCount > 0, "unexpected count");
MOZ_ASSERT(aLayer.mPositionCount > 0, "unexpected count");
nsAutoPtr<nsCSSValueList> result;
nsCSSValueList **resultTail = getter_Transfers(result);
for (uint32_t i = 0, i_end = aLayer.mPositionXCount; i != i_end; ++i) {
for (uint32_t i = 0, i_end = aLayer.mPositionCount; i != i_end; ++i) {
nsCSSValueList *item = new nsCSSValueList;
*resultTail = item;
resultTail = &item->mNext;
SetPositionCoordValue(aLayer.mLayers[i].mPosition.mXPosition,
item->mValue);
SetPositionValue(aLayer.mLayers[i].mPosition, item->mValue);
}
aComputedValue.SetAndAdoptCSSValueListValue(result.forget(),
StyleAnimationValue::eUnit_BackgroundPositionCoord);
}
static void
ExtractImageLayerPositionYList(const nsStyleImageLayers& aLayer,
StyleAnimationValue& aComputedValue)
{
MOZ_ASSERT(aLayer.mPositionYCount > 0, "unexpected count");
nsAutoPtr<nsCSSValueList> result;
nsCSSValueList **resultTail = getter_Transfers(result);
for (uint32_t i = 0, i_end = aLayer.mPositionYCount; i != i_end; ++i) {
nsCSSValueList *item = new nsCSSValueList;
*resultTail = item;
resultTail = &item->mNext;
SetPositionCoordValue(aLayer.mLayers[i].mPosition.mYPosition,
item->mValue);
}
aComputedValue.SetAndAdoptCSSValueListValue(result.forget(),
StyleAnimationValue::eUnit_BackgroundPositionCoord);
StyleAnimationValue::eUnit_BackgroundPosition);
}
static void
@ -3905,34 +3821,17 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
break;
}
case eCSSProperty_background_position_x: {
case eCSSProperty_background_position: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleBackground*>(styleStruct)->mImage;
ExtractImageLayerPositionXList(layers, aComputedValue);
ExtractImageLayerPositionList(layers, aComputedValue);
break;
}
case eCSSProperty_background_position_y: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleBackground*>(styleStruct)->mImage;
ExtractImageLayerPositionYList(layers, aComputedValue);
break;
}
#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
case eCSSProperty_mask_position_x: {
case eCSSProperty_mask_position: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleSVGReset*>(styleStruct)->mMask;
ExtractImageLayerPositionXList(layers, aComputedValue);
break;
}
case eCSSProperty_mask_position_y: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleSVGReset*>(styleStruct)->mMask;
ExtractImageLayerPositionYList(layers, aComputedValue);
ExtractImageLayerPositionList(layers, aComputedValue);
break;
}
#endif
@ -4349,7 +4248,7 @@ StyleAnimationValue::operator=(const StyleAnimationValue& aOther)
case eUnit_Dasharray:
case eUnit_Shadow:
case eUnit_Filter:
case eUnit_BackgroundPositionCoord:
case eUnit_BackgroundPosition:
MOZ_ASSERT(mUnit == eUnit_Shadow || mUnit == eUnit_Filter ||
aOther.mValue.mCSSValueList,
"value lists other than shadows and filters may not be null");
@ -4613,7 +4512,7 @@ StyleAnimationValue::operator==(const StyleAnimationValue& aOther) const
case eUnit_Dasharray:
case eUnit_Shadow:
case eUnit_Filter:
case eUnit_BackgroundPositionCoord:
case eUnit_BackgroundPosition:
return nsCSSValueList::Equal(mValue.mCSSValueList,
aOther.mValue.mCSSValueList);
case eUnit_Shape:

Просмотреть файл

@ -285,7 +285,7 @@ public:
eUnit_Shape, // nsCSSValue::Array* (never null)
eUnit_Filter, // nsCSSValueList* (may be null)
eUnit_Transform, // nsCSSValueList* (never null)
eUnit_BackgroundPositionCoord, // nsCSSValueList* (never null)
eUnit_BackgroundPosition, // nsCSSValueList* (never null)
eUnit_CSSValuePairList, // nsCSSValuePairList* (never null)
eUnit_UnparsedString // nsStringBuffer* (never null)
};
@ -486,7 +486,7 @@ private:
static bool IsCSSValueListUnit(Unit aUnit) {
return aUnit == eUnit_Dasharray || aUnit == eUnit_Filter ||
aUnit == eUnit_Shadow ||
aUnit == eUnit_BackgroundPositionCoord;
aUnit == eUnit_BackgroundPosition;
}
static bool IsCSSValueSharedListValue(Unit aUnit) {
return aUnit == eUnit_Transform;

Просмотреть файл

@ -865,22 +865,19 @@ protected:
nsCSSValueList* mAttachment; // A property for background layer only
nsCSSValueList* mClip;
nsCSSValueList* mOrigin;
nsCSSValueList* mPositionX;
nsCSSValueList* mPositionY;
nsCSSValueList* mPosition;
nsCSSValuePairList* mSize;
nsCSSValueList* mComposite; // A property for mask layer only
nsCSSValueList* mMode; // A property for mask layer only
ImageLayersShorthandParseState(
nsCSSValue& aColor, nsCSSValueList* aImage, nsCSSValuePairList* aRepeat,
nsCSSValueList* aAttachment, nsCSSValueList* aClip,
nsCSSValueList* aOrigin,
nsCSSValueList* aPositionX, nsCSSValueList* aPositionY,
nsCSSValueList* aOrigin, nsCSSValueList* aPosition,
nsCSSValuePairList* aSize, nsCSSValueList* aComposite,
nsCSSValueList* aMode) :
mColor(aColor), mImage(aImage), mRepeat(aRepeat),
mAttachment(aAttachment), mClip(aClip), mOrigin(aOrigin),
mPositionX(aPositionX), mPositionY(aPositionY),
mSize(aSize), mComposite(aComposite),
mPosition(aPosition), mSize(aSize), mComposite(aComposite),
mMode(aMode) {};
};
@ -891,8 +888,7 @@ protected:
bool ParseValueList(nsCSSProperty aPropID); // a single value prop-id
bool ParseImageLayerRepeat(nsCSSProperty aPropID);
bool ParseImageLayerRepeatValues(nsCSSValuePair& aValue);
bool ParseImageLayerPosition(const nsCSSProperty aTable[]);
bool ParseImageLayerPositionCoord(nsCSSProperty aPropID, bool aIsHorizontal);
bool ParseImageLayerPosition(nsCSSProperty aPropID);
// ParseBoxPositionValues parses the CSS 2.1 background-position syntax,
// which is still used by some properties. See ParsePositionValue
@ -903,9 +899,7 @@ protected:
// ParsePositionValue parses a CSS <position> value, which is used by
// the 'background-position' property.
bool ParsePositionValue(nsCSSValue& aOut);
bool ParsePositionValueSeparateCoords(nsCSSValue& aOutX, nsCSSValue& aOutY);
bool ParseImageLayerPositionCoordItem(nsCSSValue& aOut, bool aIsHorizontal);
bool ParseImageLayerSize(nsCSSProperty aPropID);
bool ParseImageLayerSizeValues(nsCSSValuePair& aOut);
bool ParseBorderColor();
@ -11432,11 +11426,7 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID)
case eCSSProperty_background_repeat:
return ParseImageLayerRepeat(eCSSProperty_background_repeat);
case eCSSProperty_background_position:
return ParseImageLayerPosition(nsStyleImageLayers::kBackgroundLayerTable);
case eCSSProperty_background_position_x:
case eCSSProperty_background_position_y:
return ParseImageLayerPositionCoord(aPropID,
aPropID == eCSSProperty_background_position_x);
return ParseImageLayerPosition(eCSSProperty_background_position);
case eCSSProperty_background_size:
return ParseImageLayerSize(eCSSProperty_background_size);
case eCSSProperty_border:
@ -11618,11 +11608,7 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID)
case eCSSProperty_mask_repeat:
return ParseImageLayerRepeat(eCSSProperty_mask_repeat);
case eCSSProperty_mask_position:
return ParseImageLayerPosition(nsStyleImageLayers::kMaskLayerTable);
case eCSSProperty_mask_position_x:
case eCSSProperty_mask_position_y:
return ParseImageLayerPositionCoord(aPropID,
aPropID == eCSSProperty_mask_position_x);
return ParseImageLayerPosition(eCSSProperty_mask_position);
case eCSSProperty_mask_size:
return ParseImageLayerSize(eCSSProperty_mask_size);
#endif
@ -11903,13 +11889,12 @@ CSSParserImpl::ParseImageLayers(const nsCSSProperty aTable[])
return true;
}
nsCSSValue image, repeat, attachment, clip, origin, positionX, positionY, size,
nsCSSValue image, repeat, attachment, clip, origin, position, size,
composite, maskMode;
ImageLayersShorthandParseState state(color, image.SetListValue(),
repeat.SetPairListValue(),
attachment.SetListValue(), clip.SetListValue(),
origin.SetListValue(),
positionX.SetListValue(), positionY.SetListValue(),
origin.SetListValue(), position.SetListValue(),
size.SetPairListValue(), composite.SetListValue(),
maskMode.SetListValue());
@ -11943,9 +11928,7 @@ CSSParserImpl::ParseImageLayers(const nsCSSProperty aTable[])
nsCSSValueList);
APPENDNEXT(nsStyleImageLayers::origin, state.mOrigin,
nsCSSValueList);
APPENDNEXT(nsStyleImageLayers::positionX, state.mPositionX,
nsCSSValueList);
APPENDNEXT(nsStyleImageLayers::positionY, state.mPositionY,
APPENDNEXT(nsStyleImageLayers::position, state.mPosition,
nsCSSValueList);
APPENDNEXT(nsStyleImageLayers::size, state.mSize,
nsCSSValuePairList);
@ -11974,8 +11957,7 @@ CSSParserImpl::ParseImageLayers(const nsCSSProperty aTable[])
APPENDVALUE(aTable[nsStyleImageLayers::repeat], repeat);
APPENDVALUE(aTable[nsStyleImageLayers::clip], clip);
APPENDVALUE(aTable[nsStyleImageLayers::origin], origin);
APPENDVALUE(aTable[nsStyleImageLayers::positionX], positionX);
APPENDVALUE(aTable[nsStyleImageLayers::positionY], positionY);
APPENDVALUE(aTable[nsStyleImageLayers::position], position);
APPENDVALUE(aTable[nsStyleImageLayers::size], size);
APPENDVALUE(aTable[nsStyleImageLayers::color], color);
APPENDVALUE(aTable[nsStyleImageLayers::attachment], attachment);
@ -12034,13 +12016,10 @@ CSSParserImpl::ParseImageLayersItem(
eCSSUnit_Enumerated);
aState.mOrigin->mValue.SetIntValue(NS_STYLE_IMAGELAYER_ORIGIN_PADDING,
eCSSUnit_Enumerated);
RefPtr<nsCSSValue::Array> positionXArr = nsCSSValue::Array::Create(2);
RefPtr<nsCSSValue::Array> positionYArr = nsCSSValue::Array::Create(2);
aState.mPositionX->mValue.SetArrayValue(positionXArr, eCSSUnit_Array);
aState.mPositionY->mValue.SetArrayValue(positionYArr, eCSSUnit_Array);
positionXArr->Item(1).SetPercentValue(0.0f);
positionYArr->Item(1).SetPercentValue(0.0f);
RefPtr<nsCSSValue::Array> positionArr = nsCSSValue::Array::Create(4);
aState.mPosition->mValue.SetArrayValue(positionArr, eCSSUnit_Array);
positionArr->Item(1).SetPercentValue(0.0f);
positionArr->Item(3).SetPercentValue(0.0f);
aState.mSize->mXValue.SetAutoValue();
aState.mSize->mYValue.SetAutoValue();
aState.mComposite->mValue.SetIntValue(NS_STYLE_MASK_COMPOSITE_ADD,
@ -12113,9 +12092,7 @@ CSSParserImpl::ParseImageLayersItem(
if (havePositionAndSize)
return false;
havePositionAndSize = true;
if (!ParsePositionValueSeparateCoords(aState.mPositionX->mValue,
aState.mPositionY->mValue)) {
if (!ParsePositionValue(aState.mPosition->mValue)) {
return false;
}
if (ExpectSymbol('/', true)) {
@ -12227,8 +12204,7 @@ CSSParserImpl::ParseImageLayersItem(
if (havePositionAndSize)
return false;
havePositionAndSize = true;
if (!ParsePositionValueSeparateCoords(aState.mPositionX->mValue,
aState.mPositionY->mValue)) {
if (!ParsePositionValue(aState.mPosition->mValue)) {
return false;
}
if (ExpectSymbol('/', true)) {
@ -12337,54 +12313,16 @@ CSSParserImpl::ParseImageLayerRepeatValues(nsCSSValuePair& aValue)
return false;
}
// This function is very similar to ParseScrollSnapCoordinate,
// ParseImageLayers, ParseImageLayerSize.
bool
CSSParserImpl::ParseImageLayerPosition(const nsCSSProperty aTable[])
{
// 'initial', 'inherit' and 'unset' stand alone, no list permitted.
nsCSSValue position;
if (ParseSingleTokenVariant(position, VARIANT_INHERIT, nullptr)) {
AppendValue(aTable[nsStyleImageLayers::positionX], position);
AppendValue(aTable[nsStyleImageLayers::positionY], position);
return true;
}
nsCSSValue itemValueX;
nsCSSValue itemValueY;
if (!ParsePositionValueSeparateCoords(itemValueX, itemValueY)) {
return false;
}
nsCSSValue valueX;
nsCSSValue valueY;
nsCSSValueList* itemX = valueX.SetListValue();
nsCSSValueList* itemY = valueY.SetListValue();
for (;;) {
itemX->mValue = itemValueX;
itemY->mValue = itemValueY;
if (!ExpectSymbol(',', true)) {
break;
}
if (!ParsePositionValueSeparateCoords(itemValueX, itemValueY)) {
return false;
}
itemX->mNext = new nsCSSValueList;
itemY->mNext = new nsCSSValueList;
itemX = itemX->mNext;
itemY = itemY->mNext;
}
AppendValue(aTable[nsStyleImageLayers::positionX], valueX);
AppendValue(aTable[nsStyleImageLayers::positionY], valueY);
return true;
}
bool
CSSParserImpl::ParseImageLayerPositionCoord(nsCSSProperty aPropID, bool aIsHorizontal)
CSSParserImpl::ParseImageLayerPosition(nsCSSProperty aPropID)
{
nsCSSValue value;
// 'initial', 'inherit' and 'unset' stand alone, no list permitted.
if (!ParseSingleTokenVariant(value, VARIANT_INHERIT, nullptr)) {
nsCSSValue itemValue;
if (!ParseImageLayerPositionCoordItem(itemValue, aIsHorizontal)) {
if (!ParsePositionValue(itemValue)) {
return false;
}
nsCSSValueList* item = value.SetListValue();
@ -12393,7 +12331,7 @@ CSSParserImpl::ParseImageLayerPositionCoord(nsCSSProperty aPropID, bool aIsHoriz
if (!ExpectSymbol(',', true)) {
break;
}
if (!ParseImageLayerPositionCoordItem(itemValue, aIsHorizontal)) {
if (!ParsePositionValue(itemValue)) {
return false;
}
item->mNext = new nsCSSValueList;
@ -12693,80 +12631,6 @@ CSSParserImpl::ParsePositionValue(nsCSSValue& aOut)
return true;
}
bool
CSSParserImpl::ParsePositionValueSeparateCoords(nsCSSValue& aOutX, nsCSSValue& aOutY)
{
nsCSSValue scratch;
if (!ParsePositionValue(scratch)) {
return false;
}
// Separate the four values into two pairs of two values for X and Y.
RefPtr<nsCSSValue::Array> valueX = nsCSSValue::Array::Create(2);
RefPtr<nsCSSValue::Array> valueY = nsCSSValue::Array::Create(2);
aOutX.SetArrayValue(valueX, eCSSUnit_Array);
aOutY.SetArrayValue(valueY, eCSSUnit_Array);
RefPtr<nsCSSValue::Array> value = scratch.GetArrayValue();
valueX->Item(0) = value->Item(0);
valueX->Item(1) = value->Item(1);
valueY->Item(0) = value->Item(2);
valueY->Item(1) = value->Item(3);
return true;
}
// Parses one item in a list of values for the 'background-position-x' or
// 'background-position-y' property. Does not support the start/end keywords.
// Spec reference: https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-x
bool
CSSParserImpl::ParseImageLayerPositionCoordItem(nsCSSValue& aOut, bool aIsHorizontal)
{
RefPtr<nsCSSValue::Array> value = nsCSSValue::Array::Create(2);
aOut.SetArrayValue(value, eCSSUnit_Array);
nsCSSValue &edge = value->Item(0),
&offset = value->Item(1);
nsCSSValue edgeOrOffset;
CSSParseResult result =
ParseVariant(edgeOrOffset, VARIANT_LPCALC | VARIANT_KEYWORD,
nsCSSProps::kImageLayerPositionKTable);
if (result != CSSParseResult::Ok) {
return false;
}
if (edgeOrOffset.GetUnit() == eCSSUnit_Enumerated) {
edge = edgeOrOffset;
// The edge can be followed by an optional offset.
result = ParseVariant(offset, VARIANT_LPCALC, nullptr);
if (result == CSSParseResult::Error) {
return false;
}
} else {
offset = edgeOrOffset;
}
// Keywords for horizontal properties cannot be vertical keywords, and
// keywords for vertical properties cannot be horizontal keywords.
// Also, if an offset is specified, the edge cannot be center.
int32_t edgeEnum =
edge.GetUnit() == eCSSUnit_Enumerated ? edge.GetIntValue() : 0;
int32_t allowedKeywords =
(aIsHorizontal ? (BG_LEFT | BG_RIGHT) : (BG_TOP | BG_BOTTOM)) |
(offset.GetUnit() == eCSSUnit_Null ? BG_CENTER : 0);
if (edgeEnum & ~allowedKeywords) {
return false;
}
NS_ASSERTION((eCSSUnit_Enumerated == edge.GetUnit() ||
eCSSUnit_Null == edge.GetUnit()) &&
eCSSUnit_Enumerated != offset.GetUnit(),
"Unexpected units");
return true;
}
// This function is very similar to ParseScrollSnapCoordinate,
// ParseImageLayers, and ParseImageLayerPosition.
bool

Просмотреть файл

@ -383,14 +383,6 @@ CSS_PROP_ALIAS(-webkit-mask-position,
mask_position,
WebkitMaskPosition,
WEBKIT_PREFIX_PREF)
CSS_PROP_ALIAS(-webkit-mask-position-x,
mask_position_x,
WebkitMaskPositionX,
WEBKIT_PREFIX_PREF)
CSS_PROP_ALIAS(-webkit-mask-position-y,
mask_position_y,
WebkitMaskPositionY,
WEBKIT_PREFIX_PREF)
CSS_PROP_ALIAS(-webkit-mask-repeat,
mask_repeat,
WebkitMaskRepeat,

Просмотреть файл

@ -567,35 +567,15 @@ CSS_PROP_BACKGROUND(
kImageLayerOriginKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_SHORTHAND(
CSS_PROP_BACKGROUND(
background-position,
background_position,
BackgroundPosition,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
"")
CSS_PROP_BACKGROUND(
background-position-x,
background_position_x,
BackgroundPositionX,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
CSS_PROPERTY_VALUE_LIST_USES_COMMAS |
CSS_PROPERTY_STORES_CALC,
"",
0,
kImageLayerPositionKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_Custom)
CSS_PROP_BACKGROUND(
background-position-y,
background_position_y,
BackgroundPositionY,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
CSS_PROPERTY_VALUE_LIST_USES_COMMAS |
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
CSS_PROPERTY_STORES_CALC,
"",
0,
@ -2734,29 +2714,10 @@ CSS_PROP_SVGRESET(
kImageLayerOriginKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_SHORTHAND(
CSS_PROP_SVGRESET(
mask-position,
mask_position,
MaskPosition,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
"")
CSS_PROP_SVGRESET(
mask-position-x,
mask_position_x,
MaskPositionX,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_VALUE_LIST_USES_COMMAS |
CSS_PROPERTY_STORES_CALC,
"",
0,
kImageLayerPositionKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_Custom)
CSS_PROP_SVGRESET(
mask-position-y,
mask_position_y,
MaskPositionY,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_VALUE_LIST_USES_COMMAS |
CSS_PROPERTY_STORES_CALC,

Просмотреть файл

@ -2625,20 +2625,13 @@ static const nsCSSProperty gBackgroundSubpropTable[] = {
eCSSProperty_background_image,
eCSSProperty_background_repeat,
eCSSProperty_background_attachment,
eCSSProperty_background_position,
eCSSProperty_background_clip,
eCSSProperty_background_origin,
eCSSProperty_background_position_x,
eCSSProperty_background_position_y,
eCSSProperty_background_size,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBackgroundPositionSubpropTable[] = {
eCSSProperty_background_position_x,
eCSSProperty_background_position_y,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gBorderSubpropTable[] = {
eCSSProperty_border_top_width,
eCSSProperty_border_right_width,
@ -2972,8 +2965,7 @@ static const nsCSSProperty gScrollSnapTypeSubpropTable[] = {
static const nsCSSProperty gMaskSubpropTable[] = {
eCSSProperty_mask_image,
eCSSProperty_mask_repeat,
eCSSProperty_mask_position_x,
eCSSProperty_mask_position_y,
eCSSProperty_mask_position,
eCSSProperty_mask_clip,
eCSSProperty_mask_origin,
eCSSProperty_mask_size,
@ -2981,11 +2973,6 @@ static const nsCSSProperty gMaskSubpropTable[] = {
eCSSProperty_mask_mode,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMaskPositionSubpropTable[] = {
eCSSProperty_mask_position_x,
eCSSProperty_mask_position_y,
eCSSProperty_UNKNOWN
};
#endif
// FIXME: mask-border tables should be added when we implement
// mask-border properties.

Просмотреть файл

@ -934,7 +934,7 @@ nsCSSValue::AppendCircleOrEllipseToString(nsCSSKeyword aFunctionId,
aResult.Append(' ');
}
aResult.AppendLiteral("at ");
array->Item(count).AppendToString(eCSSProperty_object_position,
array->Item(count).AppendToString(eCSSProperty_background_position,
aResult, aSerialization);
}
@ -1549,12 +1549,12 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
aResult.AppendLiteral("to");
if (!(gradient->mBgPos.mXValue.GetIntValue() & NS_STYLE_IMAGELAYER_POSITION_CENTER)) {
aResult.Append(' ');
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position_x,
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position,
aResult, aSerialization);
}
if (!(gradient->mBgPos.mYValue.GetIntValue() & NS_STYLE_IMAGELAYER_POSITION_CENTER)) {
aResult.Append(' ');
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position_y,
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position,
aResult, aSerialization);
}
needSep = true;
@ -1572,12 +1572,12 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult,
aResult.AppendLiteral("at ");
}
if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None) {
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position_x,
gradient->mBgPos.mXValue.AppendToString(eCSSProperty_background_position,
aResult, aSerialization);
aResult.Append(' ');
}
if (gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None) {
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position_y,
gradient->mBgPos.mYValue.AppendToString(eCSSProperty_background_position,
aResult, aSerialization);
aResult.Append(' ');
}

Просмотреть файл

@ -2159,14 +2159,9 @@ nsComputedDOMStyle::DoGetImageLayerImage(const nsStyleImageLayers& aLayers)
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetImageLayerPosition(const nsStyleImageLayers& aLayers)
{
if (aLayers.mPositionXCount != aLayers.mPositionYCount) {
// No value to return. We can't express this combination of
// values as a shorthand.
return nullptr;
}
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
for (uint32_t i = 0, i_end = aLayers.mPositionXCount; i < i_end; ++i) {
for (uint32_t i = 0, i_end = aLayers.mPositionCount; i < i_end; ++i) {
RefPtr<nsDOMCSSValueList> itemList = GetROCSSValueList(false);
SetValueToPosition(aLayers.mLayers[i].mPosition, itemList);
@ -2176,32 +2171,6 @@ nsComputedDOMStyle::DoGetImageLayerPosition(const nsStyleImageLayers& aLayers)
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetImageLayerPositionX(const nsStyleImageLayers& aLayers)
{
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
for (uint32_t i = 0, i_end = aLayers.mPositionXCount; i < i_end; ++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToPositionCoord(aLayers.mLayers[i].mPosition.mXPosition, val);
valueList->AppendCSSValue(val.forget());
}
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetImageLayerPositionY(const nsStyleImageLayers& aLayers)
{
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(true);
for (uint32_t i = 0, i_end = aLayers.mPositionYCount; i < i_end; ++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
SetValueToPositionCoord(aLayers.mLayers[i].mPosition.mYPosition, val);
valueList->AppendCSSValue(val.forget());
}
return valueList.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetImageLayerRepeat(const nsStyleImageLayers& aLayers)
{
@ -2391,20 +2360,6 @@ nsComputedDOMStyle::DoGetBackgroundPosition()
return DoGetImageLayerPosition(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundPositionX()
{
const nsStyleImageLayers& layers = StyleBackground()->mImage;
return DoGetImageLayerPositionX(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundPositionY()
{
const nsStyleImageLayers& layers = StyleBackground()->mImage;
return DoGetImageLayerPositionY(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundRepeat()
{
@ -6163,20 +6118,6 @@ nsComputedDOMStyle::DoGetMaskPosition()
return DoGetImageLayerPosition(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskPositionX()
{
const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
return DoGetImageLayerPositionX(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskPositionY()
{
const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
return DoGetImageLayerPositionY(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskRepeat()
{

Просмотреть файл

@ -288,8 +288,6 @@ private:
/* StyleImageLayer properties */
already_AddRefed<CSSValue> DoGetImageLayerImage(const nsStyleImageLayers& aLayers);
already_AddRefed<CSSValue> DoGetImageLayerPosition(const nsStyleImageLayers& aLayers);
already_AddRefed<CSSValue> DoGetImageLayerPositionX(const nsStyleImageLayers& aLayers);
already_AddRefed<CSSValue> DoGetImageLayerPositionY(const nsStyleImageLayers& aLayers);
already_AddRefed<CSSValue> DoGetImageLayerRepeat(const nsStyleImageLayers& aLayers);
already_AddRefed<CSSValue> DoGetImageLayerSize(const nsStyleImageLayers& aLayers);
@ -298,8 +296,6 @@ private:
already_AddRefed<CSSValue> DoGetBackgroundColor();
already_AddRefed<CSSValue> DoGetBackgroundImage();
already_AddRefed<CSSValue> DoGetBackgroundPosition();
already_AddRefed<CSSValue> DoGetBackgroundPositionX();
already_AddRefed<CSSValue> DoGetBackgroundPositionY();
already_AddRefed<CSSValue> DoGetBackgroundRepeat();
already_AddRefed<CSSValue> DoGetBackgroundClip();
already_AddRefed<CSSValue> DoGetBackgroundBlendMode();
@ -311,8 +307,6 @@ private:
#ifdef MOZ_ENABLE_MASK_AS_SHORTHAND
already_AddRefed<CSSValue> DoGetMaskImage();
already_AddRefed<CSSValue> DoGetMaskPosition();
already_AddRefed<CSSValue> DoGetMaskPositionX();
already_AddRefed<CSSValue> DoGetMaskPositionY();
already_AddRefed<CSSValue> DoGetMaskRepeat();
already_AddRefed<CSSValue> DoGetMaskClip();
already_AddRefed<CSSValue> DoGetMaskOrigin();

Просмотреть файл

@ -60,8 +60,6 @@ COMPUTED_STYLE_PROP(background_color, BackgroundColor)
COMPUTED_STYLE_PROP(background_image, BackgroundImage)
COMPUTED_STYLE_PROP(background_origin, BackgroundOrigin)
COMPUTED_STYLE_PROP(background_position, BackgroundPosition)
COMPUTED_STYLE_PROP(background_position_x, BackgroundPositionX)
COMPUTED_STYLE_PROP(background_position_y, BackgroundPositionY)
COMPUTED_STYLE_PROP(background_repeat, BackgroundRepeat)
COMPUTED_STYLE_PROP(background_size, BackgroundSize)
//// COMPUTED_STYLE_PROP(border, Border)
@ -337,8 +335,6 @@ COMPUTED_STYLE_PROP(mask_image, MaskImage)
COMPUTED_STYLE_PROP(mask_mode, MaskMode)
COMPUTED_STYLE_PROP(mask_origin, MaskOrigin)
COMPUTED_STYLE_PROP(mask_position, MaskPosition)
COMPUTED_STYLE_PROP(mask_position_x, MaskPositionX)
COMPUTED_STYLE_PROP(mask_position_y, MaskPositionY)
COMPUTED_STYLE_PROP(mask_repeat, MaskRepeat)
COMPUTED_STYLE_PROP(mask_size, MaskSize)
#endif

Просмотреть файл

@ -178,15 +178,11 @@ nsDOMCSSAttributeDeclaration::SetPropertyValue(const nsCSSProperty aPropID,
// Scripted modifications to style.opacity or style.transform
// could immediately force us into the animated state if heuristics suggest
// this is scripted animation.
// FIXME: This is missing the margin shorthand and the logical versions of
// the margin properties, see bug 1266287.
if (aPropID == eCSSProperty_opacity || aPropID == eCSSProperty_transform ||
aPropID == eCSSProperty_left || aPropID == eCSSProperty_top ||
aPropID == eCSSProperty_right || aPropID == eCSSProperty_bottom ||
aPropID == eCSSProperty_margin_left || aPropID == eCSSProperty_margin_top ||
aPropID == eCSSProperty_margin_right || aPropID == eCSSProperty_margin_bottom ||
aPropID == eCSSProperty_background_position_x ||
aPropID == eCSSProperty_background_position_y ||
aPropID == eCSSProperty_background_position) {
nsIFrame* frame = mElement->GetPrimaryFrame();
if (frame) {

Просмотреть файл

@ -80,8 +80,6 @@ nsDOMCSSDeclaration::SetPropertyValue(const nsCSSProperty aPropID,
{
switch (aPropID) {
case eCSSProperty_background_position:
case eCSSProperty_background_position_x:
case eCSSProperty_background_position_y:
case eCSSProperty_transform:
case eCSSProperty_top:
case eCSSProperty_left:

Просмотреть файл

@ -6627,9 +6627,6 @@ ComputePositionValue(nsStyleContext* aStyleContext,
"unexpected unit for CSS <position> value");
RefPtr<nsCSSValue::Array> positionArray = aValue.GetArrayValue();
NS_ASSERTION(positionArray->Count() == 4,
"unexpected number of values in CSS <position> value");
const nsCSSValue &xEdge = positionArray->Item(0);
const nsCSSValue &xOffset = positionArray->Item(1);
const nsCSSValue &yEdge = positionArray->Item(2);
@ -6652,33 +6649,19 @@ ComputePositionValue(nsStyleContext* aStyleContext,
aConditions);
}
/* Helper function to convert the -x or -y part of a CSS <position> specified
* value into its computed-style form. */
static void
ComputePositionCoordValue(nsStyleContext* aStyleContext,
const nsCSSValue& aValue,
nsStyleImageLayers::Position::PositionCoord& aComputedValue,
RuleNodeCacheConditions& aConditions)
template <>
struct BackgroundItemComputer<nsCSSValueList, nsStyleImageLayers::Position>
{
NS_ASSERTION(aValue.GetUnit() == eCSSUnit_Array,
"unexpected unit for position coord value");
static void ComputeValue(nsStyleContext* aStyleContext,
const nsCSSValueList* aSpecifiedValue,
nsStyleImageLayers::Position& aComputedValue,
RuleNodeCacheConditions& aConditions)
{
ComputePositionValue(aStyleContext, aSpecifiedValue->mValue,
aComputedValue, aConditions);
}
};
RefPtr<nsCSSValue::Array> positionArray = aValue.GetArrayValue();
NS_ASSERTION(positionArray->Count() == 2,
"unexpected number of values, expecting one edge and one offset");
const nsCSSValue &edge = positionArray->Item(0);
const nsCSSValue &offset = positionArray->Item(1);
NS_ASSERTION((eCSSUnit_Enumerated == edge.GetUnit() ||
eCSSUnit_Null == edge.GetUnit()) &&
eCSSUnit_Enumerated != offset.GetUnit(),
"Invalid background position");
ComputePositionCoord(aStyleContext, edge, offset,
&aComputedValue,
aConditions);
}
struct BackgroundSizeAxis {
nsCSSValue nsCSSValuePairList::* specified;
@ -6844,76 +6827,6 @@ SetImageLayerList(nsStyleContext* aStyleContext,
aMaxItemCount = aItemCount;
}
// The same as SetImageLayerList, but for values stored in
// layer.mPosition.*aResultLocation instead of layer.*aResultLocation.
// This code is duplicated because it would be annoying to make
// SetImageLayerList generic enough to handle both cases.
static void
SetImageLayerPositionCoordList(
nsStyleContext* aStyleContext,
const nsCSSValue& aValue,
nsStyleAutoArray<nsStyleImageLayers::Layer>& aLayers,
const nsStyleAutoArray<nsStyleImageLayers::Layer>& aParentLayers,
nsStyleImageLayers::Position::PositionCoord
nsStyleImageLayers::Position::* aResultLocation,
nsStyleImageLayers::Position::PositionCoord aInitialValue,
uint32_t aParentItemCount,
uint32_t& aItemCount,
uint32_t& aMaxItemCount,
bool& aRebuild,
RuleNodeCacheConditions& aConditions)
{
switch (aValue.GetUnit()) {
case eCSSUnit_Null:
break;
case eCSSUnit_Inherit:
aRebuild = true;
aConditions.SetUncacheable();
aLayers.EnsureLengthAtLeast(aParentItemCount);
aItemCount = aParentItemCount;
for (uint32_t i = 0; i < aParentItemCount; ++i) {
aLayers[i].mPosition.*aResultLocation = aParentLayers[i].mPosition.*aResultLocation;
}
break;
case eCSSUnit_Initial:
case eCSSUnit_Unset:
aRebuild = true;
aItemCount = 1;
aLayers[0].mPosition.*aResultLocation = aInitialValue;
break;
case eCSSUnit_List:
case eCSSUnit_ListDep: {
aRebuild = true;
aItemCount = 0;
const nsCSSValueList* item = aValue.GetListValue();
do {
NS_ASSERTION(item->mValue.GetUnit() != eCSSUnit_Null &&
item->mValue.GetUnit() != eCSSUnit_Inherit &&
item->mValue.GetUnit() != eCSSUnit_Initial &&
item->mValue.GetUnit() != eCSSUnit_Unset,
"unexpected unit");
++aItemCount;
aLayers.EnsureLengthAtLeast(aItemCount);
ComputePositionCoordValue(aStyleContext, item->mValue,
aLayers[aItemCount-1].mPosition.*aResultLocation,
aConditions);
item = item->mNext;
} while (item);
break;
}
default:
MOZ_ASSERT(false, "unexpected unit");
}
if (aItemCount > aMaxItemCount)
aMaxItemCount = aItemCount;
}
template <class ComputedValueItem>
static void
SetImageLayerPairList(nsStyleContext* aStyleContext,
@ -6998,24 +6911,6 @@ FillBackgroundList(
}
}
// The same as FillBackgroundList, but for values stored in
// layer.mPosition.*aResultLocation instead of layer.*aResultLocation.
static void
FillBackgroundPositionCoordList(
nsStyleAutoArray<nsStyleImageLayers::Layer>& aLayers,
nsStyleImageLayers::Position::PositionCoord
nsStyleImageLayers::Position::* aResultLocation,
uint32_t aItemCount, uint32_t aFillCount)
{
NS_PRECONDITION(aFillCount <= aLayers.Length(), "unexpected array length");
for (uint32_t sourceLayer = 0, destLayer = aItemCount;
destLayer < aFillCount;
++sourceLayer, ++destLayer) {
aLayers[destLayer].mPosition.*aResultLocation =
aLayers[sourceLayer].mPosition.*aResultLocation;
}
}
const void*
nsRuleNode::ComputeBackgroundData(void* aStartStruct,
const nsRuleData* aRuleData,
@ -7100,27 +6995,15 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
bg->mImage.mOriginCount, maxItemCount, rebuild,
conditions);
// background-position-x/y: enum, length, percent (flags), inherit [list]
nsStyleImageLayers::Position::PositionCoord initialPositionCoord;
initialPositionCoord.mPercent = 0.0f;
initialPositionCoord.mLength = 0;
initialPositionCoord.mHasPercent = true;
SetImageLayerPositionCoordList(
aContext, *aRuleData->ValueForBackgroundPositionX(),
// background-position: enum, length, percent (flags), inherit [pair list]
nsStyleImageLayers::Position initialPosition;
initialPosition.SetInitialPercentValues(0.0f);
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundPosition(),
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Position::mXPosition,
initialPositionCoord, parentBG->mImage.mPositionXCount,
bg->mImage.mPositionXCount, maxItemCount, rebuild,
conditions);
SetImageLayerPositionCoordList(
aContext, *aRuleData->ValueForBackgroundPositionY(),
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Position::mYPosition,
initialPositionCoord, parentBG->mImage.mPositionYCount,
bg->mImage.mPositionYCount, maxItemCount, rebuild,
&nsStyleImageLayers::Layer::mPosition,
initialPosition, parentBG->mImage.mPositionCount,
bg->mImage.mPositionCount, maxItemCount, rebuild,
conditions);
// background-size: enum, length, auto, inherit, initial [pair list]
@ -7158,12 +7041,9 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
bg->mImage.mOriginCount, fillCount);
FillBackgroundPositionCoordList(bg->mImage.mLayers,
&nsStyleImageLayers::Position::mXPosition,
bg->mImage.mPositionXCount, fillCount);
FillBackgroundPositionCoordList(bg->mImage.mLayers,
&nsStyleImageLayers::Position::mYPosition,
bg->mImage.mPositionYCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mPosition,
bg->mImage.mPositionCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mSize,
bg->mImage.mSizeCount, fillCount);
@ -9912,27 +9792,15 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
svgReset->mMask.mOriginCount, maxItemCount, rebuild,
conditions);
// mask-position-x/y: enum, length, percent (flags), inherit [list]
nsStyleImageLayers::Position::PositionCoord initialPositionCoord;
initialPositionCoord.mPercent = 0.0f;
initialPositionCoord.mLength = 0;
initialPositionCoord.mHasPercent = true;
SetImageLayerPositionCoordList(
aContext, *aRuleData->ValueForMaskPositionX(),
// mask-position: enum, length, percent (flags), inherit [pair list]
nsStyleImageLayers::Position initialPosition;
initialPosition.SetInitialPercentValues(0.0f);
SetImageLayerList(aContext, *aRuleData->ValueForMaskPosition(),
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Position::mXPosition,
initialPositionCoord, parentSVGReset->mMask.mPositionXCount,
svgReset->mMask.mPositionXCount, maxItemCount, rebuild,
conditions);
SetImageLayerPositionCoordList(
aContext, *aRuleData->ValueForMaskPositionY(),
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Position::mYPosition,
initialPositionCoord, parentSVGReset->mMask.mPositionYCount,
svgReset->mMask.mPositionYCount, maxItemCount, rebuild,
&nsStyleImageLayers::Layer::mPosition,
initialPosition, parentSVGReset->mMask.mPositionCount,
svgReset->mMask.mPositionCount, maxItemCount, rebuild,
conditions);
// mask-size: enum, length, auto, inherit, initial [pair list]
@ -9986,12 +9854,9 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
svgReset->mMask.mOriginCount, fillCount);
FillBackgroundPositionCoordList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Position::mXPosition,
svgReset->mMask.mPositionXCount, fillCount);
FillBackgroundPositionCoordList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Position::mYPosition,
svgReset->mMask.mPositionYCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mPosition,
svgReset->mMask.mPositionCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSize,
svgReset->mMask.mSizeCount, fillCount);

Просмотреть файл

@ -2281,8 +2281,7 @@ const nsCSSProperty nsStyleImageLayers::kBackgroundLayerTable[] = {
eCSSProperty_background_color, // color
eCSSProperty_background_image, // image
eCSSProperty_background_repeat, // repeat
eCSSProperty_background_position_x, // positionX
eCSSProperty_background_position_y, // positionY
eCSSProperty_background_position, // position
eCSSProperty_background_clip, // clip
eCSSProperty_background_origin, // origin
eCSSProperty_background_size, // size
@ -2297,8 +2296,7 @@ const nsCSSProperty nsStyleImageLayers::kMaskLayerTable[] = {
eCSSProperty_UNKNOWN, // color
eCSSProperty_mask_image, // image
eCSSProperty_mask_repeat, // repeat
eCSSProperty_mask_position_x, // positionX
eCSSProperty_mask_position_y, // positionY
eCSSProperty_mask_position, // position
eCSSProperty_mask_clip, // clip
eCSSProperty_mask_origin, // origin
eCSSProperty_mask_size, // size
@ -2313,8 +2311,7 @@ nsStyleImageLayers::nsStyleImageLayers()
, mClipCount(1)
, mOriginCount(1)
, mRepeatCount(1)
, mPositionXCount(1)
, mPositionYCount(1)
, mPositionCount(1)
, mImageCount(1)
, mSizeCount(1)
, mMaskModeCount(1)
@ -2330,8 +2327,7 @@ nsStyleImageLayers::nsStyleImageLayers(const nsStyleImageLayers &aSource)
, mClipCount(aSource.mClipCount)
, mOriginCount(aSource.mOriginCount)
, mRepeatCount(aSource.mRepeatCount)
, mPositionXCount(aSource.mPositionXCount)
, mPositionYCount(aSource.mPositionYCount)
, mPositionCount(aSource.mPositionCount)
, mImageCount(aSource.mImageCount)
, mSizeCount(aSource.mSizeCount)
, mMaskModeCount(aSource.mMaskModeCount)
@ -2348,8 +2344,7 @@ nsStyleImageLayers::nsStyleImageLayers(const nsStyleImageLayers &aSource)
mClipCount = std::max(mClipCount, count);
mOriginCount = std::max(mOriginCount, count);
mRepeatCount = std::max(mRepeatCount, count);
mPositionXCount = std::max(mPositionXCount, count);
mPositionYCount = std::max(mPositionYCount, count);
mPositionCount = std::max(mPositionCount, count);
mImageCount = std::max(mImageCount, count);
mSizeCount = std::max(mSizeCount, count);
mMaskModeCount = std::max(mMaskModeCount, count);
@ -2399,8 +2394,7 @@ nsStyleImageLayers::CalcDifference(const nsStyleImageLayers& aOther) const
mMaskModeCount != aOther.mMaskModeCount ||
mOriginCount != aOther.mOriginCount ||
mRepeatCount != aOther.mRepeatCount ||
mPositionXCount != aOther.mPositionXCount ||
mPositionYCount != aOther.mPositionYCount ||
mPositionCount != aOther.mPositionCount ||
mSizeCount != aOther.mSizeCount) {
NS_UpdateHint(hint, nsChangeHint_NeutralChange);
}

Просмотреть файл

@ -527,8 +527,7 @@ struct nsStyleImageLayers {
color,
image,
repeat,
positionX,
positionY,
position,
clip,
origin,
size,
@ -738,8 +737,7 @@ struct nsStyleImageLayers {
mClipCount,
mOriginCount,
mRepeatCount,
mPositionXCount,
mPositionYCount,
mPositionCount,
mImageCount,
mSizeCount,
mMaskModeCount,

Просмотреть файл

@ -2140,7 +2140,7 @@ var gCSSProperties = {
domProp: "background",
inherited: false,
type: CSS_TYPE_TRUE_SHORTHAND,
subproperties: [ "background-attachment", "background-color", "background-image", "background-position-x", "background-position-y", "background-repeat", "background-clip", "background-origin", "background-size" ],
subproperties: [ "background-attachment", "background-color", "background-image", "background-position", "background-repeat", "background-clip", "background-origin", "background-size" ],
initial_values: [ "transparent", "none", "repeat", "scroll", "0% 0%", "top left", "left top", "0% 0% / auto", "top left / auto", "left top / auto", "0% 0% / auto auto",
"transparent none", "top left none", "left top none", "none left top", "none top left", "none 0% 0%", "left top / auto none", "left top / auto auto none",
"transparent none repeat scroll top left", "left top repeat none scroll transparent", "transparent none repeat scroll top left / auto", "left top / auto repeat none scroll transparent", "none repeat scroll 0% 0% / auto auto transparent" ],
@ -2293,7 +2293,7 @@ var gCSSProperties = {
"background-position": {
domProp: "backgroundPosition",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
type: CSS_TYPE_LONGHAND,
initial_values: [ "top 0% left 0%", "top 0% left", "top left", "left top", "0% 0%", "0% top", "left 0%" ],
other_values: [ "top", "left", "right", "bottom", "center", "center bottom", "bottom center", "center right", "right center", "center top", "top center", "center left", "left center", "right bottom", "bottom right", "50%", "top left, top left", "top left, top right", "top right, top left", "left top, 0% 0%", "10% 20%, 30%, 40%", "top left, bottom right", "right bottom, left top", "0%", "0px", "30px", "0%, 10%, 20%, 30%", "top, top, top, top, top",
"calc(20px)",
@ -2325,7 +2325,6 @@ var gCSSProperties = {
"left 20%",
"right 20%"
],
subproperties: [ "background-position-x", "background-position-y" ],
invalid_values: [ "center 10px center 4px", "center 10px center",
"top 20%", "bottom 20%", "50% left", "top 50%",
"50% bottom 10%", "right 10% 50%", "left right",
@ -2338,58 +2337,6 @@ var gCSSProperties = {
"7px 2": "7px 2px",
},
},
"background-position-x": {
domProp: "backgroundPositionX",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "left 0%", "left", "0%" ],
other_values: [ "right", "center", "50%", "left, left", "left, right", "right, left", "left, 0%", "10%, 20%, 40%", "0px", "30px", "0%, 10%, 20%, 30%", "left, left, left, left, left",
"calc(20px)",
"calc(20px + 1em)",
"calc(20px / 2)",
"calc(20px + 50%)",
"calc(50% - 10px)",
"calc(-20px)",
"calc(-50%)",
"calc(-20%)",
"right 20px",
"left 20px",
"right -50px",
"left -50px",
"right 20px",
"right 3em",
],
invalid_values: [ "center 10px", "right 10% 50%", "left right", "left left",
"bottom 20px", "top 10%", "bottom 3em",
"top", "bottom", "top, top", "top, bottom", "bottom, top", "top, 0%", "top, top, top, top, top",
"calc(0px + rubbish)"],
},
"background-position-y": {
domProp: "backgroundPositionY",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "top 0%", "top", "0%" ],
other_values: [ "bottom", "center", "50%", "top, top", "top, bottom", "bottom, top", "top, 0%", "10%, 20%, 40%", "0px", "30px", "0%, 10%, 20%, 30%", "top, top, top, top, top",
"calc(20px)",
"calc(20px + 1em)",
"calc(20px / 2)",
"calc(20px + 50%)",
"calc(50% - 10px)",
"calc(-20px)",
"calc(-50%)",
"calc(-20%)",
"bottom 20px",
"top 20px",
"bottom -50px",
"top -50px",
"bottom 20px",
"bottom 3em",
],
invalid_values: [ "center 10px", "bottom 10% 50%", "top bottom", "top top",
"right 20px", "left 10%", "right 3em",
"left", "right", "left, left", "left, right", "right, left", "left, 0%", "left, left, left, left, left",
"calc(0px + rubbish)"],
},
"background-repeat": {
domProp: "backgroundRepeat",
inherited: false,
@ -6798,7 +6745,7 @@ if (SupportsMaskShorthand()) {
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
/* FIXME: All mask-border-* should be added when we implement them. */
subproperties: ["mask-clip", "mask-image", "mask-mode", "mask-origin", "mask-position-x", "mask-position-y", "mask-repeat", "mask-size" , "mask-composite"],
subproperties: ["mask-clip", "mask-image", "mask-mode", "mask-origin", "mask-position", "mask-repeat", "mask-size" , "mask-composite"],
initial_values: [ "match-source", "none", "repeat", "add", "0% 0%", "top left", "left top", "0% 0% / auto", "top left / auto", "left top / auto", "0% 0% / auto auto",
"top left none", "left top none", "none left top", "none top left", "none 0% 0%", "left top / auto none", "left top / auto auto none",
"match-source none repeat add top left", "left top repeat none add", "none repeat add top left / auto", "left top / auto repeat none add match-source", "none repeat add 0% 0% / auto auto match-source" ],
@ -6922,7 +6869,7 @@ if (SupportsMaskShorthand()) {
gCSSProperties["mask-position"] = {
domProp: "maskPosition",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
type: CSS_TYPE_LONGHAND,
initial_values: [ "top 0% left 0%", "top 0% left", "top left", "left top", "0% 0%", "0% top", "left 0%" ],
other_values: [ "top", "left", "right", "bottom", "center", "center bottom", "bottom center", "center right", "right center", "center top", "top center", "center left", "left center", "right bottom", "bottom right", "50%", "top left, top left", "top left, top right", "top right, top left", "left top, 0% 0%", "10% 20%, 30%, 40%", "top left, bottom right", "right bottom, left top", "0%", "0px", "30px", "0%, 10%, 20%, 30%", "top, top, top, top, top",
"calc(20px)",
@ -6954,7 +6901,6 @@ if (SupportsMaskShorthand()) {
"left 20%",
"right 20%"
],
subproperties: [ "mask-position-x", "mask-position-y" ],
invalid_values: [ "center 10px center 4px", "center 10px center",
"top 20%", "bottom 20%", "50% left", "top 50%",
"50% bottom 10%", "right 10% 50%", "left right",
@ -6962,58 +6908,6 @@ if (SupportsMaskShorthand()) {
"top 20px bottom 20px", "left left",
"0px calc(0px + rubbish)"],
};
gCSSProperties["mask-position-x"] = {
domProp: "maskPositionX",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "left 0%", "left", "0%" ],
other_values: [ "right", "center", "50%", "left, left", "left, right", "right, left", "left, 0%", "10%, 20%, 40%", "0px", "30px", "0%, 10%, 20%, 30%", "left, left, left, left, left",
"calc(20px)",
"calc(20px + 1em)",
"calc(20px / 2)",
"calc(20px + 50%)",
"calc(50% - 10px)",
"calc(-20px)",
"calc(-50%)",
"calc(-20%)",
"right 20px",
"left 20px",
"right -50px",
"left -50px",
"right 20px",
"right 3em",
],
invalid_values: [ "center 10px", "right 10% 50%", "left right", "left left",
"bottom 20px", "top 10%", "bottom 3em",
"top", "bottom", "top, top", "top, bottom", "bottom, top", "top, 0%", "top, top, top, top, top",
"calc(0px + rubbish)"],
};
gCSSProperties["mask-position-y"] = {
domProp: "maskPositionY",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "top 0%", "top", "0%" ],
other_values: [ "bottom", "center", "50%", "top, top", "top, bottom", "bottom, top", "top, 0%", "10%, 20%, 40%", "0px", "30px", "0%, 10%, 20%, 30%", "top, top, top, top, top",
"calc(20px)",
"calc(20px + 1em)",
"calc(20px / 2)",
"calc(20px + 50%)",
"calc(50% - 10px)",
"calc(-20px)",
"calc(-50%)",
"calc(-20%)",
"bottom 20px",
"top 20px",
"bottom -50px",
"top -50px",
"bottom 20px",
"bottom 3em",
],
invalid_values: [ "center 10px", "bottom 10% 50%", "top bottom", "top top",
"right 20px", "left 10%", "right 3em",
"left", "right", "left, left", "left, right", "right, left", "left, 0%", "left, left, left, left, left",
"calc(0px + rubbish)"],
};
gCSSProperties["mask-repeat"] = {
domProp: "maskRepeat",
inherited: false,
@ -7429,20 +7323,6 @@ if (IsCSSPropertyPrefEnabled("layout.css.prefixes.webkit")) {
alias_for: "mask-position",
subproperties: [ "mask-position" ],
};
gCSSProperties["-webkit-mask-position-x"] = {
domProp: "webkitMaskPositionX",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
alias_for: "mask-position-x",
subproperties: [ "mask-position-x" ],
};
gCSSProperties["-webkit-mask-position-y"] = {
domProp: "webkitMaskPositionY",
inherited: false,
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
alias_for: "mask-position-y",
subproperties: [ "mask-position-y" ],
};
gCSSProperties["-webkit-mask-repeat"] = {
domProp: "webkitMaskRepeat",
inherited: false,

Просмотреть файл

@ -158,43 +158,6 @@ is(e.style.background, "", "should not have background shorthand (background-rep
e.setAttribute("style", "background-clip: border-box, padding-box, border-box; background-origin: border-box, padding-box, padding-box; background-size: cover, auto, contain, contain; background-color: blue; background-image: url(404.png), none, url(404-2.png); background-attachment: fixed, scroll, scroll; background-position: top left, center, 30px 50px; background-repeat: repeat-x, repeat, no-repeat");
is(e.style.background, "", "should not have background shorthand (background-size too long)");
// Check that we only serialize background-position when the lists (of layers) for
// the -x/-y subproperties are the same length.
e.setAttribute("style", "background-position-x: 10%, left 2em, right; background-position-y: top 2em, bottom, 10%");
is(e.style.backgroundPosition, "left 10% top 2em, left 2em bottom, right 10%", "should have background-position shorthand (both lists length 3)");
e.setAttribute("style", "background-position-x: 10%, left 2em; background-position-y: top 2em, bottom, 10%");
is(e.style.backgroundPosition, "", "should not have background-position shorthand (background-position-x too short)");
e.setAttribute("style", "background-position-x: 10%, left 2em, right; background-position-y: top 2em");
is(e.style.backgroundPosition, "", "should not have background-position shorthand (background-position-y too short)");
// Check that background-position serialization doesn't produce invalid values.
e.setAttribute("style", "background-position: 0px");
is(e.style.backgroundPosition, "0px center", "1-value form should be accepted, with implied center value for background-position-y");
e.setAttribute("style", "background-position: 0px center");
is(e.style.backgroundPosition, "0px center", "2-value form 'x-offset' 'y-edge' should be accepted, and serialize to 2-value form");
e.setAttribute("style", "background-position: left 0px center");
is(e.style.backgroundPosition, "left 0px center", "3-value form 'x-edge' 'x-offset' 'y-edge' should be accepted and serialize to 3-value form");
e.setAttribute("style", "background-position: left top 0px");
is(e.style.backgroundPosition, "left top 0px", "3-value form 'x-edge' 'y-edge' 'y-offset' should be accepted and serialize to 3-value form");
e.setAttribute("style", "background-position: left 0px top 0px");
is(e.style.backgroundPosition, "left 0px top 0px", "4-value form should be accepted and serialize to 4-value form");
e.setAttribute("style", "background-position-x: 0px; background-position-y: center");
is(e.style.backgroundPosition, "0px center", "should always serialize to 2-value form if setting -x and -y with the 1-value form");
e.setAttribute("style", "background-position-x: 0px; background-position-y: 0px");
is(e.style.backgroundPosition, "0px 0px", "should always serialize to 2-value form if setting -x and -y with the 1-value form");
e.setAttribute("style", "background-position-x: center; background-position-y: 0px");
is(e.style.backgroundPosition, "center 0px", "should always serialize to 2-value form if setting -x and -y with the 1-value form");
e.setAttribute("style", "background-position-x: left; background-position-y: top");
is(e.style.backgroundPosition, "left top", "should always serialize to 2-value form if setting -x and -y with the 1-value form");
e.setAttribute("style", "background-position-x: left 0px; background-position-y: center");
is(e.style.backgroundPosition, "left 0px center", "should always serialize to 3-value form if both -x and -y specified an edge");
e.setAttribute("style", "background-position-x: right; background-position-y: top 0px");
is(e.style.backgroundPosition, "right top 0px", "should always serialize to 3-value form if both -x and -y specified an edge");
e.setAttribute("style", "background-position-x: left 0px; background-position-y: 0px");
is(e.style.backgroundPosition, "left 0px top 0px", "should serialize to 4-value form if 3-value form would only have one edge");
e.setAttribute("style", "background-position-x: 0px; background-position-y: top 0px");
is(e.style.backgroundPosition, "left 0px top 0px", "should serialize to 4-value form if 3-value form would only have one edge");
// Check that we only serialize transition when the lists are the same length.
e.setAttribute("style", "transition-property: color, width; transition-duration: 1s, 200ms; transition-timing-function: ease-in, linear; transition-delay: 0s, 1s");
isnot(e.style.transition, "", "should have transition shorthand (lists same length)");

Просмотреть файл

@ -90,20 +90,6 @@ var supported_properties = {
// since background-position uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
"background-position-x": [ test_background_position_coord_transition,
test_length_transition,
test_percent_transition,
// FIXME: We don't currently test clamping,
// since background-position-x uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
"background-position-y": [ test_background_position_coord_transition,
test_length_transition,
test_percent_transition,
// FIXME: We don't currently test clamping,
// since background-position-y uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
"background-size": [ test_background_size_transition,
// FIXME: We don't currently test clamping,
// since background-size uses calc() as an
@ -296,20 +282,6 @@ if (SupportsMaskShorthand()) {
// since mask-position uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ];
supported_properties["mask-position-x"] = [ test_background_position_coord_transition,
test_length_transition,
test_percent_transition,
// FIXME: We don't currently test clamping,
// since background-position-x uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ];
supported_properties["mask-position-y"] = [ test_background_position_coord_transition,
test_length_transition,
test_percent_transition,
// FIXME: We don't currently test clamping,
// since background-position-y uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ];
supported_properties["mask-size"] = [ test_background_size_transition,
// FIXME: We don't currently test clamping,
// since mask-size uses calc() as an
@ -2121,12 +2093,10 @@ function test_background_size_transition(prop) {
div.style.setProperty(prop, "contain", "");
is(cs.getPropertyValue(prop), "contain",
"property " + prop + ": can't interpolate 'contain'");
test_background_position_size_common(prop, true, true);
test_background_position_size_common(prop, true);
}
function test_background_position_transition(prop) {
var doesPropTakeListValues = (prop == "background-position");
var doesPropHaveDistanceComputation = (prop != "background-position");
// Test interpolation between edge keywords, and between edge keyword and a
// percent value. (Note: edge keywords are really aliases for percent vals.)
@ -2138,9 +2108,7 @@ function test_background_position_transition(prop) {
div.style.setProperty(prop, "bottom right", "");
is(cs.getPropertyValue(prop), "62.5% 85%",
"property " + prop + ": interpolation of edge keywords & percents");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "center 80%", "62.5% 85%", "bottom right");
}
check_distance(prop, "center 80%", "62.5% 85%", "bottom right");
// Test interpolation between edge keyword *with an offset* and non-keyword
// values.
@ -2152,81 +2120,13 @@ function test_background_position_transition(prop) {
div.style.setProperty(prop, "calc(40px + 20%) calc(12px + 30%)", "");
is(cs.getPropertyValue(prop), "calc(-5px + 80%) calc(3px + 60%)",
"property " + prop + ": interpolation of edge keywords w/ offsets & calc");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "right 20px bottom 30%",
"calc(-5px + 80%) calc(3px + 60%)",
"calc(40px + 20%) calc(12px + 30%)");
}
check_distance(prop, "right 20px bottom 30%",
"calc(-5px + 80%) calc(3px + 60%)",
"calc(40px + 20%) calc(12px + 30%)");
test_background_position_size_common(prop, doesPropTakeListValues,
doesPropHaveDistanceComputation);
}
var doesPropTakeListValues = (prop == "background-position");
function test_background_position_coord_transition(prop) {
var endEdge = prop.endsWith("-x") ? "right" : "bottom";
// Test interpolation between edge keywords, and between edge keyword and a
// percent value. (Note: edge keywords are really aliases for percent vals.)
div.style.setProperty("transition-property", "none", "");
div.style.setProperty(prop, "center", "");
is(cs.getPropertyValue(prop), "50%",
"property " + prop + ": computed value before transition");
div.style.setProperty("transition-property", prop, "");
div.style.setProperty(prop, endEdge, "");
is(cs.getPropertyValue(prop), "62.5%",
"property " + prop + ": interpolation of edge keywords & percents");
check_distance(prop, "center", "62.5%", endEdge);
// Test interpolation between edge keyword *with an offset* and non-keyword
// values.
div.style.setProperty("transition-property", "none", "");
div.style.setProperty(prop, `${endEdge} 20px`, "");
is(cs.getPropertyValue(prop), "calc(-20px + 100%)",
"property " + prop + ": computed value before transition");
div.style.setProperty("transition-property", prop, "");
div.style.setProperty(prop, "calc(40px + 20%)", "");
is(cs.getPropertyValue(prop), "calc(-5px + 80%)",
"property " + prop + ": interpolation of edge keywords w/ offsets & calc");
check_distance(prop, `${endEdge} 20px`,
"calc(-5px + 80%)",
"calc(40px + 20%)");
div.style.setProperty(prop, "10px, 50px, 30px", "");
is(cs.getPropertyValue(prop), "10px, 50px, 30px",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "50px, 70px, 30px", "");
is(cs.getPropertyValue(prop), "20px, 55px, 30px",
"property " + prop + ": interpolation of lists of lengths");
check_distance(prop, "10px, 50px, 30px",
"20px, 55px, 30px",
"50px, 70px, 30px");
div.style.setProperty(prop, "10px, 50%, 30%, 5px", "");
is(cs.getPropertyValue(prop), "10px, 50%, 30%, 5px",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "50px, 70%, 30%, 25px", "");
is(cs.getPropertyValue(prop), "20px, 55%, 30%, 10px",
"property " + prop + ": interpolation of lists of lengths and percents");
check_distance(prop, "10px, 50%, 30%, 5px",
"20px, 55%, 30%, 10px",
"50px, 70%, 30%, 25px");
div.style.setProperty(prop, "20%, 8px", "");
is(cs.getPropertyValue(prop), "20%, 8px",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "12px, 40%", "");
is(cs.getPropertyValue(prop), "calc(3px + 15%), calc(6px + 10%)",
"property " + prop + ": interpolation that computes to calc()");
check_distance(prop, "20%, 8px",
"calc(3px + 15%), calc(6px + 10%)",
"12px, 40%");
div.style.setProperty(prop, "calc(20% + 40px), 8px, calc(20px + 12%)", "");
is(cs.getPropertyValue(prop), "calc(40px + 20%), 8px, calc(20px + 12%)",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "12px, calc(20%), calc(8px + 20%)", "");
is(cs.getPropertyValue(prop), "calc(33px + 15%), calc(6px + 5%), calc(17px + 14%)",
"property " + prop + ": interpolation that computes to calc()");
check_distance(prop, "calc(20% + 40px), 8px, calc(20px + 12%)",
"calc(33px + 15%), calc(6px + 5%), calc(17px + 14%)",
"12px, calc(20%), calc(8px + 20%)");
test_background_position_size_common(prop, doesPropTakeListValues);
}
/**
@ -2239,8 +2139,7 @@ function test_background_position_coord_transition(prop) {
* 'bg-size' value. If true, the property is assumed to also accept
* comma-separated list of such values.
*/
function test_background_position_size_common(prop, doesPropTakeListValues,
doesPropHaveDistanceComputation) {
function test_background_position_size_common(prop, doesPropTakeListValues) {
// Test non-list values
div.style.setProperty("transition-property", "none", "");
div.style.setProperty(prop, "40% 0%", "");
@ -2250,9 +2149,7 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "0% 0%", "");
is(cs.getPropertyValue(prop), "30% 0%",
"property " + prop + ": interpolation of percentages");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "40% 0%", "30% 0%", "0% 0%");
}
check_distance(prop, "40% 0%", "30% 0%", "0% 0%");
div.style.setProperty("transition-property", "none", "");
div.style.setProperty(prop, "0% 40%", "");
@ -2262,9 +2159,7 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "0% 0%", "");
is(cs.getPropertyValue(prop), "0% 30%",
"property " + prop + ": interpolation of percentages");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "0% 40%", "0% 30%", "0% 0%");
}
check_distance(prop, "0% 40%", "0% 30%", "0% 0%");
div.style.setProperty("transition-property", "none", "");
div.style.setProperty(prop, "10px 40px", "");
@ -2274,9 +2169,7 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "50px 0", "");
is(cs.getPropertyValue(prop), "20px 30px",
"property " + prop + ": interpolation of lengths");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "10px 40px", "20px 30px", "50px 0");
}
check_distance(prop, "10px 40px", "20px 30px", "50px 0");
// Test interpolation that computes to to calc() (transition from % to px)
div.style.setProperty("transition-property", "none", "");
@ -2287,11 +2180,9 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "12px 20px", "");
is(cs.getPropertyValue(prop), "calc(3px + 15%) calc(5px + 30%)",
"property " + prop + ": interpolation that computes to calc()");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "20% 40%",
"calc(3px + 15%) calc(5px + 30%)",
"12px 20px");
}
check_distance(prop, "20% 40%",
"calc(3px + 15%) calc(5px + 30%)",
"12px 20px");
// Test interpolation that computes to to calc() (transition from px to %)
div.style.setProperty("transition-property", "none", "");
@ -2302,11 +2193,9 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "20% 40%", "");
is(cs.getPropertyValue(prop), "calc(9px + 5%) calc(15px + 10%)",
"property " + prop + ": interpolation that computes to calc()");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "12px 20px",
"calc(9px + 5%) calc(15px + 10%)",
"20% 40%");
}
check_distance(prop, "12px 20px",
"calc(9px + 5%) calc(15px + 10%)",
"20% 40%");
// Test interpolation between calc() and non-calc()
div.style.setProperty("transition-property", "none", "");
@ -2317,11 +2206,9 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "30% calc(8px + 60%)", "");
is(cs.getPropertyValue(prop), "calc(30px + 15%) calc(14px + 15%)",
"property " + prop + ": interpolation between calc() and non-calc()");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "calc(40px + 10%) 16px",
"calc(30px + 15%) calc(14px + 15%)",
"30% calc(8px + 60%)");
}
check_distance(prop, "calc(40px + 10%) 16px",
"calc(30px + 15%) calc(14px + 15%)",
"30% calc(8px + 60%)");
// Test list values, if appropriate
if (doesPropTakeListValues) {
@ -2331,44 +2218,36 @@ function test_background_position_size_common(prop, doesPropTakeListValues,
div.style.setProperty(prop, "50px 20px, 70px 50px, 30px 40px", "");
is(cs.getPropertyValue(prop), "20px 35px, 55px 50px, 30px 25px",
"property " + prop + ": interpolation of lists of lengths");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "10px 40px, 50px 50px, 30px 20px",
"20px 35px, 55px 50px, 30px 25px",
"50px 20px, 70px 50px, 30px 40px");
}
check_distance(prop, "10px 40px, 50px 50px, 30px 20px",
"20px 35px, 55px 50px, 30px 25px",
"50px 20px, 70px 50px, 30px 40px");
div.style.setProperty(prop, "10px 40%, 50% 50px, 30% 20%, 5px 10px", "");
is(cs.getPropertyValue(prop), "10px 40%, 50% 50px, 30% 20%, 5px 10px",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "50px 20%, 70% 50px, 30% 40%, 25px 50px", "");
is(cs.getPropertyValue(prop), "20px 35%, 55% 50px, 30% 25%, 10px 20px",
"property " + prop + ": interpolation of lists of lengths and percents");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "10px 40%, 50% 50px, 30% 20%, 5px 10px",
"20px 35%, 55% 50px, 30% 25%, 10px 20px",
"50px 20%, 70% 50px, 30% 40%, 25px 50px");
}
check_distance(prop, "10px 40%, 50% 50px, 30% 20%, 5px 10px",
"20px 35%, 55% 50px, 30% 25%, 10px 20px",
"50px 20%, 70% 50px, 30% 40%, 25px 50px");
div.style.setProperty(prop, "20% 40%, 8px 12px", "");
is(cs.getPropertyValue(prop), "20% 40%, 8px 12px",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "12px 20px, 40% 16%", "");
is(cs.getPropertyValue(prop), "calc(3px + 15%) calc(5px + 30%), calc(6px + 10%) calc(9px + 4%)",
"property " + prop + ": interpolation that computes to calc()");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "20% 40%, 8px 12px",
"calc(3px + 15%) calc(5px + 30%), calc(6px + 10%) calc(9px + 4%)",
"12px 20px, 40% 16%");
}
check_distance(prop, "20% 40%, 8px 12px",
"calc(3px + 15%) calc(5px + 30%), calc(6px + 10%) calc(9px + 4%)",
"12px 20px, 40% 16%");
div.style.setProperty(prop, "calc(20% + 40px) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)", "");
is(cs.getPropertyValue(prop), "calc(40px + 20%) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)",
"property " + prop + ": computed value before transition");
div.style.setProperty(prop, "12px 20%, calc(20%) calc(16px + 60%), calc(8px + 20%) calc(40px + 16%)", "");
is(cs.getPropertyValue(prop), "calc(33px + 15%) calc(30px + 35%), calc(6px + 5%) calc(4px + 24%), calc(17px + 14%) calc(28px + 10%)",
"property " + prop + ": interpolation that computes to calc()");
if (doesPropHaveDistanceComputation) {
check_distance(prop, "calc(20% + 40px) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)",
"calc(33px + 15%) calc(30px + 35%), calc(6px + 5%) calc(4px + 24%), calc(17px + 14%) calc(28px + 10%)",
"12px 20%, calc(20%) calc(16px + 60%), calc(8px + 20%) calc(40px + 16%)");
}
check_distance(prop, "calc(20% + 40px) calc(40px + 40%), 8px 12%, calc(20px + 12%) calc(24px + 8%)",
"calc(33px + 15%) calc(30px + 35%), calc(6px + 5%) calc(4px + 24%), calc(17px + 14%) calc(28px + 10%)",
"12px 20%, calc(20%) calc(16px + 60%), calc(8px + 20%) calc(40px + 16%)");
}
}