Commit 621a7170 authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Fix bug with parsing of keyframes argument object

By spec, we are actually not allowed to access the value of a
non-animatable property. Before this CL, we would access the value and
then ignore it later.

Bug: 777971
Change-Id: Iadfc5165fdbe1796f3831e666e1c8f2a8fb55b1f
Reviewed-on: https://chromium-review.googlesource.com/934634Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540377}
parent b8eb1cbe
This is a testharness.js-based test.
Found 50 tests; 12 PASS, 38 FAIL, 0 TIMEOUT, 0 NOTRUN.
FAIL non-animatable property 'animation' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationDelay' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationDirection' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationDuration' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationFillMode' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationIterationCount' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationName' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationPlayState' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationTimingFunction' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transition' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionDelay' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionDuration' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionProperty' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionTimingFunction' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'display' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'unsupportedProperty' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'font-size' is not accessed when using a property-indexed keyframe object assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animation' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationDelay' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationDirection' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationDuration' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationFillMode' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationIterationCount' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationName' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationPlayState' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'animationTimingFunction' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transition' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionDelay' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionDuration' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionProperty' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'transitionTimingFunction' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'display' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'unsupportedProperty' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
FAIL non-animatable property 'font-size' is not accessed when using a keyframe sequence assert_equals: Accessor not called expected 0 but got 1
Found 50 tests; 46 PASS, 4 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS non-animatable property 'animation' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationDelay' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationDirection' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationDuration' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationFillMode' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationIterationCount' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationName' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationPlayState' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animationTimingFunction' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'transition' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'transitionDelay' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'transitionDuration' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'transitionProperty' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'transitionTimingFunction' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'display' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'unsupportedProperty' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'font-size' is not accessed when using a property-indexed keyframe object
PASS non-animatable property 'animation' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationDelay' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationDirection' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationDuration' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationFillMode' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationIterationCount' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationName' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationPlayState' is not accessed when using a keyframe sequence
PASS non-animatable property 'animationTimingFunction' is not accessed when using a keyframe sequence
PASS non-animatable property 'transition' is not accessed when using a keyframe sequence
PASS non-animatable property 'transitionDelay' is not accessed when using a keyframe sequence
PASS non-animatable property 'transitionDuration' is not accessed when using a keyframe sequence
PASS non-animatable property 'transitionProperty' is not accessed when using a keyframe sequence
PASS non-animatable property 'transitionTimingFunction' is not accessed when using a keyframe sequence
PASS non-animatable property 'display' is not accessed when using a keyframe sequence
PASS non-animatable property 'unsupportedProperty' is not accessed when using a keyframe sequence
PASS non-animatable property 'font-size' is not accessed when using a keyframe sequence
PASS Equivalent property-indexed and sequenced keyframes: two properties with one value
PASS Equivalent property-indexed and sequenced keyframes: two properties with three values
PASS Equivalent property-indexed and sequenced keyframes: two properties with different numbers of values
......
......@@ -43,6 +43,7 @@
#include "core/animation/CompositorAnimations.h"
#include "core/animation/KeyframeEffectModel.h"
#include "core/animation/StringKeyframe.h"
#include "core/animation/css/CSSAnimations.h"
#include "core/css/CSSStyleSheet.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
......@@ -192,6 +193,26 @@ EffectModel::CompositeOperation ResolveCompositeOperationForKeyframe(
return composite;
}
bool IsAnimatableKeyframeAttribute(const String& property,
Element* element,
const Document& document) {
CSSPropertyID css_property =
AnimationInputHelpers::KeyframeAttributeToCSSProperty(property, document);
if (css_property != CSSPropertyInvalid) {
return !CSSAnimations::IsAnimationAffectingProperty(
CSSProperty::Get(css_property));
}
css_property =
AnimationInputHelpers::KeyframeAttributeToPresentationAttribute(property,
element);
if (css_property != CSSPropertyInvalid)
return true;
return !!AnimationInputHelpers::KeyframeAttributeToSVGAttribute(property,
element);
}
// Temporary storage struct used when converting array-form keyframes.
struct KeyframeOutput {
BaseKeyframe base_keyframe;
......@@ -236,6 +257,10 @@ StringKeyframeVector ConvertArrayForm(Element* element,
continue;
}
// By spec, we are not allowed to access any non-animatable property.
if (!IsAnimatableKeyframeAttribute(property, element, document))
continue;
// By spec, we are only allowed to access a given (property, value) pair
// once. This is observable by the web client, so we take care to adhere
// to that.
......@@ -439,6 +464,10 @@ StringKeyframeVector ConvertObjectForm(Element* element,
continue;
}
// By spec, we are not allowed to access any non-animatable property.
if (!IsAnimatableKeyframeAttribute(property, element, document))
continue;
Vector<String> values;
if (!GetPropertyIndexedKeyframeValues(dictionary, property, script_state,
exception_state, values)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment