From f38f80c9f84ce09cd6ab4feb9b80abdc26c2d7e4 Mon Sep 17 00:00:00 2001 From: Rafael Weinstein Date: Wed, 10 Dec 2014 10:38:34 -0800 Subject: [PATCH] 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 --- .../templates/StyleBuilderFunctions.cpp.tmpl | 24 +++---- engine/core/animation/Animation.cpp | 6 -- engine/core/animation/Animation.idl | 1 - engine/core/animation/AnimationEffect.idl | 1 - engine/core/animation/AnimationNode.idl | 4 +- engine/core/animation/AnimationPlayer.idl | 22 +++--- engine/core/animation/AnimationTimeline.idl | 4 +- engine/core/animation/DocumentAnimation.idl | 4 +- engine/core/animation/ElementAnimation.idl | 2 +- engine/core/animation/Timing.idl | 1 - engine/core/animation/css/CSSAnimations.cpp | 16 +---- .../core/css/CSSComputedStyleDeclaration.cpp | 48 ++----------- engine/core/css/CSSProperties.in | 45 ++++-------- engine/core/css/CSSProperty.h | 71 ------------------- engine/core/css/StylePropertySerializer.cpp | 28 +++----- engine/core/css/StylePropertySet.cpp | 61 +--------------- engine/core/css/StylePropertySet.h | 6 +- .../core/css/StylePropertyShorthandCustom.cpp | 46 +----------- engine/core/css/parser/CSSGrammar.y | 4 -- engine/core/css/parser/CSSPropertyParser.cpp | 68 +++--------------- engine/core/css/parser/CSSPropertyParser.h | 1 - engine/core/css/parser/CSSTokenizer-in.cpp | 6 +- engine/core/dom/Document.cpp | 8 +-- engine/core/events/AnimationPlayerEvent.idl | 1 - engine/core/events/EventAliases.in | 1 - engine/core/events/EventTarget.cpp | 57 --------------- engine/core/events/EventTarget.h | 1 - engine/core/events/EventTypeNames.in | 4 -- engine/core/frame/UseCounter.h | 12 ---- engine/platform/RuntimeEnabledFeatures.in | 2 - engine/public/web/WebDocument.h | 2 + engine/web/WebDocument.cpp | 6 ++ engine/web/WebRuntimeFeatures.cpp | 1 - .../animation/basic-declarative-expected.txt | 5 ++ tests/animation/basic-declarative.sky | 31 ++++++++ tests/animation/basic-imperative-expected.txt | 5 ++ tests/animation/basic-imperative.sky | 16 +++++ tests/animation/basic-transition-expected.txt | 5 ++ tests/animation/basic-transition.sky | 31 ++++++++ tools/third_party/PrettyPatch/PrettyPatch.rb | 6 +- viewer/internals.cc | 11 ++- viewer/internals.h | 2 + 42 files changed, 194 insertions(+), 482 deletions(-) create mode 100644 tests/animation/basic-declarative-expected.txt create mode 100644 tests/animation/basic-declarative.sky create mode 100644 tests/animation/basic-imperative-expected.txt create mode 100644 tests/animation/basic-imperative.sky create mode 100644 tests/animation/basic-transition-expected.txt create mode 100644 tests/animation/basic-transition.sky diff --git a/engine/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/engine/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl index 6aefb5560bb..a0c0e680473 100644 --- a/engine/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl +++ b/engine/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl @@ -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] %} diff --git a/engine/core/animation/Animation.cpp b/engine/core/animation/Animation.cpp index 113ae951731..92be0671864 100644 --- a/engine/core/animation/Animation.cpp +++ b/engine/core/animation/Animation.cpp @@ -52,36 +52,30 @@ PassRefPtr Animation::create(Element* target, PassRefPtr Animation::create(Element* element, PassRefPtr effect, const Dictionary& timingInputDictionary) { - ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); return create(element, effect, TimingInput::convert(timingInputDictionary)); } PassRefPtr Animation::create(Element* element, PassRefPtr effect, double duration) { - ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); return create(element, effect, TimingInput::convert(duration)); } PassRefPtr Animation::create(Element* element, PassRefPtr effect) { - ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); return create(element, effect, Timing()); } PassRefPtr Animation::create(Element* element, const Vector& 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::create(Element* element, const Vector& 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::create(Element* element, const Vector& keyframeDictionaryVector, ExceptionState& exceptionState) { - ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); if (element) UseCounter::count(element->document(), UseCounter::AnimationConstructorKeyframeListEffectNoTiming); return create(element, EffectInput::convert(element, keyframeDictionaryVector, exceptionState), Timing()); diff --git a/engine/core/animation/Animation.idl b/engine/core/animation/Animation.idl index 02b98bf8234..f30b3ed0cbc 100644 --- a/engine/core/animation/Animation.idl +++ b/engine/core/animation/Animation.idl @@ -36,6 +36,5 @@ Constructor(Element? target, sequence keyframes, double timingInput), Constructor(Element? target, sequence keyframes, Dictionary timingInput), RaisesException=Constructor, - RuntimeEnabled=WebAnimationsAPI, ] interface Animation : AnimationNode { }; diff --git a/engine/core/animation/AnimationEffect.idl b/engine/core/animation/AnimationEffect.idl index db0fc6ff289..650c9fbae0c 100644 --- a/engine/core/animation/AnimationEffect.idl +++ b/engine/core/animation/AnimationEffect.idl @@ -3,7 +3,6 @@ // found in the LICENSE file. [ - RuntimeEnabled=WebAnimationsAPI, NoInterfaceObject, ] interface AnimationEffect { }; diff --git a/engine/core/animation/AnimationNode.idl b/engine/core/animation/AnimationNode.idl index e9313131cde..3fe4ea269e9 100644 --- a/engine/core/animation/AnimationNode.idl +++ b/engine/core/animation/AnimationNode.idl @@ -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; diff --git a/engine/core/animation/AnimationPlayer.idl b/engine/core/animation/AnimationPlayer.idl index 38f357e7748..90c95c2fbbb 100644 --- a/engine/core/animation/AnimationPlayer.idl +++ b/engine/core/animation/AnimationPlayer.idl @@ -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(); }; diff --git a/engine/core/animation/AnimationTimeline.idl b/engine/core/animation/AnimationTimeline.idl index 1ca2b87ada3..b6f65f54972 100644 --- a/engine/core/animation/AnimationTimeline.idl +++ b/engine/core/animation/AnimationTimeline.idl @@ -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 getAnimationPlayers(); diff --git a/engine/core/animation/DocumentAnimation.idl b/engine/core/animation/DocumentAnimation.idl index d2c2861c8b1..3487cc9e6da 100644 --- a/engine/core/animation/DocumentAnimation.idl +++ b/engine/core/animation/DocumentAnimation.idl @@ -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; }; diff --git a/engine/core/animation/ElementAnimation.idl b/engine/core/animation/ElementAnimation.idl index ccfbca7ee25..e06c747dc92 100644 --- a/engine/core/animation/ElementAnimation.idl +++ b/engine/core/animation/ElementAnimation.idl @@ -36,5 +36,5 @@ partial interface Element { // FIXME: needs support for union types http://crbug.com/240176 // AnimationPlayer animate((AnimationEffect or sequence)? effect, optional (double or Dictionary) timing); [Custom, RaisesException] AnimationPlayer animate(object effect, optional object timing); - [RuntimeEnabled=WebAnimationsAPI] sequence getAnimationPlayers(); + sequence getAnimationPlayers(); }; diff --git a/engine/core/animation/Timing.idl b/engine/core/animation/Timing.idl index 84a0120a1f4..1f0b84da0a2 100644 --- a/engine/core/animation/Timing.idl +++ b/engine/core/animation/Timing.idl @@ -3,7 +3,6 @@ // found in the LICENSE file. [ - RuntimeEnabled=WebAnimationsAPI, ImplementedAs=AnimationNodeTiming, ] interface Timing { attribute double delay; diff --git a/engine/core/animation/css/CSSAnimations.cpp b/engine/core/animation/css/CSSAnimations.cpp index c682af48a9c..1d542471644 100644 --- a/engine/core/animation/css/CSSAnimations.cpp +++ b/engine/core/animation/css/CSSAnimations.cpp @@ -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; 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; diff --git a/engine/core/css/CSSComputedStyleDeclaration.cpp b/engine/core/css/CSSComputedStyleDeclaration.cpp index 6ffbf811009..b3d6854a08c 100644 --- a/engine/core/css/CSSComputedStyleDeclaration.cpp +++ b/engine/core/css/CSSComputedStyleDeclaration.cpp @@ -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 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 list = CSSValueList::createCommaSeparated(); const CSSAnimationData* animationData = style->animations(); if (animationData) { @@ -1889,12 +1873,8 @@ PassRefPtr 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 list = CSSValueList::createCommaSeparated(); const CSSAnimationData* animationData = style->animations(); if (animationData) { @@ -1905,9 +1885,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert } return list.release(); } - case CSSPropertyAnimationIterationCount: - ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()); - case CSSPropertyWebkitAnimationIterationCount: { + case CSSPropertyAnimationIterationCount: { RefPtr list = CSSValueList::createCommaSeparated(); const CSSAnimationData* animationData = style->animations(); if (animationData) { @@ -1918,9 +1896,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert } return list.release(); } - case CSSPropertyAnimationName: - ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()); - case CSSPropertyWebkitAnimationName: { + case CSSPropertyAnimationName: { RefPtr list = CSSValueList::createCommaSeparated(); const CSSAnimationData* animationData = style->animations(); if (animationData) { @@ -1931,9 +1907,7 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert } return list.release(); } - case CSSPropertyAnimationPlayState: - ASSERT(RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()); - case CSSPropertyWebkitAnimationPlayState: { + case CSSPropertyAnimationPlayState: { RefPtr list = CSSValueList::createCommaSeparated(); const CSSAnimationData* animationData = style->animations(); if (animationData) { @@ -1945,11 +1919,8 @@ PassRefPtr 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 animationsList = CSSValueList::createCommaSeparated(); @@ -2093,19 +2064,14 @@ PassRefPtr 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 transitionsList = CSSValueList::createCommaSeparated(); diff --git a/engine/core/css/CSSProperties.in b/engine/core/css/CSSProperties.in index 764716499a7..f43d76e489f 100644 --- a/engine/core/css/CSSProperties.in +++ b/engine/core/css/CSSProperties.in @@ -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 -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 diff --git a/engine/core/css/CSSProperty.h b/engine/core/css/CSSProperty.h index 6471e9a1239..556fd26bcf9 100644 --- a/engine/core/css/CSSProperty.h +++ b/engine/core/css/CSSProperty.h @@ -87,77 +87,6 @@ private: RefPtr 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); diff --git a/engine/core/css/StylePropertySerializer.cpp b/engine/core/css/StylePropertySerializer.cpp index ffba814c0d1..5953053449b 100644 --- a/engine/core/css/StylePropertySerializer.cpp +++ b/engine/core/css/StylePropertySerializer.cpp @@ -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: diff --git a/engine/core/css/StylePropertySet.cpp b/engine/core/css/StylePropertySet.cpp index 66803bb2a92..d08ea5738fc 100644 --- a/engine/core/css/StylePropertySet.cpp +++ b/engine/core/css/StylePropertySet.cpp @@ -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 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(); diff --git a/engine/core/css/StylePropertySet.h b/engine/core/css/StylePropertySet.h index 02c295af92a..afbbfbd04fd 100644 --- a/engine/core/css/StylePropertySet.h +++ b/engine/core/css/StylePropertySet.h @@ -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); diff --git a/engine/core/css/StylePropertyShorthandCustom.cpp b/engine/core/css/StylePropertyShorthandCustom.cpp index 931eb79999d..15bb0ec2ac9 100644 --- a/engine/core/css/StylePropertyShorthandCustom.cpp +++ b/engine/core/css/StylePropertyShorthandCustom.cpp @@ -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); } diff --git a/engine/core/css/parser/CSSGrammar.y b/engine/core/css/parser/CSSGrammar.y index acc1b19b038..3c35fbd7ac9 100644 --- a/engine/core/css/parser/CSSGrammar.y +++ b/engine/core/css/parser/CSSGrammar.y @@ -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: diff --git a/engine/core/css/parser/CSSPropertyParser.cpp b/engine/core/css/parser/CSSPropertyParser.cpp index 2ee6859627d..6833f73b53d 100644 --- a/engine/core/css/parser/CSSPropertyParser.cpp +++ b/engine/core/css/parser/CSSPropertyParser.cpp @@ -122,25 +122,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important, return parser.parseValue(property, important); } -void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr value, bool important, bool implicit) -{ - RefPtr 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 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 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 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 CSSPropertyParser::parseAnimationProperty(CSSPropertyID pro RefPtr 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 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(); diff --git a/engine/core/css/parser/CSSPropertyParser.h b/engine/core/css/parser/CSSPropertyParser.h index 1c391e3b448..3d477e2aca2 100644 --- a/engine/core/css/parser/CSSPropertyParser.h +++ b/engine/core/css/parser/CSSPropertyParser.h @@ -81,7 +81,6 @@ private: KURL completeURL(const String& url) const; - void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr, bool important, bool implicit = false); void addProperty(CSSPropertyID, PassRefPtr, bool important, bool implicit = false); void rollbackLastProperties(int num); void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtr, bool); diff --git a/engine/core/css/parser/CSSTokenizer-in.cpp b/engine/core/css/parser/CSSTokenizer-in.cpp index 5390bee0feb..b4e47e51d4b 100644 --- a/engine/core/css/parser/CSSTokenizer-in.cpp +++ b/engine/core/css/parser/CSSTokenizer-in.cpp @@ -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; diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index ed0147ddc35..fac351b476a 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -2067,13 +2067,13 @@ PassRefPtr 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); diff --git a/engine/core/events/AnimationPlayerEvent.idl b/engine/core/events/AnimationPlayerEvent.idl index a719ec75f0c..089520e0cbf 100644 --- a/engine/core/events/AnimationPlayerEvent.idl +++ b/engine/core/events/AnimationPlayerEvent.idl @@ -4,7 +4,6 @@ [ EventConstructor, - RuntimeEnabled=WebAnimationsAPI, ] interface AnimationPlayerEvent : Event { [InitializedByEventConstructor] readonly attribute double currentTime; [InitializedByEventConstructor] readonly attribute double timelineTime; diff --git a/engine/core/events/EventAliases.in b/engine/core/events/EventAliases.in index 405e8ec7458..3a8dd3fbe61 100644 --- a/engine/core/events/EventAliases.in +++ b/engine/core/events/EventAliases.in @@ -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 diff --git a/engine/core/events/EventTarget.cpp b/engine/core/events/EventTarget.cpp index 9d316a81a7a..a1388e77724 100644 --- a/engine/core/events/EventTarget.cpp +++ b/engine/core/events/EventTarget.cpp @@ -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(); } diff --git a/engine/core/events/EventTarget.h b/engine/core/events/EventTarget.h index 3c7d16abd30..6478053838b 100644 --- a/engine/core/events/EventTarget.h +++ b/engine/core/events/EventTarget.h @@ -139,7 +139,6 @@ private: LocalDOMWindow* executingWindow(); void fireEventListeners(Event*, EventTargetData*, EventListenerVector&); - void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVector*, EventListenerVector*); friend class EventListenerIterator; }; diff --git a/engine/core/events/EventTypeNames.in b/engine/core/events/EventTypeNames.in index b27cfb29b94..15761bad84d 100644 --- a/engine/core/events/EventTypeNames.in +++ b/engine/core/events/EventTypeNames.in @@ -114,12 +114,8 @@ visibilitychange webglcontextcreationerror webglcontextlost webglcontextrestored -webkitAnimationEnd -webkitAnimationIteration -webkitAnimationStart webkitBeforeTextInserted webkitEditableContentChanged -webkitTransitionEnd webkitkeyadded webkitkeyerror webkitkeymessage diff --git a/engine/core/frame/UseCounter.h b/engine/core/frame/UseCounter.h index 836ab5ce4b3..f130bbf6d3e 100644 --- a/engine/core/frame/UseCounter.h +++ b/engine/core/frame/UseCounter.h @@ -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, diff --git a/engine/platform/RuntimeEnabledFeatures.in b/engine/platform/RuntimeEnabledFeatures.in index 1691166a640..18c021b085b 100644 --- a/engine/platform/RuntimeEnabledFeatures.in +++ b/engine/platform/RuntimeEnabledFeatures.in @@ -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 diff --git a/engine/public/web/WebDocument.h b/engine/public/web/WebDocument.h index 554aa18d17d..8159c5822e6 100644 --- a/engine/public/web/WebDocument.h +++ b/engine/public/web/WebDocument.h @@ -88,6 +88,8 @@ public: BLINK_EXPORT WebElement createElement(const WebString& tagName); BLINK_EXPORT v8::Handle registerEmbedderCustomElement(const WebString& name, v8::Handle options, WebExceptionCode&); + BLINK_EXPORT void pauseAnimationsForTesting(double pauseTime) const; + #if BLINK_IMPLEMENTATION WebDocument(const PassRefPtr&); diff --git a/engine/web/WebDocument.cpp b/engine/web/WebDocument.cpp index ac5bd12fc12..954f0be142d 100644 --- a/engine/web/WebDocument.cpp +++ b/engine/web/WebDocument.cpp @@ -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 WebDocument::registerEmbedderCustomElement(const WebString return constructor.v8Value(); } +void WebDocument::pauseAnimationsForTesting(double pauseTime) const { + constUnwrap()->frame()->view()->updateLayoutAndStyleForPainting(); + constUnwrap()->timeline().pauseAnimationsForTesting(pauseTime); +} + WebDocument::WebDocument(const PassRefPtr& elem) : WebNode(elem) { diff --git a/engine/web/WebRuntimeFeatures.cpp b/engine/web/WebRuntimeFeatures.cpp index f2a88bb2d3e..238c09fa6db 100644 --- a/engine/web/WebRuntimeFeatures.cpp +++ b/engine/web/WebRuntimeFeatures.cpp @@ -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) diff --git a/tests/animation/basic-declarative-expected.txt b/tests/animation/basic-declarative-expected.txt new file mode 100644 index 00000000000..256d7210224 --- /dev/null +++ b/tests/animation/basic-declarative-expected.txt @@ -0,0 +1,5 @@ +Running 1 tests +ok 1 top should amimate from 0 to 100px +1 tests +1 pass +0 fail diff --git a/tests/animation/basic-declarative.sky b/tests/animation/basic-declarative.sky new file mode 100644 index 00000000000..83b428e0dda --- /dev/null +++ b/tests/animation/basic-declarative.sky @@ -0,0 +1,31 @@ + + + +
+ + +
diff --git a/tests/animation/basic-imperative-expected.txt b/tests/animation/basic-imperative-expected.txt new file mode 100644 index 00000000000..5d685802cf0 --- /dev/null +++ b/tests/animation/basic-imperative-expected.txt @@ -0,0 +1,5 @@ +Running 1 tests +ok 1 Element.animate opacity should amimate from 0 to 1 +1 tests +1 pass +0 fail diff --git a/tests/animation/basic-imperative.sky b/tests/animation/basic-imperative.sky new file mode 100644 index 00000000000..2a185cb18ec --- /dev/null +++ b/tests/animation/basic-imperative.sky @@ -0,0 +1,16 @@ + + + +
Hello, Sky
+ +
diff --git a/tests/animation/basic-transition-expected.txt b/tests/animation/basic-transition-expected.txt new file mode 100644 index 00000000000..ef547288f3f --- /dev/null +++ b/tests/animation/basic-transition-expected.txt @@ -0,0 +1,5 @@ +Running 1 tests +ok 1 width should transition from 100px to 200px +1 tests +1 pass +0 fail diff --git a/tests/animation/basic-transition.sky b/tests/animation/basic-transition.sky new file mode 100644 index 00000000000..7fa2218d38d --- /dev/null +++ b/tests/animation/basic-transition.sky @@ -0,0 +1,31 @@ + + + +
+ + +
diff --git a/tools/third_party/PrettyPatch/PrettyPatch.rb b/tools/third_party/PrettyPatch/PrettyPatch.rb index f5d80babb73..ee3543eecbd 100644 --- a/tools/third_party/PrettyPatch/PrettyPatch.rb +++ b/tools/third_party/PrettyPatch/PrettyPatch.rb @@ -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; } diff --git a/viewer/internals.cc b/viewer/internals.cc index a4831eeb032..0288b9cc30d 100644 --- a/viewer/internals.cc +++ b/viewer/internals.cc @@ -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 diff --git a/viewer/internals.h b/viewer/internals.h index 19e4653471a..22ca4c3cb54 100644 --- a/viewer/internals.h +++ b/viewer/internals.h @@ -34,6 +34,8 @@ class Internals : public gin::Wrappable { mojo::Handle ConnectToService( const std::string& application_url, const std::string& interface_name); + void pauseAnimations(double pauseTime); + base::WeakPtr document_view_; TestHarnessPtr test_harness_;