mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Enable/Unprefix Animations & Transitions, add basic tests
This patch remove the Web Animations & CSS Animation runtime flags (and enables both). Removes prefixed Aninamations & Transitions and adds some basic tests & test support API. R=ojan@chromium.org Review URL: https://codereview.chromium.org/760183003
This commit is contained in:
parent
fb3655af68
commit
f38f80c9f8
@ -100,18 +100,18 @@ namespace blink {
|
||||
data.{{vector}}.append(state.styleMap().mapAnimation{{attribute}}(i.value()));
|
||||
}
|
||||
{% endmacro %}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationDelay', 'Delay', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationDirection', 'Direction', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationDuration', 'Duration', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationFillMode', 'FillMode', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationIterationCount', 'IterationCount', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationName', 'Name', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationPlayState', 'PlayState', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitAnimationTimingFunction', 'TimingFunction', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyWebkitTransitionDelay', 'Delay', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyWebkitTransitionDuration', 'Duration', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyWebkitTransitionProperty', 'Property', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyWebkitTransitionTimingFunction', 'TimingFunction', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyAnimationDelay', 'Delay', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationDirection', 'Direction', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationDuration', 'Duration', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationFillMode', 'FillMode', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationIterationCount', 'IterationCount', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationName', 'Name', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationPlayState', 'PlayState', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyAnimationTimingFunction', 'TimingFunction', 'Animation')}}
|
||||
{{apply_animation('CSSPropertyTransitionDelay', 'Delay', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyTransitionDuration', 'Duration', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyTransitionProperty', 'Property', 'Transition')}}
|
||||
{{apply_animation('CSSPropertyTransitionTimingFunction', 'TimingFunction', 'Transition')}}
|
||||
|
||||
{% macro apply_auto(property_id, auto_getter=none, auto_setter=none, auto_identity='CSSValueAuto') %}
|
||||
{% set property = properties[property_id] %}
|
||||
|
||||
@ -52,36 +52,30 @@ PassRefPtr<Animation> Animation::create(Element* target, PassRefPtr<AnimationEff
|
||||
|
||||
PassRefPtr<Animation> Animation::create(Element* element, PassRefPtr<AnimationEffect> effect, const Dictionary& timingInputDictionary)
|
||||
{
|
||||
ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
|
||||
return create(element, effect, TimingInput::convert(timingInputDictionary));
|
||||
}
|
||||
PassRefPtr<Animation> Animation::create(Element* element, PassRefPtr<AnimationEffect> effect, double duration)
|
||||
{
|
||||
ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
|
||||
return create(element, effect, TimingInput::convert(duration));
|
||||
}
|
||||
PassRefPtr<Animation> Animation::create(Element* element, PassRefPtr<AnimationEffect> effect)
|
||||
{
|
||||
ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
|
||||
return create(element, effect, Timing());
|
||||
}
|
||||
PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, const Dictionary& timingInputDictionary, ExceptionState& exceptionState)
|
||||
{
|
||||
ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
|
||||
if (element)
|
||||
UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyframeListEffectObjectTiming);
|
||||
return create(element, EffectInput::convert(element, keyframeDictionaryVector, exceptionState), TimingInput::convert(timingInputDictionary));
|
||||
}
|
||||
PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, double duration, ExceptionState& exceptionState)
|
||||
{
|
||||
ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
|
||||
if (element)
|
||||
UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyframeListEffectDoubleTiming);
|
||||
return create(element, EffectInput::convert(element, keyframeDictionaryVector, exceptionState), TimingInput::convert(duration));
|
||||
}
|
||||
PassRefPtr<Animation> Animation::create(Element* element, const Vector<Dictionary>& keyframeDictionaryVector, ExceptionState& exceptionState)
|
||||
{
|
||||
ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled());
|
||||
if (element)
|
||||
UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyframeListEffectNoTiming);
|
||||
return create(element, EffectInput::convert(element, keyframeDictionaryVector, exceptionState), Timing());
|
||||
|
||||
@ -36,6 +36,5 @@
|
||||
Constructor(Element? target, sequence<Dictionary> keyframes, double timingInput),
|
||||
Constructor(Element? target, sequence<Dictionary> keyframes, Dictionary timingInput),
|
||||
RaisesException=Constructor,
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
] interface Animation : AnimationNode {
|
||||
};
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
[
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
NoInterfaceObject,
|
||||
] interface AnimationEffect {
|
||||
};
|
||||
|
||||
@ -28,9 +28,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
[
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
] interface AnimationNode {
|
||||
interface AnimationNode {
|
||||
// Playback state
|
||||
readonly attribute double? localTime;
|
||||
readonly attribute unsigned long? currentIteration;
|
||||
|
||||
@ -32,17 +32,17 @@
|
||||
NoInterfaceObject,
|
||||
ActiveDOMObject,
|
||||
] interface AnimationPlayer : EventTarget {
|
||||
[RuntimeEnabled=WebAnimationsAPI] attribute AnimationNode? source;
|
||||
[RuntimeEnabled=WebAnimationsAPI] attribute double startTime;
|
||||
[RuntimeEnabled=WebAnimationsAPI] attribute double currentTime;
|
||||
[RuntimeEnabled=WebAnimationsAPI] attribute double playbackRate;
|
||||
[RuntimeEnabled=WebAnimationsAPI] readonly attribute boolean paused;
|
||||
[RuntimeEnabled=WebAnimationsAPI] readonly attribute boolean finished;
|
||||
[RuntimeEnabled=WebAnimationsAPI] readonly attribute DOMString playState;
|
||||
[RuntimeEnabled=WebAnimationsAPI, RaisesException] void finish();
|
||||
[RuntimeEnabled=WebAnimationsAPI] void play();
|
||||
[RuntimeEnabled=WebAnimationsAPI] void pause();
|
||||
[RuntimeEnabled=WebAnimationsAPI] void reverse();
|
||||
attribute AnimationNode? source;
|
||||
attribute double startTime;
|
||||
attribute double currentTime;
|
||||
attribute double playbackRate;
|
||||
readonly attribute boolean paused;
|
||||
readonly attribute boolean finished;
|
||||
readonly attribute DOMString playState;
|
||||
[RaisesException] void finish();
|
||||
void play();
|
||||
void pause();
|
||||
void reverse();
|
||||
|
||||
void cancel();
|
||||
};
|
||||
|
||||
@ -2,9 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
[
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
] interface AnimationTimeline {
|
||||
interface AnimationTimeline {
|
||||
readonly attribute double? currentTime;
|
||||
AnimationPlayer play(AnimationNode source);
|
||||
sequence<AnimationPlayer> getAnimationPlayers();
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
[
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
] partial interface Document {
|
||||
partial interface Document {
|
||||
readonly attribute AnimationTimeline timeline;
|
||||
};
|
||||
|
||||
@ -36,5 +36,5 @@ partial interface Element {
|
||||
// FIXME: needs support for union types http://crbug.com/240176
|
||||
// AnimationPlayer animate((AnimationEffect or sequence<Dictionary>)? effect, optional (double or Dictionary) timing);
|
||||
[Custom, RaisesException] AnimationPlayer animate(object effect, optional object timing);
|
||||
[RuntimeEnabled=WebAnimationsAPI] sequence<AnimationPlayer> getAnimationPlayers();
|
||||
sequence<AnimationPlayer> getAnimationPlayers();
|
||||
};
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
[
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
ImplementedAs=AnimationNodeTiming,
|
||||
] interface Timing {
|
||||
attribute double delay;
|
||||
|
||||
@ -109,7 +109,7 @@ static void resolveKeyframes(StyleResolver* resolver, Element* element, const El
|
||||
for (unsigned j = 0; j < properties.propertyCount(); j++) {
|
||||
specifiedPropertiesForUseCounter.add(properties.propertyAt(j).id());
|
||||
CSSPropertyID property = propertyForAnimation(properties.propertyAt(j).id());
|
||||
if (property == CSSPropertyWebkitAnimationTimingFunction || property == CSSPropertyAnimationTimingFunction) {
|
||||
if (property == CSSPropertyAnimationTimingFunction) {
|
||||
CSSValue* value = properties.propertyAt(j).value();
|
||||
RefPtr<TimingFunction> timingFunction;
|
||||
if (value->isInheritedValue() && parentStyle->animations())
|
||||
@ -642,20 +642,6 @@ bool CSSAnimations::isAllowedAnimation(CSSPropertyID property)
|
||||
case CSSPropertyTransitionDuration:
|
||||
case CSSPropertyTransitionProperty:
|
||||
case CSSPropertyTransitionTimingFunction:
|
||||
case CSSPropertyWebkitAnimation:
|
||||
case CSSPropertyWebkitAnimationDelay:
|
||||
case CSSPropertyWebkitAnimationDirection:
|
||||
case CSSPropertyWebkitAnimationDuration:
|
||||
case CSSPropertyWebkitAnimationFillMode:
|
||||
case CSSPropertyWebkitAnimationIterationCount:
|
||||
case CSSPropertyWebkitAnimationName:
|
||||
case CSSPropertyWebkitAnimationPlayState:
|
||||
case CSSPropertyWebkitAnimationTimingFunction:
|
||||
case CSSPropertyWebkitTransition:
|
||||
case CSSPropertyWebkitTransitionDelay:
|
||||
case CSSPropertyWebkitTransitionDuration:
|
||||
case CSSPropertyWebkitTransitionProperty:
|
||||
case CSSPropertyWebkitTransitionTimingFunction:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
||||
@ -193,14 +193,6 @@ static const CSSPropertyID staticComputableProperties[] = {
|
||||
CSSPropertyWordWrap,
|
||||
CSSPropertyZIndex,
|
||||
|
||||
CSSPropertyWebkitAnimationDelay,
|
||||
CSSPropertyWebkitAnimationDirection,
|
||||
CSSPropertyWebkitAnimationDuration,
|
||||
CSSPropertyWebkitAnimationFillMode,
|
||||
CSSPropertyWebkitAnimationIterationCount,
|
||||
CSSPropertyWebkitAnimationName,
|
||||
CSSPropertyWebkitAnimationPlayState,
|
||||
CSSPropertyWebkitAnimationTimingFunction,
|
||||
CSSPropertyBackfaceVisibility,
|
||||
CSSPropertyWebkitBackfaceVisibility,
|
||||
CSSPropertyWebkitBackgroundClip,
|
||||
@ -263,10 +255,6 @@ static const CSSPropertyID staticComputableProperties[] = {
|
||||
CSSPropertyWebkitTransformOrigin,
|
||||
CSSPropertyTransformStyle,
|
||||
CSSPropertyWebkitTransformStyle,
|
||||
CSSPropertyWebkitTransitionDelay,
|
||||
CSSPropertyWebkitTransitionDuration,
|
||||
CSSPropertyWebkitTransitionProperty,
|
||||
CSSPropertyWebkitTransitionTimingFunction,
|
||||
CSSPropertyWebkitUserDrag,
|
||||
CSSPropertyWebkitUserModify,
|
||||
CSSPropertyWebkitUserSelect,
|
||||
@ -1872,12 +1860,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
return cssValuePool().createIdentifierValue(CSSValueContentBox);
|
||||
return cssValuePool().createIdentifierValue(CSSValueBorderBox);
|
||||
case CSSPropertyAnimationDelay:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationDelay:
|
||||
return valueForAnimationDelay(style->animations());
|
||||
case CSSPropertyAnimationDirection:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationDirection: {
|
||||
case CSSPropertyAnimationDirection: {
|
||||
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
|
||||
const CSSAnimationData* animationData = style->animations();
|
||||
if (animationData) {
|
||||
@ -1889,12 +1873,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
return list.release();
|
||||
}
|
||||
case CSSPropertyAnimationDuration:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationDuration:
|
||||
return valueForAnimationDuration(style->animations());
|
||||
case CSSPropertyAnimationFillMode:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationFillMode: {
|
||||
case CSSPropertyAnimationFillMode: {
|
||||
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
|
||||
const CSSAnimationData* animationData = style->animations();
|
||||
if (animationData) {
|
||||
@ -1905,9 +1885,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
}
|
||||
return list.release();
|
||||
}
|
||||
case CSSPropertyAnimationIterationCount:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationIterationCount: {
|
||||
case CSSPropertyAnimationIterationCount: {
|
||||
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
|
||||
const CSSAnimationData* animationData = style->animations();
|
||||
if (animationData) {
|
||||
@ -1918,9 +1896,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
}
|
||||
return list.release();
|
||||
}
|
||||
case CSSPropertyAnimationName:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationName: {
|
||||
case CSSPropertyAnimationName: {
|
||||
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
|
||||
const CSSAnimationData* animationData = style->animations();
|
||||
if (animationData) {
|
||||
@ -1931,9 +1907,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
}
|
||||
return list.release();
|
||||
}
|
||||
case CSSPropertyAnimationPlayState:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationPlayState: {
|
||||
case CSSPropertyAnimationPlayState: {
|
||||
RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
|
||||
const CSSAnimationData* animationData = style->animations();
|
||||
if (animationData) {
|
||||
@ -1945,11 +1919,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
return list.release();
|
||||
}
|
||||
case CSSPropertyAnimationTimingFunction:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationTimingFunction:
|
||||
return valueForAnimationTimingFunction(style->animations());
|
||||
case CSSPropertyAnimation:
|
||||
case CSSPropertyWebkitAnimation: {
|
||||
case CSSPropertyAnimation: {
|
||||
const CSSAnimationData* animationData = style->animations();
|
||||
if (animationData) {
|
||||
RefPtr<CSSValueList> animationsList = CSSValueList::createCommaSeparated();
|
||||
@ -2093,19 +2064,14 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
|
||||
case CSSPropertyWebkitTransformStyle:
|
||||
return cssValuePool().createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
|
||||
case CSSPropertyTransitionDelay:
|
||||
case CSSPropertyWebkitTransitionDelay:
|
||||
return valueForAnimationDelay(style->transitions());
|
||||
case CSSPropertyTransitionDuration:
|
||||
case CSSPropertyWebkitTransitionDuration:
|
||||
return valueForAnimationDuration(style->transitions());
|
||||
case CSSPropertyTransitionProperty:
|
||||
case CSSPropertyWebkitTransitionProperty:
|
||||
return valueForTransitionProperty(style->transitions());
|
||||
case CSSPropertyTransitionTimingFunction:
|
||||
case CSSPropertyWebkitTransitionTimingFunction:
|
||||
return valueForAnimationTimingFunction(style->transitions());
|
||||
case CSSPropertyTransition:
|
||||
case CSSPropertyWebkitTransition: {
|
||||
case CSSPropertyTransition: {
|
||||
const CSSTransitionData* transitionData = style->transitions();
|
||||
if (transitionData) {
|
||||
RefPtr<CSSValueList> transitionsList = CSSValueList::createCommaSeparated();
|
||||
|
||||
@ -213,14 +213,14 @@ transform-origin animatable, custom_all
|
||||
transform-style name_for_methods=TransformStyle3D
|
||||
unicode-bidi
|
||||
vertical-align animatable, custom_inherit, custom_value
|
||||
-webkit-animation-delay custom_all
|
||||
-webkit-animation-direction custom_all
|
||||
-webkit-animation-duration custom_all
|
||||
-webkit-animation-fill-mode custom_all
|
||||
-webkit-animation-iteration-count custom_all
|
||||
-webkit-animation-name custom_all
|
||||
-webkit-animation-play-state custom_all
|
||||
-webkit-animation-timing-function custom_all
|
||||
animation-delay custom_all
|
||||
animation-direction custom_all
|
||||
animation-duration custom_all
|
||||
animation-fill-mode custom_all
|
||||
animation-iteration-count custom_all
|
||||
animation-name custom_all
|
||||
animation-play-state custom_all
|
||||
animation-timing-function custom_all
|
||||
-webkit-aspect-ratio inherited, custom_all
|
||||
-webkit-backface-visibility use_handlers_for=CSSPropertyBackfaceVisibility
|
||||
-webkit-background-clip use_handlers_for=CSSPropertyBackgroundClip
|
||||
@ -269,10 +269,10 @@ vertical-align animatable, custom_inherit, custom_value
|
||||
-webkit-transform-origin-y converter=convertLength
|
||||
-webkit-transform-origin-z converter=convertComputedLength<float>
|
||||
-webkit-transform-style name_for_methods=TransformStyle3D
|
||||
-webkit-transition-delay custom_all
|
||||
-webkit-transition-duration custom_all
|
||||
-webkit-transition-property custom_all
|
||||
-webkit-transition-timing-function custom_all
|
||||
transition-delay custom_all
|
||||
transition-duration custom_all
|
||||
transition-property custom_all
|
||||
transition-timing-function custom_all
|
||||
-webkit-user-drag
|
||||
-webkit-user-modify inherited
|
||||
-webkit-user-select inherited
|
||||
@ -315,33 +315,19 @@ z-index animatable, type_name=int, custom_all
|
||||
-webkit-max-logical-width direction_aware
|
||||
-webkit-max-logical-height direction_aware
|
||||
|
||||
// Properties that we ignore in the StyleBuilder. Note that unprefixed animation
|
||||
// and transition properties are here due to the way they have been unprefixed
|
||||
// Properties that we ignore in the StyleBuilder.
|
||||
// FIXME: We should see if any of these should actually be unreachable
|
||||
|
||||
all builder_skip
|
||||
animation-delay runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-direction runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-duration runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-fill-mode runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-iteration-count runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-name runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-play-state runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
animation-timing-function runtime_flag=CSSAnimationUnprefixed, builder_skip
|
||||
orientation builder_skip
|
||||
page builder_skip
|
||||
src builder_skip
|
||||
transition-delay builder_skip
|
||||
transition-duration builder_skip
|
||||
transition-property builder_skip
|
||||
transition-timing-function builder_skip
|
||||
unicode-range builder_skip
|
||||
-webkit-font-size-delta builder_skip
|
||||
-webkit-text-decorations-in-effect inherited, builder_skip
|
||||
|
||||
// Shorthands
|
||||
|
||||
animation runtime_flag=CSSAnimationUnprefixed, longhands=animation-name;animation-duration;animation-timing-function;animation-delay;animation-iteration-count;animation-direction;animation-fill-mode;animation-play-state
|
||||
background longhands=background-image;background-position-x;background-position-y;background-size;background-repeat-x;background-repeat-y;background-attachment;background-origin;background-clip;background-color
|
||||
background-position longhands=background-position-x;background-position-y
|
||||
background-repeat longhands=background-repeat-x;background-repeat-y
|
||||
@ -363,8 +349,7 @@ margin longhands=margin-top;margin-right;margin-bottom;margin-left
|
||||
outline longhands=outline-color;outline-style;outline-width
|
||||
overflow longhands=overflow-x;overflow-y
|
||||
padding longhands=padding-top;padding-right;padding-bottom;padding-left
|
||||
transition longhands=transition-property;transition-duration;transition-timing-function;transition-delay
|
||||
-webkit-animation longhands=-webkit-animation-name;-webkit-animation-duration;-webkit-animation-timing-function;-webkit-animation-delay;-webkit-animation-iteration-count;-webkit-animation-direction;-webkit-animation-fill-mode;-webkit-animation-play-state
|
||||
animation longhands=animation-name;animation-duration;animation-timing-function;animation-delay;animation-iteration-count;animation-direction;animation-fill-mode;animation-play-state
|
||||
-webkit-border-after longhands=-webkit-border-after-width;-webkit-border-after-style;-webkit-border-after-color
|
||||
-webkit-border-before longhands=-webkit-border-before-width;-webkit-border-before-style;-webkit-border-before-color
|
||||
-webkit-border-end longhands=-webkit-border-end-width;-webkit-border-end-style;-webkit-border-end-color
|
||||
@ -378,7 +363,7 @@ transition longhands=transition-property;transition-duration;transition-timing-f
|
||||
-webkit-text-emphasis longhands=-webkit-text-emphasis-style;-webkit-text-emphasis-color
|
||||
-webkit-text-stroke longhands=-webkit-text-stroke-width;-webkit-text-stroke-color
|
||||
-webkit-transform-origin longhands=-webkit-transform-origin-x;-webkit-transform-origin-y;-webkit-transform-origin-z
|
||||
-webkit-transition longhands=-webkit-transition-property;-webkit-transition-duration;-webkit-transition-timing-function;-webkit-transition-delay
|
||||
transition longhands=transition-property;transition-duration;transition-timing-function;transition-delay
|
||||
|
||||
// Aliases; these map to the same CSSPropertyID
|
||||
|
||||
|
||||
@ -87,77 +87,6 @@ private:
|
||||
RefPtr<CSSValue> m_value;
|
||||
};
|
||||
|
||||
inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId)
|
||||
{
|
||||
if (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) {
|
||||
switch (propId) {
|
||||
case CSSPropertyAnimation:
|
||||
return CSSPropertyWebkitAnimation;
|
||||
case CSSPropertyAnimationDelay:
|
||||
return CSSPropertyWebkitAnimationDelay;
|
||||
case CSSPropertyAnimationDirection:
|
||||
return CSSPropertyWebkitAnimationDirection;
|
||||
case CSSPropertyAnimationDuration:
|
||||
return CSSPropertyWebkitAnimationDuration;
|
||||
case CSSPropertyAnimationFillMode:
|
||||
return CSSPropertyWebkitAnimationFillMode;
|
||||
case CSSPropertyAnimationIterationCount:
|
||||
return CSSPropertyWebkitAnimationIterationCount;
|
||||
case CSSPropertyAnimationName:
|
||||
return CSSPropertyWebkitAnimationName;
|
||||
case CSSPropertyAnimationPlayState:
|
||||
return CSSPropertyWebkitAnimationPlayState;
|
||||
case CSSPropertyAnimationTimingFunction:
|
||||
return CSSPropertyWebkitAnimationTimingFunction;
|
||||
case CSSPropertyWebkitAnimation:
|
||||
return CSSPropertyAnimation;
|
||||
case CSSPropertyWebkitAnimationDelay:
|
||||
return CSSPropertyAnimationDelay;
|
||||
case CSSPropertyWebkitAnimationDirection:
|
||||
return CSSPropertyAnimationDirection;
|
||||
case CSSPropertyWebkitAnimationDuration:
|
||||
return CSSPropertyAnimationDuration;
|
||||
case CSSPropertyWebkitAnimationFillMode:
|
||||
return CSSPropertyAnimationFillMode;
|
||||
case CSSPropertyWebkitAnimationIterationCount:
|
||||
return CSSPropertyAnimationIterationCount;
|
||||
case CSSPropertyWebkitAnimationName:
|
||||
return CSSPropertyAnimationName;
|
||||
case CSSPropertyWebkitAnimationPlayState:
|
||||
return CSSPropertyAnimationPlayState;
|
||||
case CSSPropertyWebkitAnimationTimingFunction:
|
||||
return CSSPropertyAnimationTimingFunction;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (propId) {
|
||||
case CSSPropertyTransitionDelay:
|
||||
return CSSPropertyWebkitTransitionDelay;
|
||||
case CSSPropertyTransitionDuration:
|
||||
return CSSPropertyWebkitTransitionDuration;
|
||||
case CSSPropertyTransitionProperty:
|
||||
return CSSPropertyWebkitTransitionProperty;
|
||||
case CSSPropertyTransitionTimingFunction:
|
||||
return CSSPropertyWebkitTransitionTimingFunction;
|
||||
case CSSPropertyTransition:
|
||||
return CSSPropertyWebkitTransition;
|
||||
case CSSPropertyWebkitTransitionDelay:
|
||||
return CSSPropertyTransitionDelay;
|
||||
case CSSPropertyWebkitTransitionDuration:
|
||||
return CSSPropertyTransitionDuration;
|
||||
case CSSPropertyWebkitTransitionProperty:
|
||||
return CSSPropertyTransitionProperty;
|
||||
case CSSPropertyWebkitTransitionTimingFunction:
|
||||
return CSSPropertyTransitionTimingFunction;
|
||||
case CSSPropertyWebkitTransition:
|
||||
return CSSPropertyTransition;
|
||||
default:
|
||||
return propId;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blink
|
||||
|
||||
WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSProperty);
|
||||
|
||||
@ -76,6 +76,15 @@ String StylePropertySerializer::asText() const
|
||||
String value;
|
||||
|
||||
switch (propertyID) {
|
||||
case CSSPropertyAnimationName:
|
||||
case CSSPropertyAnimationDuration:
|
||||
case CSSPropertyAnimationTimingFunction:
|
||||
case CSSPropertyAnimationDelay:
|
||||
case CSSPropertyAnimationIterationCount:
|
||||
case CSSPropertyAnimationDirection:
|
||||
case CSSPropertyAnimationFillMode:
|
||||
shorthandPropertyID = CSSPropertyAnimation;
|
||||
break;
|
||||
case CSSPropertyBackgroundAttachment:
|
||||
case CSSPropertyBackgroundClip:
|
||||
case CSSPropertyBackgroundColor:
|
||||
@ -164,15 +173,6 @@ String StylePropertySerializer::asText() const
|
||||
case CSSPropertyTransitionDelay:
|
||||
shorthandPropertyID = CSSPropertyTransition;
|
||||
break;
|
||||
case CSSPropertyWebkitAnimationName:
|
||||
case CSSPropertyWebkitAnimationDuration:
|
||||
case CSSPropertyWebkitAnimationTimingFunction:
|
||||
case CSSPropertyWebkitAnimationDelay:
|
||||
case CSSPropertyWebkitAnimationIterationCount:
|
||||
case CSSPropertyWebkitAnimationDirection:
|
||||
case CSSPropertyWebkitAnimationFillMode:
|
||||
shorthandPropertyID = CSSPropertyWebkitAnimation;
|
||||
break;
|
||||
case CSSPropertyFlexDirection:
|
||||
case CSSPropertyFlexWrap:
|
||||
shorthandPropertyID = CSSPropertyFlexFlow;
|
||||
@ -198,12 +198,6 @@ String StylePropertySerializer::asText() const
|
||||
case CSSPropertyWebkitTransformOriginZ:
|
||||
shorthandPropertyID = CSSPropertyWebkitTransformOrigin;
|
||||
break;
|
||||
case CSSPropertyWebkitTransitionProperty:
|
||||
case CSSPropertyWebkitTransitionDuration:
|
||||
case CSSPropertyWebkitTransitionTimingFunction:
|
||||
case CSSPropertyWebkitTransitionDelay:
|
||||
shorthandPropertyID = CSSPropertyWebkitTransition;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -299,10 +293,6 @@ String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const
|
||||
case CSSPropertyTransformOrigin:
|
||||
case CSSPropertyWebkitTransformOrigin:
|
||||
return getShorthandValue(webkitTransformOriginShorthand());
|
||||
case CSSPropertyWebkitTransition:
|
||||
return getLayeredShorthandValue(webkitTransitionShorthand());
|
||||
case CSSPropertyWebkitAnimation:
|
||||
return getLayeredShorthandValue(webkitAnimationShorthand());
|
||||
case CSSPropertyBorderRadius:
|
||||
return get4Values(borderRadiusShorthand());
|
||||
default:
|
||||
|
||||
@ -147,14 +147,7 @@ bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
|
||||
if (!shorthand.length())
|
||||
return false;
|
||||
|
||||
bool ret = removePropertiesInSet(shorthand.properties(), shorthand.length());
|
||||
|
||||
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propertyID);
|
||||
if (prefixingVariant == propertyID)
|
||||
return ret;
|
||||
|
||||
StylePropertyShorthand shorthandPrefixingVariant = shorthandForProperty(prefixingVariant);
|
||||
return removePropertiesInSet(shorthandPrefixingVariant.properties(), shorthandPrefixingVariant.length());
|
||||
return removePropertiesInSet(shorthand.properties(), shorthand.length());
|
||||
}
|
||||
|
||||
bool MutableStylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText)
|
||||
@ -180,19 +173,9 @@ bool MutableStylePropertySet::removeProperty(CSSPropertyID propertyID, String* r
|
||||
// and sweeping them when the vector grows too big.
|
||||
m_propertyVector.remove(foundPropertyIndex);
|
||||
|
||||
removePrefixedOrUnprefixedProperty(propertyID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MutableStylePropertySet::removePrefixedOrUnprefixedProperty(CSSPropertyID propertyID)
|
||||
{
|
||||
int foundPropertyIndex = findPropertyIndex(prefixingVariantForPropertyId(propertyID));
|
||||
if (foundPropertyIndex == -1)
|
||||
return;
|
||||
m_propertyVector.remove(foundPropertyIndex);
|
||||
}
|
||||
|
||||
bool StylePropertySet::propertyIsImportant(CSSPropertyID propertyID) const
|
||||
{
|
||||
int foundPropertyIndex = findPropertyIndex(propertyID);
|
||||
@ -259,40 +242,15 @@ void MutableStylePropertySet::setProperty(const CSSProperty& property, CSSProper
|
||||
CSSProperty* toReplace = slot ? slot : findCSSPropertyWithID(property.id());
|
||||
if (toReplace) {
|
||||
*toReplace = property;
|
||||
setPrefixingVariantProperty(property);
|
||||
return;
|
||||
}
|
||||
}
|
||||
appendPrefixingVariantProperty(property);
|
||||
appendProperty(property);
|
||||
}
|
||||
|
||||
unsigned getIndexInShorthandVectorForPrefixingVariant(const CSSProperty& property, CSSPropertyID prefixingVariant)
|
||||
{
|
||||
if (!property.isSetFromShorthand())
|
||||
return 0;
|
||||
|
||||
CSSPropertyID prefixedShorthand = prefixingVariantForPropertyId(property.shorthandID());
|
||||
Vector<StylePropertyShorthand, 4> shorthands;
|
||||
getMatchingShorthandsForLonghand(prefixingVariant, &shorthands);
|
||||
return indexOfShorthandForLonghand(prefixedShorthand, shorthands);
|
||||
}
|
||||
|
||||
void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
|
||||
void MutableStylePropertySet::appendProperty(const CSSProperty& property)
|
||||
{
|
||||
m_propertyVector.append(property);
|
||||
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
|
||||
if (prefixingVariant == property.id())
|
||||
return;
|
||||
|
||||
m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit));
|
||||
}
|
||||
|
||||
void MutableStylePropertySet::setPrefixingVariantProperty(const CSSProperty& property)
|
||||
{
|
||||
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id());
|
||||
CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant);
|
||||
if (toReplace && prefixingVariant != property.id())
|
||||
*toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit);
|
||||
}
|
||||
|
||||
bool MutableStylePropertySet::setProperty(CSSPropertyID propertyID, CSSValueID identifier, bool important)
|
||||
@ -339,19 +297,6 @@ String StylePropertySet::asText() const
|
||||
return StylePropertySerializer(*this).asText();
|
||||
}
|
||||
|
||||
void MutableStylePropertySet::mergeAndOverrideOnConflict(const StylePropertySet* other)
|
||||
{
|
||||
unsigned size = other->propertyCount();
|
||||
for (unsigned n = 0; n < size; ++n) {
|
||||
PropertyReference toMerge = other->propertyAt(n);
|
||||
CSSProperty* old = findCSSPropertyWithID(toMerge.id());
|
||||
if (old)
|
||||
setProperty(toMerge.toCSSProperty(), old);
|
||||
else
|
||||
appendPrefixingVariantProperty(toMerge.toCSSProperty());
|
||||
}
|
||||
}
|
||||
|
||||
bool StylePropertySet::hasFailedOrCanceledSubresources() const
|
||||
{
|
||||
unsigned size = propertyCount();
|
||||
|
||||
@ -193,19 +193,15 @@ public:
|
||||
// These do not. FIXME: This is too messy, we can do better.
|
||||
bool setProperty(CSSPropertyID, CSSValueID identifier, bool important = false);
|
||||
bool setProperty(CSSPropertyID, CSSPropertyID identifier, bool important = false);
|
||||
void appendPrefixingVariantProperty(const CSSProperty&);
|
||||
void setPrefixingVariantProperty(const CSSProperty&);
|
||||
void appendProperty(const CSSProperty&);
|
||||
void setProperty(const CSSProperty&, CSSProperty* slot = 0);
|
||||
|
||||
bool removeProperty(CSSPropertyID, String* returnText = 0);
|
||||
void removePrefixedOrUnprefixedProperty(CSSPropertyID);
|
||||
void removeBlockProperties();
|
||||
bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
|
||||
void removeEquivalentProperties(const StylePropertySet*);
|
||||
void removeEquivalentProperties(const CSSStyleDeclaration*);
|
||||
|
||||
void mergeAndOverrideOnConflict(const StylePropertySet*);
|
||||
|
||||
void clear();
|
||||
void parseDeclaration(const String& styleDeclaration, StyleSheetContents* contextStyleSheet);
|
||||
|
||||
|
||||
@ -57,36 +57,10 @@ const StylePropertyShorthand& animationShorthandForParsing()
|
||||
CSSPropertyAnimationPlayState,
|
||||
CSSPropertyAnimationName
|
||||
};
|
||||
DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing)));
|
||||
return webkitAnimationLonghandsForParsing;
|
||||
DEFINE_STATIC_LOCAL(StylePropertyShorthand, animationLonghandsForParsing, (CSSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing)));
|
||||
return animationLonghandsForParsing;
|
||||
}
|
||||
|
||||
const StylePropertyShorthand& webkitAnimationShorthandForParsing()
|
||||
{
|
||||
// When we parse the animation shorthand we need to look for animation-name
|
||||
// last because otherwise it might match against the keywords for fill mode,
|
||||
// timing functions and infinite iteration. This means that animation names
|
||||
// that are the same as keywords (e.g. 'forwards') won't always match in the
|
||||
// shorthand. In that case the authors should be using longhands (or
|
||||
// reconsidering their approach). This is covered by the animations spec
|
||||
// bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790
|
||||
// And in the spec (editor's draft) at:
|
||||
// http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property
|
||||
static const CSSPropertyID animationPropertiesForParsing[] = {
|
||||
CSSPropertyWebkitAnimationDuration,
|
||||
CSSPropertyWebkitAnimationTimingFunction,
|
||||
CSSPropertyWebkitAnimationDelay,
|
||||
CSSPropertyWebkitAnimationIterationCount,
|
||||
CSSPropertyWebkitAnimationDirection,
|
||||
CSSPropertyWebkitAnimationFillMode,
|
||||
CSSPropertyWebkitAnimationPlayState,
|
||||
CSSPropertyWebkitAnimationName
|
||||
};
|
||||
DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyWebkitAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing)));
|
||||
return webkitAnimationLonghandsForParsing;
|
||||
}
|
||||
|
||||
// Similar to animations, we have property after timing-function and delay after duration
|
||||
const StylePropertyShorthand& transitionShorthandForParsing()
|
||||
{
|
||||
static const CSSPropertyID transitionProperties[] = {
|
||||
@ -99,18 +73,6 @@ const StylePropertyShorthand& transitionShorthandForParsing()
|
||||
return transitionLonghands;
|
||||
}
|
||||
|
||||
const StylePropertyShorthand& webkitTransitionShorthandForParsing()
|
||||
{
|
||||
static const CSSPropertyID webkitTransitionProperties[] = {
|
||||
CSSPropertyWebkitTransitionDuration,
|
||||
CSSPropertyWebkitTransitionTimingFunction,
|
||||
CSSPropertyWebkitTransitionDelay,
|
||||
CSSPropertyWebkitTransitionProperty
|
||||
};
|
||||
DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTransitionLonghands, (CSSPropertyWebkitTransition, webkitTransitionProperties, WTF_ARRAY_LENGTH(webkitTransitionProperties)));
|
||||
return webkitTransitionLonghands;
|
||||
}
|
||||
|
||||
// Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing.
|
||||
const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID propertyID)
|
||||
{
|
||||
@ -119,12 +81,8 @@ const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID property
|
||||
return animationShorthandForParsing();
|
||||
case CSSPropertyBorder:
|
||||
return borderShorthandForParsing();
|
||||
case CSSPropertyWebkitAnimation:
|
||||
return webkitAnimationShorthandForParsing();
|
||||
case CSSPropertyTransition:
|
||||
return transitionShorthandForParsing();
|
||||
case CSSPropertyWebkitTransition:
|
||||
return webkitTransitionShorthandForParsing();
|
||||
default:
|
||||
return shorthandForProperty(propertyID);
|
||||
}
|
||||
|
||||
@ -187,7 +187,6 @@ inline static CSSParserValue makeIdentValue(CSSParserString string)
|
||||
%token INTERNAL_KEYFRAME_KEY_LIST_SYM
|
||||
%token INTERNAL_SUPPORTS_CONDITION_SYM
|
||||
%token KEYFRAMES_SYM
|
||||
%token WEBKIT_KEYFRAMES_SYM
|
||||
|
||||
%token ATKEYWORD
|
||||
|
||||
@ -741,9 +740,6 @@ keyframes_rule_start:
|
||||
before_keyframes_rule KEYFRAMES_SYM maybe_space {
|
||||
$$ = false;
|
||||
}
|
||||
| before_keyframes_rule WEBKIT_KEYFRAMES_SYM maybe_space {
|
||||
$$ = true;
|
||||
}
|
||||
;
|
||||
|
||||
keyframes:
|
||||
|
||||
@ -122,25 +122,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important,
|
||||
return parser.parseValue(property, important);
|
||||
}
|
||||
|
||||
void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
|
||||
{
|
||||
RefPtr<CSSValue> val = value.get();
|
||||
addProperty(propId, value, important, implicit);
|
||||
|
||||
CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId);
|
||||
if (prefixingVariant == propId)
|
||||
return;
|
||||
|
||||
if (m_currentShorthand) {
|
||||
// We can't use ShorthandScope here as we can already be inside one (e.g we are parsing CSSTransition).
|
||||
m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand);
|
||||
addProperty(prefixingVariant, val.release(), important, implicit);
|
||||
m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand);
|
||||
} else {
|
||||
addProperty(prefixingVariant, val.release(), important, implicit);
|
||||
}
|
||||
}
|
||||
|
||||
void CSSPropertyParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
|
||||
{
|
||||
int shorthandIndex = 0;
|
||||
@ -405,7 +386,7 @@ void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe
|
||||
const StylePropertyShorthand& shorthand = shorthandForProperty(propId);
|
||||
unsigned shorthandLength = shorthand.length();
|
||||
if (!shorthandLength) {
|
||||
addPropertyWithPrefixingVariant(propId, prpValue, important);
|
||||
addProperty(propId, prpValue, important);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -413,7 +394,7 @@ void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, PassRe
|
||||
ShorthandScope scope(this, propId);
|
||||
const CSSPropertyID* longhands = shorthand.properties();
|
||||
for (unsigned i = 0; i < shorthandLength; ++i)
|
||||
addPropertyWithPrefixingVariant(longhands[i], value, important);
|
||||
addProperty(longhands[i], value, important);
|
||||
}
|
||||
|
||||
bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
|
||||
@ -1099,25 +1080,12 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
|
||||
case CSSPropertyAnimationPlayState:
|
||||
case CSSPropertyAnimationIterationCount:
|
||||
case CSSPropertyAnimationTimingFunction:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimationDelay:
|
||||
case CSSPropertyWebkitAnimationDirection:
|
||||
case CSSPropertyWebkitAnimationDuration:
|
||||
case CSSPropertyWebkitAnimationFillMode:
|
||||
case CSSPropertyWebkitAnimationName:
|
||||
case CSSPropertyWebkitAnimationPlayState:
|
||||
case CSSPropertyWebkitAnimationIterationCount:
|
||||
case CSSPropertyWebkitAnimationTimingFunction:
|
||||
case CSSPropertyTransitionDelay:
|
||||
case CSSPropertyTransitionDuration:
|
||||
case CSSPropertyTransitionTimingFunction:
|
||||
case CSSPropertyTransitionProperty:
|
||||
case CSSPropertyWebkitTransitionDelay:
|
||||
case CSSPropertyWebkitTransitionDuration:
|
||||
case CSSPropertyWebkitTransitionTimingFunction:
|
||||
case CSSPropertyWebkitTransitionProperty: {
|
||||
case CSSPropertyTransitionProperty: {
|
||||
if (RefPtr<CSSValueList> val = parseAnimationPropertyList(propId)) {
|
||||
addPropertyWithPrefixingVariant(propId, val.release(), important);
|
||||
addProperty(propId, val.release(), important);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1231,11 +1199,8 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
|
||||
case CSSPropertyWebkitTextStroke:
|
||||
return parseShorthand(propId, webkitTextStrokeShorthand(), important);
|
||||
case CSSPropertyAnimation:
|
||||
ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled());
|
||||
case CSSPropertyWebkitAnimation:
|
||||
return parseAnimationShorthand(propId, important);
|
||||
case CSSPropertyTransition:
|
||||
case CSSPropertyWebkitTransition:
|
||||
return parseTransitionShorthand(propId, important);
|
||||
case CSSPropertyInvalid:
|
||||
return false;
|
||||
@ -1560,10 +1525,7 @@ bool CSSPropertyParser::parseAnimationShorthand(CSSPropertyID propId, bool impor
|
||||
if (!parsedProperty[i])
|
||||
values[i]->append(cssValuePool().createImplicitInitialValue());
|
||||
|
||||
if (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
|
||||
addPropertyWithPrefixingVariant(animationProperties.properties()[i], values[i].release(), important);
|
||||
else
|
||||
addProperty(animationProperties.properties()[i], values[i].release(), important);
|
||||
addProperty(animationProperties.properties()[i], values[i].release(), important);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1611,7 +1573,7 @@ bool CSSPropertyParser::parseTransitionShorthand(CSSPropertyID propId, bool impo
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(shorthand.properties()[3] == CSSPropertyTransitionProperty || shorthand.properties()[3] == CSSPropertyWebkitTransitionProperty);
|
||||
ASSERT(shorthand.properties()[3] == CSSPropertyTransitionProperty);
|
||||
if (!isValidTransitionPropertyList(values[3].get()))
|
||||
return false;
|
||||
|
||||
@ -1619,7 +1581,7 @@ bool CSSPropertyParser::parseTransitionShorthand(CSSPropertyID propId, bool impo
|
||||
for (size_t i = 0; i < numProperties; ++i) {
|
||||
if (!parsedProperty[i])
|
||||
values[i]->append(cssValuePool().createImplicitInitialValue());
|
||||
addPropertyWithPrefixingVariant(shorthand.properties()[i], values[i].release(), important);
|
||||
addProperty(shorthand.properties()[i], values[i].release(), important);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -2665,8 +2627,6 @@ PassRefPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction()
|
||||
return nullptr;
|
||||
switch (args->current()->id) {
|
||||
case CSSValueMiddle:
|
||||
if (!RuntimeEnabledFeatures::webAnimationsAPIEnabled())
|
||||
return nullptr;
|
||||
stepAtPosition = StepsTimingFunction::StepAtMiddle;
|
||||
break;
|
||||
case CSSValueStart:
|
||||
@ -2715,45 +2675,33 @@ PassRefPtr<CSSValue> CSSPropertyParser::parseAnimationProperty(CSSPropertyID pro
|
||||
RefPtr<CSSValue> value = nullptr;
|
||||
switch (propId) {
|
||||
case CSSPropertyAnimationDelay:
|
||||
case CSSPropertyWebkitAnimationDelay:
|
||||
case CSSPropertyTransitionDelay:
|
||||
case CSSPropertyWebkitTransitionDelay:
|
||||
value = parseAnimationDelay();
|
||||
break;
|
||||
case CSSPropertyAnimationDirection:
|
||||
case CSSPropertyWebkitAnimationDirection:
|
||||
value = parseAnimationDirection();
|
||||
break;
|
||||
case CSSPropertyAnimationDuration:
|
||||
case CSSPropertyWebkitAnimationDuration:
|
||||
case CSSPropertyTransitionDuration:
|
||||
case CSSPropertyWebkitTransitionDuration:
|
||||
value = parseAnimationDuration();
|
||||
break;
|
||||
case CSSPropertyAnimationFillMode:
|
||||
case CSSPropertyWebkitAnimationFillMode:
|
||||
value = parseAnimationFillMode();
|
||||
break;
|
||||
case CSSPropertyAnimationIterationCount:
|
||||
case CSSPropertyWebkitAnimationIterationCount:
|
||||
value = parseAnimationIterationCount();
|
||||
break;
|
||||
case CSSPropertyAnimationName:
|
||||
case CSSPropertyWebkitAnimationName:
|
||||
value = parseAnimationName();
|
||||
break;
|
||||
case CSSPropertyAnimationPlayState:
|
||||
case CSSPropertyWebkitAnimationPlayState:
|
||||
value = parseAnimationPlayState();
|
||||
break;
|
||||
case CSSPropertyTransitionProperty:
|
||||
case CSSPropertyWebkitTransitionProperty:
|
||||
value = parseAnimationProperty();
|
||||
break;
|
||||
case CSSPropertyAnimationTimingFunction:
|
||||
case CSSPropertyWebkitAnimationTimingFunction:
|
||||
case CSSPropertyTransitionTimingFunction:
|
||||
case CSSPropertyWebkitTransitionTimingFunction:
|
||||
value = parseAnimationTimingFunction();
|
||||
break;
|
||||
default:
|
||||
@ -2781,7 +2729,7 @@ PassRefPtr<CSSValueList> CSSPropertyParser::parseAnimationPropertyList(CSSProper
|
||||
ASSERT(m_valueList->current());
|
||||
}
|
||||
}
|
||||
if ((propId == CSSPropertyTransitionProperty || propId == CSSPropertyWebkitTransitionProperty) && !isValidTransitionPropertyList(list.get()))
|
||||
if (propId == CSSPropertyTransitionProperty && !isValidTransitionPropertyList(list.get()))
|
||||
return nullptr;
|
||||
ASSERT(list->length());
|
||||
return list.release();
|
||||
|
||||
@ -81,7 +81,6 @@ private:
|
||||
|
||||
KURL completeURL(const String& url) const;
|
||||
|
||||
void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
|
||||
void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool implicit = false);
|
||||
void rollbackLastProperties(int num);
|
||||
void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtr<CSSValue>, bool);
|
||||
|
||||
@ -904,8 +904,7 @@ inline void CSSTokenizer::detectAtToken(int length, bool hasEscape)
|
||||
m_token = FONT_FACE_SYM;
|
||||
}
|
||||
CASE("keyframes") {
|
||||
if (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled())
|
||||
m_token = KEYFRAMES_SYM;
|
||||
m_token = KEYFRAMES_SYM;
|
||||
}
|
||||
CASE("media") {
|
||||
m_parsingMode = MediaQueryMode;
|
||||
@ -927,9 +926,6 @@ inline void CSSTokenizer::detectAtToken(int length, bool hasEscape)
|
||||
if (LIKELY(!hasEscape && m_internal))
|
||||
m_token = INTERNAL_VALUE_SYM;
|
||||
}
|
||||
CASE("-webkit-keyframes") {
|
||||
m_token = WEBKIT_KEYFRAMES_SYM;
|
||||
}
|
||||
CASE("-internal-selector") {
|
||||
if (LIKELY(!hasEscape && m_internal))
|
||||
m_token = INTERNAL_SELECTOR_SYM;
|
||||
|
||||
@ -2067,13 +2067,13 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionState&
|
||||
|
||||
void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
|
||||
{
|
||||
if (eventType == EventTypeNames::webkitAnimationStart || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == EventTypeNames::animationstart)) {
|
||||
if (eventType == EventTypeNames::animationstart) {
|
||||
addListenerType(ANIMATIONSTART_LISTENER);
|
||||
} else if (eventType == EventTypeNames::webkitAnimationEnd || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == EventTypeNames::animationend)) {
|
||||
} else if (eventType == EventTypeNames::animationend) {
|
||||
addListenerType(ANIMATIONEND_LISTENER);
|
||||
} else if (eventType == EventTypeNames::webkitAnimationIteration || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == EventTypeNames::animationiteration)) {
|
||||
} else if (eventType == EventTypeNames::animationiteration) {
|
||||
addListenerType(ANIMATIONITERATION_LISTENER);
|
||||
} else if (eventType == EventTypeNames::webkitTransitionEnd || eventType == EventTypeNames::transitionend) {
|
||||
} else if (eventType == EventTypeNames::transitionend) {
|
||||
addListenerType(TRANSITIONEND_LISTENER);
|
||||
} else if (eventType == EventTypeNames::scroll) {
|
||||
addListenerType(SCROLL_LISTENER);
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
[
|
||||
EventConstructor,
|
||||
RuntimeEnabled=WebAnimationsAPI,
|
||||
] interface AnimationPlayerEvent : Event {
|
||||
[InitializedByEventConstructor] readonly attribute double currentTime;
|
||||
[InitializedByEventConstructor] readonly attribute double timelineTime;
|
||||
|
||||
@ -6,6 +6,5 @@ MouseEvents ImplementedAs=MouseEvent
|
||||
OrientationEvent ImplementedAs=Event, RuntimeEnabled=OrientationEventEnabled
|
||||
SVGEvents ImplementedAs=Event
|
||||
UIEvents ImplementedAs=UIEvent
|
||||
WebKitTransitionEvent ImplementedAs=TransitionEvent
|
||||
|
||||
core/events/TouchEvent RuntimeEnabled=touchEnabled
|
||||
|
||||
@ -159,61 +159,12 @@ void EventTarget::uncaughtExceptionInEventHandler()
|
||||
|
||||
static const AtomicString& legacyType(const Event* event)
|
||||
{
|
||||
if (event->type() == EventTypeNames::transitionend)
|
||||
return EventTypeNames::webkitTransitionEnd;
|
||||
|
||||
if (event->type() == EventTypeNames::animationstart)
|
||||
return EventTypeNames::webkitAnimationStart;
|
||||
|
||||
if (event->type() == EventTypeNames::animationend)
|
||||
return EventTypeNames::webkitAnimationEnd;
|
||||
|
||||
if (event->type() == EventTypeNames::animationiteration)
|
||||
return EventTypeNames::webkitAnimationIteration;
|
||||
|
||||
if (event->type() == EventTypeNames::wheel)
|
||||
return EventTypeNames::mousewheel;
|
||||
|
||||
return emptyAtom;
|
||||
}
|
||||
|
||||
void EventTarget::countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector* listenersVector, EventListenerVector* legacyListenersVector)
|
||||
{
|
||||
UseCounter::Feature unprefixedFeature;
|
||||
UseCounter::Feature prefixedFeature;
|
||||
UseCounter::Feature prefixedAndUnprefixedFeature;
|
||||
if (legacyTypeName == EventTypeNames::webkitTransitionEnd) {
|
||||
prefixedFeature = UseCounter::PrefixedTransitionEndEvent;
|
||||
unprefixedFeature = UseCounter::UnprefixedTransitionEndEvent;
|
||||
prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedTransitionEndEvent;
|
||||
} else if (legacyTypeName == EventTypeNames::webkitAnimationEnd) {
|
||||
prefixedFeature = UseCounter::PrefixedAnimationEndEvent;
|
||||
unprefixedFeature = UseCounter::UnprefixedAnimationEndEvent;
|
||||
prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationEndEvent;
|
||||
} else if (legacyTypeName == EventTypeNames::webkitAnimationStart) {
|
||||
prefixedFeature = UseCounter::PrefixedAnimationStartEvent;
|
||||
unprefixedFeature = UseCounter::UnprefixedAnimationStartEvent;
|
||||
prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationStartEvent;
|
||||
} else if (legacyTypeName == EventTypeNames::webkitAnimationIteration) {
|
||||
prefixedFeature = UseCounter::PrefixedAnimationIterationEvent;
|
||||
unprefixedFeature = UseCounter::UnprefixedAnimationIterationEvent;
|
||||
prefixedAndUnprefixedFeature = UseCounter::PrefixedAndUnprefixedAnimationIterationEvent;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (LocalDOMWindow* executingWindow = this->executingWindow()) {
|
||||
if (legacyListenersVector) {
|
||||
if (listenersVector)
|
||||
UseCounter::count(executingWindow->document(), prefixedAndUnprefixedFeature);
|
||||
else
|
||||
UseCounter::count(executingWindow->document(), prefixedFeature);
|
||||
} else if (listenersVector) {
|
||||
UseCounter::count(executingWindow->document(), unprefixedFeature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool EventTarget::fireEventListeners(Event* event)
|
||||
{
|
||||
ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());
|
||||
@ -229,13 +180,6 @@ bool EventTarget::fireEventListeners(Event* event)
|
||||
legacyListenersVector = d->eventListenerMap.find(legacyTypeName);
|
||||
|
||||
EventListenerVector* listenersVector = d->eventListenerMap.find(event->type());
|
||||
if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && (event->type() == EventTypeNames::animationiteration || event->type() == EventTypeNames::animationend
|
||||
|| event->type() == EventTypeNames::animationstart)
|
||||
// Some code out-there uses custom events to dispatch unprefixed animation events manually,
|
||||
// we can safely remove all this block when cssAnimationUnprefixedEnabled is always on, this
|
||||
// is really a special case. DO NOT ADD MORE EVENTS HERE.
|
||||
&& event->interfaceName() != EventNames::CustomEvent)
|
||||
listenersVector = 0;
|
||||
|
||||
if (listenersVector) {
|
||||
fireEventListeners(event, d, *listenersVector);
|
||||
@ -247,7 +191,6 @@ bool EventTarget::fireEventListeners(Event* event)
|
||||
}
|
||||
|
||||
Editor::countEvent(executionContext(), event);
|
||||
countLegacyEvents(legacyTypeName, listenersVector, legacyListenersVector);
|
||||
return !event->defaultPrevented();
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,6 @@ private:
|
||||
|
||||
LocalDOMWindow* executingWindow();
|
||||
void fireEventListeners(Event*, EventTargetData*, EventListenerVector&);
|
||||
void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector*, EventListenerVector*);
|
||||
|
||||
friend class EventListenerIterator;
|
||||
};
|
||||
|
||||
@ -114,12 +114,8 @@ visibilitychange
|
||||
webglcontextcreationerror
|
||||
webglcontextlost
|
||||
webglcontextrestored
|
||||
webkitAnimationEnd
|
||||
webkitAnimationIteration
|
||||
webkitAnimationStart
|
||||
webkitBeforeTextInserted
|
||||
webkitEditableContentChanged
|
||||
webkitTransitionEnd
|
||||
webkitkeyadded
|
||||
webkitkeyerror
|
||||
webkitkeymessage
|
||||
|
||||
@ -68,9 +68,6 @@ public:
|
||||
UnprefixedIndexedDB = 9,
|
||||
UnprefixedRequestAnimationFrame = 13,
|
||||
PrefixedRequestAnimationFrame = 14,
|
||||
PrefixedTransitionEndEvent = 18,
|
||||
UnprefixedTransitionEndEvent = 19,
|
||||
PrefixedAndUnprefixedTransitionEndEvent = 20,
|
||||
|
||||
DataListElement = 23,
|
||||
FormAttribute = 24,
|
||||
@ -137,15 +134,6 @@ public:
|
||||
NavigatorVendorSub = 125,
|
||||
FileError = 126,
|
||||
DocumentCharset = 127, // Documented as IE extensions = 0, from KHTML days.
|
||||
PrefixedAnimationEndEvent = 128,
|
||||
UnprefixedAnimationEndEvent = 129,
|
||||
PrefixedAndUnprefixedAnimationEndEvent = 130,
|
||||
PrefixedAnimationStartEvent = 131,
|
||||
UnprefixedAnimationStartEvent = 132,
|
||||
PrefixedAndUnprefixedAnimationStartEvent = 133,
|
||||
PrefixedAnimationIterationEvent = 134,
|
||||
UnprefixedAnimationIterationEvent = 135,
|
||||
PrefixedAndUnprefixedAnimationIterationEvent = 136,
|
||||
EventReturnValue = 137, // Legacy IE extension.
|
||||
HasAttributes = 142, // Removed from DOM4.
|
||||
DOMSubtreeModifiedEvent = 143,
|
||||
|
||||
@ -32,7 +32,6 @@ BleedingEdgeFastPaths
|
||||
|
||||
ClientHintsDpr status=experimental
|
||||
Crypto status=stable
|
||||
CSSAnimationUnprefixed status=experimental
|
||||
CSSAttributeCaseSensitivity status=experimental
|
||||
CSSMaskSourceType status=experimental
|
||||
CSSOMSmoothScroll status=experimental
|
||||
@ -121,7 +120,6 @@ HoverMediaQueryKeywords status=stable
|
||||
TextBlob
|
||||
TouchIconLoading
|
||||
UserSelectAll status=experimental
|
||||
WebAnimationsAPI status=experimental
|
||||
WebGLDraftExtensions status=experimental
|
||||
WebGLImageChromium
|
||||
WOFF2 status=stable
|
||||
|
||||
@ -88,6 +88,8 @@ public:
|
||||
BLINK_EXPORT WebElement createElement(const WebString& tagName);
|
||||
|
||||
BLINK_EXPORT v8::Handle<v8::Value> registerEmbedderCustomElement(const WebString& name, v8::Handle<v8::Value> options, WebExceptionCode&);
|
||||
BLINK_EXPORT void pauseAnimationsForTesting(double pauseTime) const;
|
||||
|
||||
|
||||
#if BLINK_IMPLEMENTATION
|
||||
WebDocument(const PassRefPtr<Document>&);
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include "sky/engine/bindings/core/v8/ExceptionState.h"
|
||||
#include "sky/engine/bindings/core/v8/ScriptState.h"
|
||||
#include "sky/engine/bindings/core/v8/ScriptValue.h"
|
||||
#include "sky/engine/core/animation/AnimationTimeline.h"
|
||||
#include "sky/engine/core/css/StyleSheetContents.h"
|
||||
#include "sky/engine/core/dom/Document.h"
|
||||
#include "sky/engine/core/dom/Element.h"
|
||||
@ -138,6 +139,11 @@ v8::Handle<v8::Value> WebDocument::registerEmbedderCustomElement(const WebString
|
||||
return constructor.v8Value();
|
||||
}
|
||||
|
||||
void WebDocument::pauseAnimationsForTesting(double pauseTime) const {
|
||||
constUnwrap<Document>()->frame()->view()->updateLayoutAndStyleForPainting();
|
||||
constUnwrap<Document>()->timeline().pauseAnimationsForTesting(pauseTime);
|
||||
}
|
||||
|
||||
WebDocument::WebDocument(const PassRefPtr<Document>& elem)
|
||||
: WebNode(elem)
|
||||
{
|
||||
|
||||
@ -46,7 +46,6 @@ void WebRuntimeFeatures::enableBleedingEdgeFastPaths(bool enable)
|
||||
ASSERT(enable);
|
||||
RuntimeEnabledFeatures::setBleedingEdgeFastPathsEnabled(enable);
|
||||
RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable || RuntimeEnabledFeatures::subpixelFontScalingEnabled());
|
||||
RuntimeEnabledFeatures::setWebAnimationsAPIEnabled(enable);
|
||||
}
|
||||
|
||||
void WebRuntimeFeatures::enableTestOnlyFeatures(bool enable)
|
||||
|
||||
5
tests/animation/basic-declarative-expected.txt
Normal file
5
tests/animation/basic-declarative-expected.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Running 1 tests
|
||||
ok 1 top should amimate from 0 to 100px
|
||||
1 tests
|
||||
1 pass
|
||||
0 fail
|
||||
31
tests/animation/basic-declarative.sky
Normal file
31
tests/animation/basic-declarative.sky
Normal file
@ -0,0 +1,31 @@
|
||||
<sky>
|
||||
<import src="../resources/chai.sky" />
|
||||
<import src="../resources/mocha.sky" />
|
||||
<div id="example"></div>
|
||||
<style>
|
||||
#example {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: red;
|
||||
position: relative;
|
||||
animation-name: anim;
|
||||
animation-timing-function: linear;
|
||||
animation-duration: 5s;
|
||||
}
|
||||
|
||||
@keyframes anim {
|
||||
0% { top: 0px; }
|
||||
100% { top: 100px; }
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var example = document.getElementById('example');
|
||||
|
||||
describe('top', function() {
|
||||
it('should amimate from 0 to 100px', function() {
|
||||
internals.pauseAnimations(3);
|
||||
assert.equal('60px', getComputedStyle(example).top);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</sky>
|
||||
5
tests/animation/basic-imperative-expected.txt
Normal file
5
tests/animation/basic-imperative-expected.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Running 1 tests
|
||||
ok 1 Element.animate opacity should amimate from 0 to 1
|
||||
1 tests
|
||||
1 pass
|
||||
0 fail
|
||||
16
tests/animation/basic-imperative.sky
Normal file
16
tests/animation/basic-imperative.sky
Normal file
@ -0,0 +1,16 @@
|
||||
<sky>
|
||||
<import src="../resources/chai.sky" />
|
||||
<import src="../resources/mocha.sky" />
|
||||
<div id="example">Hello, Sky</div>
|
||||
<script>
|
||||
var example = document.getElementById('example');
|
||||
|
||||
describe('Element.animate opacity', function() {
|
||||
it('should amimate from 0 to 1', function() {
|
||||
example.animate([{ opacity: 0 }, { opacity: 1}], 2000);
|
||||
internals.pauseAnimations(.5);
|
||||
assert.equal(.25, getComputedStyle(example).opacity);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</sky>
|
||||
5
tests/animation/basic-transition-expected.txt
Normal file
5
tests/animation/basic-transition-expected.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Running 1 tests
|
||||
ok 1 width should transition from 100px to 200px
|
||||
1 tests
|
||||
1 pass
|
||||
0 fail
|
||||
31
tests/animation/basic-transition.sky
Normal file
31
tests/animation/basic-transition.sky
Normal file
@ -0,0 +1,31 @@
|
||||
<sky>
|
||||
<import src="../resources/chai.sky" />
|
||||
<import src="../resources/mocha.sky" />
|
||||
<div></div>
|
||||
<style>
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: red;
|
||||
position: relative;
|
||||
transition: width 2s;
|
||||
transition-timing-function: linear;
|
||||
}
|
||||
|
||||
div#example {
|
||||
width: 200px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var example = document.querySelector('div');
|
||||
example.offsetWidth; // force a style resolution so that next line's assigment triggers the transition
|
||||
example.id = "example";
|
||||
|
||||
describe('width', function() {
|
||||
it('should transition from 100px to 200px', function() {
|
||||
internals.pauseAnimations(1);
|
||||
assert.equal('150px', getComputedStyle(example).width);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</sky>
|
||||
6
tools/third_party/PrettyPatch/PrettyPatch.rb
vendored
6
tools/third_party/PrettyPatch/PrettyPatch.rb
vendored
@ -324,7 +324,7 @@ h1 :hover {
|
||||
}
|
||||
|
||||
.overallComments .open {
|
||||
-webkit-transition: height .2s;
|
||||
transition: height .2s;
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
@ -407,7 +407,7 @@ h1 :hover {
|
||||
font-family: sans-serif;
|
||||
font-size: small;
|
||||
font-style: normal;
|
||||
-webkit-transition: opacity 0.5s;
|
||||
transition: opacity 0.5s;
|
||||
}
|
||||
|
||||
.LinkContainer a {
|
||||
@ -487,7 +487,7 @@ div:focus {
|
||||
padding: 0 3px;
|
||||
outline: 1px solid #DDD;
|
||||
color: #8FDF5F;
|
||||
font-size: small;
|
||||
font-size: small;
|
||||
background-color: #EEE;
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "mojo/edk/js/support.h"
|
||||
#include "mojo/public/cpp/application/connect.h"
|
||||
#include "mojo/public/interfaces/application/shell.mojom.h"
|
||||
#include "sky/engine/public/web/WebDocument.h"
|
||||
#include "sky/engine/public/web/WebFrame.h"
|
||||
#include "sky/engine/public/web/WebView.h"
|
||||
#include "sky/viewer/document_view.h"
|
||||
@ -46,7 +47,8 @@ gin::ObjectTemplateBuilder Internals::GetObjectTemplateBuilder(
|
||||
.SetMethod("renderTreeAsText", &Internals::RenderTreeAsText)
|
||||
.SetMethod("contentAsText", &Internals::ContentAsText)
|
||||
.SetMethod("notifyTestComplete", &Internals::NotifyTestComplete)
|
||||
.SetMethod("connectToService", &Internals::ConnectToService);
|
||||
.SetMethod("connectToService", &Internals::ConnectToService)
|
||||
.SetMethod("pauseAnimations", &Internals::pauseAnimations);
|
||||
}
|
||||
|
||||
std::string Internals::RenderTreeAsText() {
|
||||
@ -80,4 +82,11 @@ mojo::Handle Internals::ConnectToService(
|
||||
return pipe.handle0.release();
|
||||
}
|
||||
|
||||
void Internals::pauseAnimations(double pauseTime) {
|
||||
if (pauseTime < 0)
|
||||
return;
|
||||
|
||||
document_view_->web_view()->mainFrame()->document().pauseAnimationsForTesting(pauseTime);
|
||||
}
|
||||
|
||||
} // namespace sky
|
||||
|
||||
@ -34,6 +34,8 @@ class Internals : public gin::Wrappable<Internals> {
|
||||
mojo::Handle ConnectToService(
|
||||
const std::string& application_url, const std::string& interface_name);
|
||||
|
||||
void pauseAnimations(double pauseTime);
|
||||
|
||||
base::WeakPtr<DocumentView> document_view_;
|
||||
TestHarnessPtr test_harness_;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user