Bug 1311620 - Part 11: Implement shadow list addition. r=boris

MozReview-Commit-ID: DRShA4qUS8Q
This commit is contained in:
Hiroyuki Ikezoe
2016-12-24 20:05:34 +09:00
parent 903a60b23a
commit dec485f2b1
4 changed files with 54 additions and 7 deletions

View File

@@ -779,15 +779,16 @@ StyleAnimationValue::Add(nsCSSPropertyID aProperty,
AddWeightedColors(1.0, color1, 1, color2));
break;
}
case eUnit_Filter: {
// If |aA| is 'filter:none', don't concatinate anything, just return
case eUnit_Filter:
case eUnit_Shadow: {
// If |aA| has no function list, don't concatinate anything, just return
// |aB| as the result.
if (aA.GetCSSValueListValue()->mValue.GetUnit() == eCSSUnit_None) {
break;
}
UniquePtr<nsCSSValueList> resultList(aA.GetCSSValueListValue()->Clone());
// If |aB| is not 'filter:none', concatinate it to |aA|, then return
// If |aB| has function list, concatinate it to |aA|, then return
// the concatinated list.
if (result.GetCSSValueListValue()->mValue.GetUnit() != eCSSUnit_None) {
nsCSSValueList* listA = resultList.get();

View File

@@ -12,3 +12,9 @@ prefs: [layout.css.contain.enabled:true, layout.css.initial-letter.enabled:true,
[filterList has testInterpolation function]
expected: FAIL
[boxShadowList has testInterpolation function]
expected: FAIL
[textShadowList has testInterpolation function]
expected: FAIL

View File

@@ -304,8 +304,7 @@ var gCSSProperties = {
},
'box-shadow': {
// https://drafts.csswg.org/css-backgrounds/#box-shadow
types: [
]
types: [ 'boxShadowList' ],
},
'box-sizing': {
// https://drafts.csswg.org/css-ui-4/#box-sizing
@@ -1351,8 +1350,12 @@ var gCSSProperties = {
},
'text-shadow': {
// https://drafts.csswg.org/css-text-decor-3/#propdef-text-shadow
types: [
]
types: [ 'textShadowList' ],
setup: t => {
var element = createElement(t);
element.style.color = 'green';
return element;
}
},
'text-transform': {
// https://drafts.csswg.org/css-text-3/#propdef-text-transform

View File

@@ -920,6 +920,41 @@ const filterListType = {
},
};
const textShadowListType = {
testAddition: function(property, setup) {
test(function(t) {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(0, 0, 0) 0px 0px 0px';
var animation =
target.animate({ [idlName]: [ 'rgb(120, 120, 120) 10px 10px 10px',
'rgb(120, 120, 120) 10px 10px 10px'] },
{ duration: 1000, composite: 'add' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'rgb(0, 0, 0) 0px 0px 0px, ' +
'rgb(120, 120, 120) 10px 10px 10px' }]);
}, property + ': shadow');
},
};
const boxShadowListType = {
testAddition: function(property, setup) {
test(function(t) {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(0, 0, 0) 0px 0px 0px 0px';
var animation =
target.animate({ [idlName]: [ 'rgb(120, 120, 120) 10px 10px 10px 0px',
'rgb(120, 120, 120) 10px 10px 10px 0px'] },
{ duration: 1000, composite: 'add' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'rgb(0, 0, 0) 0px 0px 0px 0px, ' +
'rgb(120, 120, 120) 10px 10px 10px 0px' }]);
}, property + ': shadow');
},
};
const types = {
color: colorType,
discrete: discreteType,
@@ -931,5 +966,7 @@ const types = {
positiveNumber: positiveNumberType,
transformList: transformListType,
visibility: visibilityType,
boxShadowList: boxShadowListType,
textShadowList: textShadowListType,
};