Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (228411 => 228412)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-02-13 01:28:27 UTC (rev 228412)
@@ -1,3 +1,15 @@
+2018-02-12 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Support the copy constructors for KeyframeEffectReadOnly and KeyframeEffect
+ https://bugs.webkit.org/show_bug.cgi?id=182712
+
+ Reviewed by Dean Jackson.
+
+ Update test expectations for tests relevant to the copy constructors.
+
+ * web-platform-tests/web-animations/interfaces/KeyframeEffect/copy-constructor-expected.txt:
+ * web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt:
+
2018-02-08 Antoine Quint <grao...@apple.com>
[Web Animations] Refactor AnimationEffect and KeyframeEffect into AnimationEffectReadOnly, KeyframeEffectReadOnly and KeyframeEffect
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/copy-constructor-expected.txt (228411 => 228412)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/copy-constructor-expected.txt 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/copy-constructor-expected.txt 2018-02-13 01:28:27 UTC (rev 228412)
@@ -1,7 +1,7 @@
-FAIL Copied KeyframeEffectReadOnly has the same target Not enough arguments
-FAIL Copied KeyframeEffectReadOnly has the same keyframes Not enough arguments
-FAIL Copied KeyframeEffectReadOnly has the same KeyframeEffectOptions Not enough arguments
-FAIL Copied KeyframeEffectReadOnly has the same timing content Not enough arguments
-FAIL KeyframeEffect constructed from a KeyframeEffectReadOnly is mutable Not enough arguments
+PASS Copied KeyframeEffectReadOnly has the same target
+PASS Copied KeyframeEffectReadOnly has the same keyframes
+PASS Copied KeyframeEffectReadOnly has the same KeyframeEffectOptions
+PASS Copied KeyframeEffectReadOnly has the same timing content
+PASS KeyframeEffect constructed from a KeyframeEffectReadOnly is mutable
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt (228411 => 228412)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt 2018-02-13 01:28:27 UTC (rev 228412)
@@ -7,7 +7,7 @@
PASS AnimationEffectReadOnly interface: attribute timing
PASS AnimationEffectReadOnly interface: operation getComputedTiming()
PASS KeyframeEffectReadOnly interface: existence and properties of interface object
-FAIL KeyframeEffectReadOnly interface object length assert_equals: wrong value for KeyframeEffectReadOnly.length expected 1 but got 2
+PASS KeyframeEffectReadOnly interface object length
PASS KeyframeEffectReadOnly interface object name
PASS KeyframeEffectReadOnly interface: existence and properties of interface prototype object
PASS KeyframeEffectReadOnly interface: existence and properties of interface prototype object's "constructor" property
@@ -24,7 +24,7 @@
PASS AnimationEffectReadOnly interface: new KeyframeEffectReadOnly(null, null) must inherit property "timing" with the proper type
PASS AnimationEffectReadOnly interface: new KeyframeEffectReadOnly(null, null) must inherit property "getComputedTiming()" with the proper type
PASS KeyframeEffect interface: existence and properties of interface object
-FAIL KeyframeEffect interface object length assert_equals: wrong value for KeyframeEffect.length expected 1 but got 2
+PASS KeyframeEffect interface object length
PASS KeyframeEffect interface object name
PASS KeyframeEffect interface: existence and properties of interface prototype object
PASS KeyframeEffect interface: existence and properties of interface prototype object's "constructor" property
Modified: trunk/Source/WebCore/ChangeLog (228411 => 228412)
--- trunk/Source/WebCore/ChangeLog 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/ChangeLog 2018-02-13 01:28:27 UTC (rev 228412)
@@ -1,3 +1,34 @@
+2018-02-12 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Support the copy constructors for KeyframeEffectReadOnly and KeyframeEffect
+ https://bugs.webkit.org/show_bug.cgi?id=182712
+
+ Reviewed by Dean Jackson.
+
+ We now support the variants for the KeyframeEffectReadOnly and KeyframeEffect constructors where
+ another KeyframeEffectReadOnly is provided as a source. All timing, keyframe and target properties
+ of that source are copied on the newly-constructed KeyframeEffect.
+
+ To support copying properties, we add new copyPropertiesFromSource() methods to
+ AnimationEffectTimingReadOnly and KeyframeEffectReadOnly to encapsulate copying various
+ member variables in the relevant classes. Copying properties of the backing KeyframeList
+ is performed in KeyframeEffectReadOnly::copyPropertiesFromSource() via public KeyframeList
+ methods.
+
+ * animation/AnimationEffectTimingReadOnly.cpp:
+ (WebCore::AnimationEffectTimingReadOnly::copyPropertiesFromSource):
+ * animation/AnimationEffectTimingReadOnly.h:
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::create):
+ * animation/KeyframeEffect.h:
+ * animation/KeyframeEffect.idl:
+ * animation/KeyframeEffectOptions.idl:
+ * animation/KeyframeEffectReadOnly.cpp:
+ (WebCore::KeyframeEffectReadOnly::create):
+ (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
+ * animation/KeyframeEffectReadOnly.h:
+ * animation/KeyframeEffectReadOnly.idl:
+
2018-02-12 Zalan Bujtas <za...@apple.com>
[RenderTreeBuilder] Introduce RenderTreebuilder::takeChild
Modified: trunk/Source/WebCore/animation/AnimationEffectTimingReadOnly.cpp (228411 => 228412)
--- trunk/Source/WebCore/animation/AnimationEffectTimingReadOnly.cpp 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/AnimationEffectTimingReadOnly.cpp 2018-02-13 01:28:27 UTC (rev 228412)
@@ -80,6 +80,18 @@
return { };
}
+void AnimationEffectTimingReadOnly::copyPropertiesFromSource(AnimationEffectTimingReadOnly* source)
+{
+ m_fill = source->m_fill;
+ m_delay = source->m_delay;
+ m_endDelay = source->m_endDelay;
+ m_direction = source->m_direction;
+ m_iterations = source->m_iterations;
+ m_timingFunction = source->m_timingFunction;
+ m_iterationStart = source->m_iterationStart;
+ m_iterationDuration = source->m_iterationDuration;
+}
+
ExceptionOr<void> AnimationEffectTimingReadOnly::setIterationStart(double iterationStart)
{
// https://drafts.csswg.org/web-animations-1/#dom-animationeffecttiming-iterationstart
Modified: trunk/Source/WebCore/animation/AnimationEffectTimingReadOnly.h (228411 => 228412)
--- trunk/Source/WebCore/animation/AnimationEffectTimingReadOnly.h 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/AnimationEffectTimingReadOnly.h 2018-02-13 01:28:27 UTC (rev 228412)
@@ -48,6 +48,7 @@
bool isAnimationEffectTiming() const { return m_classType == AnimationEffectTimingClass; }
ExceptionOr<void> setProperties(std::optional<Variant<double, KeyframeEffectOptions>>&&);
+ void copyPropertiesFromSource(AnimationEffectTimingReadOnly*);
double bindingsDelay() const { return secondsToWebAnimationsAPITime(m_delay); }
void setBindingsDelay(double delay) { m_delay = Seconds::fromMilliseconds(delay); }
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2018-02-13 01:28:27 UTC (rev 228412)
@@ -44,6 +44,13 @@
return WTFMove(keyframeEffect);
}
+ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(JSC::ExecState&, Ref<KeyframeEffectReadOnly>&& source)
+{
+ auto keyframeEffect = adoptRef(*new KeyframeEffect(AnimationEffectTiming::create(), nullptr));
+ keyframeEffect->copyPropertiesFromSource(WTFMove(source));
+ return WTFMove(keyframeEffect);
+}
+
KeyframeEffect::KeyframeEffect(Ref<AnimationEffectTimingReadOnly>&& timing, Element* target)
: KeyframeEffectReadOnly(KeyframeEffectClass, WTFMove(timing), target)
{
Modified: trunk/Source/WebCore/animation/KeyframeEffect.h (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffect.h 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffect.h 2018-02-13 01:28:27 UTC (rev 228412)
@@ -38,6 +38,7 @@
class KeyframeEffect final : public KeyframeEffectReadOnly {
public:
static ExceptionOr<Ref<KeyframeEffect>> create(JSC::ExecState&, Element*, JSC::Strong<JSC::JSObject>&&, std::optional<Variant<double, KeyframeEffectOptions>>&&);
+ static ExceptionOr<Ref<KeyframeEffect>> create(JSC::ExecState&, Ref<KeyframeEffectReadOnly>&&);
~KeyframeEffect() { }
void setIterationComposite(IterationCompositeOperation iterationCompositeOperation) { m_iterationCompositeOperation = iterationCompositeOperation; }
Modified: trunk/Source/WebCore/animation/KeyframeEffect.idl (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffect.idl 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffect.idl 2018-02-13 01:28:27 UTC (rev 228412)
@@ -28,7 +28,8 @@
Exposed=Window,
ConstructorMayThrowException,
ConstructorCallWith=ScriptState,
- Constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options)
+ Constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options),
+ Constructor(KeyframeEffectReadOnly source)
] interface KeyframeEffect : KeyframeEffectReadOnly {
inherit attribute IterationCompositeOperation iterationComposite;
inherit attribute CompositeOperation composite;
Modified: trunk/Source/WebCore/animation/KeyframeEffectOptions.idl (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffectOptions.idl 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffectOptions.idl 2018-02-13 01:28:27 UTC (rev 228412)
@@ -1,3 +1,27 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
dictionary KeyframeEffectOptions : AnimationEffectTimingProperties {
IterationCompositeOperation iterationComposite = "replace";
Modified: trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp 2018-02-13 01:28:27 UTC (rev 228412)
@@ -399,6 +399,13 @@
return WTFMove(keyframeEffect);
}
+ExceptionOr<Ref<KeyframeEffectReadOnly>> KeyframeEffectReadOnly::create(JSC::ExecState&, Ref<KeyframeEffectReadOnly>&& source)
+{
+ auto keyframeEffect = adoptRef(*new KeyframeEffectReadOnly(KeyframeEffectReadOnlyClass, AnimationEffectTimingReadOnly::create(), nullptr));
+ keyframeEffect->copyPropertiesFromSource(WTFMove(source));
+ return WTFMove(keyframeEffect);
+}
+
KeyframeEffectReadOnly::KeyframeEffectReadOnly(ClassType classType, Ref<AnimationEffectTimingReadOnly>&& timing, Element* target)
: AnimationEffectReadOnly(classType, WTFMove(timing))
, m_target(target)
@@ -406,6 +413,27 @@
{
}
+void KeyframeEffectReadOnly::copyPropertiesFromSource(Ref<KeyframeEffectReadOnly>&& source)
+{
+ m_target = source->m_target;
+ m_offsets = source->m_offsets;
+ m_timingFunctions = source->m_timingFunctions;
+ m_compositeOperation = source->m_compositeOperation;
+ m_compositeOperations = source->m_compositeOperations;
+ m_iterationCompositeOperation = source->m_iterationCompositeOperation;
+
+ timing()->copyPropertiesFromSource(source->timing());
+
+ KeyframeList keyframeList("keyframe-effect-" + createCanonicalUUIDString());
+ for (auto& keyframe : source->m_keyframes.keyframes()) {
+ KeyframeValue keyframeValue(keyframe.key(), RenderStyle::clonePtr(*keyframe.style()));
+ for (auto propertyId : keyframe.properties())
+ keyframeValue.addProperty(propertyId);
+ keyframeList.insert(WTFMove(keyframeValue));
+ }
+ m_keyframes = WTFMove(keyframeList);
+}
+
Vector<Strong<JSObject>> KeyframeEffectReadOnly::getKeyframes(ExecState& state)
{
// https://drafts.csswg.org/web-animations-1/#dom-keyframeeffectreadonly-getkeyframes
Modified: trunk/Source/WebCore/animation/KeyframeEffectReadOnly.h (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffectReadOnly.h 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffectReadOnly.h 2018-02-13 01:28:27 UTC (rev 228412)
@@ -44,6 +44,7 @@
, public CSSPropertyBlendingClient {
public:
static ExceptionOr<Ref<KeyframeEffectReadOnly>> create(JSC::ExecState&, Element*, JSC::Strong<JSC::JSObject>&&, std::optional<Variant<double, KeyframeEffectOptions>>&&);
+ static ExceptionOr<Ref<KeyframeEffectReadOnly>> create(JSC::ExecState&, Ref<KeyframeEffectReadOnly>&&);
~KeyframeEffectReadOnly() { }
struct BasePropertyIndexedKeyframe {
@@ -98,7 +99,9 @@
#endif
protected:
+ void copyPropertiesFromSource(Ref<KeyframeEffectReadOnly>&&);
ExceptionOr<void> processKeyframes(JSC::ExecState&, JSC::Strong<JSC::JSObject>&&);
+
IterationCompositeOperation m_iterationCompositeOperation { IterationCompositeOperation::Replace };
CompositeOperation m_compositeOperation { CompositeOperation::Replace };
Modified: trunk/Source/WebCore/animation/KeyframeEffectReadOnly.idl (228411 => 228412)
--- trunk/Source/WebCore/animation/KeyframeEffectReadOnly.idl 2018-02-13 01:12:28 UTC (rev 228411)
+++ trunk/Source/WebCore/animation/KeyframeEffectReadOnly.idl 2018-02-13 01:28:27 UTC (rev 228412)
@@ -26,9 +26,11 @@
[
EnabledAtRuntime=WebAnimations,
Exposed=Window,
+ JSGenerateToNativeObject,
ConstructorMayThrowException,
ConstructorCallWith=ScriptState,
- Constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options)
+ Constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options),
+ Constructor(KeyframeEffectReadOnly source)
] interface KeyframeEffectReadOnly : AnimationEffectReadOnly {
readonly attribute Element? target;
readonly attribute IterationCompositeOperation iterationComposite;