Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (233666 => 233667)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-07-09 23:52:54 UTC (rev 233667)
@@ -1,5 +1,17 @@
2018-07-09 Antoine Quint <grao...@apple.com>
+ [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
+ https://bugs.webkit.org/show_bug.cgi?id=186498
+ <rdar://problem/41000205>
+
+ Reviewed by Dean Jackson.
+
+ Mark 4 new WPT progressions.
+
+ * web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt:
+
+2018-07-09 Antoine Quint <grao...@apple.com>
+
[Web Animations] Support overlapping keyframes
https://bugs.webkit.org/show_bug.cgi?id=187481
<rdar://problem/41988674>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt (233666 => 233667)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt 2018-07-09 23:52:54 UTC (rev 233667)
@@ -1,6 +1,6 @@
-FAIL An origin time of zero is used when none is supplied function is not a constructor (evaluating 'new DocumentTimeline()')
-FAIL A zero origin time produces a document timeline with a current time identical to the default document timeline function is not a constructor (evaluating 'new DocumentTimeline({ originTime: 0 })')
-FAIL A positive origin time makes the document timeline's current time lag behind the default document timeline function is not a constructor (evaluating 'new DocumentTimeline({ originTime: 10 * MS_PER_SEC })')
-FAIL A negative origin time makes the document timeline's current time run ahead of the default document timeline function is not a constructor (evaluating 'new DocumentTimeline({ originTime: -10 * MS_PER_SEC })')
+PASS An origin time of zero is used when none is supplied
+PASS A zero origin time produces a document timeline with a current time identical to the default document timeline
+PASS A positive origin time makes the document timeline's current time lag behind the default document timeline
+PASS A negative origin time makes the document timeline's current time run ahead of the default document timeline
Modified: trunk/Source/WebCore/CMakeLists.txt (233666 => 233667)
--- trunk/Source/WebCore/CMakeLists.txt 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/CMakeLists.txt 2018-07-09 23:52:54 UTC (rev 233667)
@@ -454,6 +454,7 @@
animation/CompositeOperation.idl
animation/ComputedTimingProperties.idl
animation/DocumentTimeline.idl
+ animation/DocumentTimelineOptions.idl
animation/FillMode.idl
animation/IterationCompositeOperation.idl
animation/KeyframeAnimationOptions.idl
Modified: trunk/Source/WebCore/ChangeLog (233666 => 233667)
--- trunk/Source/WebCore/ChangeLog 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/ChangeLog 2018-07-09 23:52:54 UTC (rev 233667)
@@ -1,5 +1,30 @@
2018-07-09 Antoine Quint <grao...@apple.com>
+ [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
+ https://bugs.webkit.org/show_bug.cgi?id=186498
+ <rdar://problem/41000205>
+
+ Reviewed by Dean Jackson.
+
+ Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided
+ origin time. To ensure all DocumentTimeline instances report matching current times, we read the
+ current time from the "main" document timeline, the one created by the Document automatically.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * animation/DocumentTimeline.cpp:
+ (WebCore::DocumentTimeline::create):
+ (WebCore::DocumentTimeline::DocumentTimeline):
+ (WebCore::DocumentTimeline::currentTime):
+ * animation/DocumentTimeline.h:
+ * animation/DocumentTimeline.idl:
+ * animation/DocumentTimelineOptions.h:
+ * animation/DocumentTimelineOptions.idl:
+
+2018-07-09 Antoine Quint <grao...@apple.com>
+
[Web Animations] Support overlapping keyframes
https://bugs.webkit.org/show_bug.cgi?id=187481
<rdar://problem/41988674>
Modified: trunk/Source/WebCore/DerivedSources.make (233666 => 233667)
--- trunk/Source/WebCore/DerivedSources.make 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/DerivedSources.make 2018-07-09 23:52:54 UTC (rev 233667)
@@ -374,6 +374,7 @@
$(WebCore)/animation/CSSAnimation.idl \
$(WebCore)/animation/CSSTransition.idl \
$(WebCore)/animation/DocumentTimeline.idl \
+ $(WebCore)/animation/DocumentTimelineOptions.idl \
$(WebCore)/animation/FillMode.idl \
$(WebCore)/animation/IterationCompositeOperation.idl \
$(WebCore)/animation/KeyframeAnimationOptions.idl \
Modified: trunk/Source/WebCore/Sources.txt (233666 => 233667)
--- trunk/Source/WebCore/Sources.txt 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/Sources.txt 2018-07-09 23:52:54 UTC (rev 233667)
@@ -2496,6 +2496,7 @@
JSCustomElementRegistry.cpp
JSCustomEvent.cpp
JSDocumentTimeline.cpp
+JSDocumentTimelineOptions.cpp
JSDOMApplicationCache.cpp
JSDOMCSSNamespace.cpp
JSDOMCache.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (233666 => 233667)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-07-09 23:52:54 UTC (rev 233667)
@@ -2027,6 +2027,8 @@
715AD7202050513200D592DC /* DeclarativeAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 715AD71D2050512400D592DC /* DeclarativeAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
715AD7212050513F00D592DC /* CSSTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 7123C186204739BA00789392 /* CSSTransition.h */; };
716E55B020DBABF100F0CF29 /* DocumentAnimationScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 716E55AD20DBABDC00F0CF29 /* DocumentAnimationScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 71729F7B20F3BA4900801CE6 /* DocumentTimelineOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 71729F7E20F3BB4700801CE6 /* JSDocumentTimelineOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */; };
71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; };
71B28427203CEC4C0036AA5D /* JSCSSAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 71B28426203CEC0D0036AA5D /* JSCSSAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9105,6 +9107,10 @@
716FA0FE1DB26591007323CC /* tracks-button.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "tracks-button.js"; sourceTree = "<group>"; };
716FA0FF1DB26591007323CC /* volume-slider.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "volume-slider.css"; sourceTree = "<group>"; };
716FA1001DB26591007323CC /* volume-slider.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "volume-slider.js"; sourceTree = "<group>"; };
+ 71729F7920F3BA3900801CE6 /* DocumentTimelineOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentTimelineOptions.idl; sourceTree = "<group>"; };
+ 71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTimelineOptions.h; sourceTree = "<group>"; };
+ 71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDocumentTimelineOptions.h; sourceTree = "<group>"; };
+ 71729F7D20F3BABA00801CE6 /* JSDocumentTimelineOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentTimelineOptions.cpp; sourceTree = "<group>"; };
7177E2461DB80D2F00919A0B /* media-controller-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "media-controller-support.js"; sourceTree = "<group>"; };
7177E2471DB80D2F00919A0B /* mute-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "mute-support.js"; sourceTree = "<group>"; };
7177E2481DB80D2F00919A0B /* start-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "start-support.js"; sourceTree = "<group>"; };
@@ -15811,6 +15817,8 @@
7123C1842047399300789392 /* JSCSSTransition.h */,
71025EDB1F99F1A8004A250C /* JSDocumentTimeline.cpp */,
71025EDC1F99F1A8004A250C /* JSDocumentTimeline.h */,
+ 71729F7D20F3BABA00801CE6 /* JSDocumentTimelineOptions.cpp */,
+ 71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */,
712BE4841FE867C2002031CC /* JSFillMode.cpp */,
712BE4851FE86818002031CC /* JSFillMode.h */,
71247E281FEA5F61008C08CE /* JSIterationCompositeOperation.cpp */,
@@ -19532,6 +19540,8 @@
71025EC41F99F096004A250C /* DocumentTimeline.cpp */,
71025EC51F99F096004A250C /* DocumentTimeline.h */,
71025ECA1F99F096004A250C /* DocumentTimeline.idl */,
+ 71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */,
+ 71729F7920F3BA3900801CE6 /* DocumentTimelineOptions.idl */,
712BE4811FE865D4002031CC /* FillMode.h */,
712BE4821FE865D5002031CC /* FillMode.idl */,
71247E331FEA5F80008C08CE /* IterationCompositeOperation.h */,
@@ -27544,6 +27554,7 @@
94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */,
A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
946D372E1D6CB2940077084F /* CSSParser.h in Headers */,
+ E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */,
949C77011D6E1D9800C0DE4F /* CSSParserFastPaths.h in Headers */,
946D37441D6CF7B20077084F /* CSSParserIdioms.h in Headers */,
94DE5C961D8301BD00164F2A /* CSSParserImpl.h in Headers */,
@@ -27717,6 +27728,7 @@
AD6E71AD1668899D00320C13 /* DocumentSharedObjectPool.h in Headers */,
0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */,
71025ED01F99F0CE004A250C /* DocumentTimeline.h in Headers */,
+ 71729F7B20F3BA4900801CE6 /* DocumentTimelineOptions.h in Headers */,
86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */,
A8185F3909765766005826D9 /* DocumentType.h in Headers */,
973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */,
@@ -28510,6 +28522,7 @@
ADDA94C219687AA500453029 /* JSDocumentCustom.h in Headers */,
1A494EDF0A123F4C00FDAFC1 /* JSDocumentFragment.h in Headers */,
71025EE01F99F1EC004A250C /* JSDocumentTimeline.h in Headers */,
+ 71729F7E20F3BB4700801CE6 /* JSDocumentTimelineOptions.h in Headers */,
65DF31F609D1CC60000BE325 /* JSDocumentType.h in Headers */,
7C57BFE71EDE2F6100534A48 /* JSDOMAbstractOperations.h in Headers */,
1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */,
@@ -28794,7 +28807,6 @@
75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */,
E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */,
A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */,
- E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */,
830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */,
65DF31FC09D1CC60000BE325 /* JSMutationEvent.h in Headers */,
C6F0902D14327D4F00685849 /* JSMutationObserver.h in Headers */,
Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (233666 => 233667)
--- trunk/Source/WebCore/animation/DocumentTimeline.cpp 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp 2018-07-09 23:52:54 UTC (rev 233667)
@@ -42,12 +42,18 @@
Ref<DocumentTimeline> DocumentTimeline::create(Document& document)
{
- return adoptRef(*new DocumentTimeline(document));
+ return adoptRef(*new DocumentTimeline(document, 0_s));
}
-DocumentTimeline::DocumentTimeline(Document& document)
+Ref<DocumentTimeline> DocumentTimeline::create(Document& document, DocumentTimelineOptions&& options)
+{
+ return adoptRef(*new DocumentTimeline(document, Seconds::fromMilliseconds(options.originTime)));
+}
+
+DocumentTimeline::DocumentTimeline(Document& document, Seconds originTime)
: AnimationTimeline(DocumentTimelineClass)
, m_document(&document)
+ , m_originTime(originTime)
, m_animationScheduleTimer(*this, &DocumentTimeline::animationScheduleTimerFired)
#if !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
, m_animationResolutionTimer(*this, &DocumentTimeline::animationResolutionTimerFired)
@@ -134,6 +140,14 @@
if (m_paused || m_isSuspended || !m_document || !m_document->domWindow())
return AnimationTimeline::currentTime();
+ if (auto* mainDocumentTimeline = m_document->existingTimeline()) {
+ if (mainDocumentTimeline != this) {
+ if (auto mainDocumentTimelineCurrentTime = mainDocumentTimeline->currentTime())
+ return mainDocumentTimelineCurrentTime.value() - m_originTime;
+ return std::nullopt;
+ }
+ }
+
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
// If we're in the middle of firing a frame, either due to a requestAnimationFrame callback
// or scheduling an animation update, we want to ensure we use the same time we're using as
@@ -165,7 +179,7 @@
maybeClearCachedCurrentTime();
});
}
- return m_cachedCurrentTime;
+ return m_cachedCurrentTime.value() - m_originTime;
}
void DocumentTimeline::pause()
Modified: trunk/Source/WebCore/animation/DocumentTimeline.h (233666 => 233667)
--- trunk/Source/WebCore/animation/DocumentTimeline.h 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/animation/DocumentTimeline.h 2018-07-09 23:52:54 UTC (rev 233667)
@@ -26,6 +26,7 @@
#pragma once
#include "AnimationTimeline.h"
+#include "DocumentTimelineOptions.h"
#include "GenericTaskQueue.h"
#include "Timer.h"
#include <wtf/Ref.h>
@@ -39,6 +40,7 @@
{
public:
static Ref<DocumentTimeline> create(Document&);
+ static Ref<DocumentTimeline> create(Document&, DocumentTimelineOptions&&);
~DocumentTimeline();
Document* document() const { return m_document.get(); }
@@ -74,7 +76,7 @@
WEBCORE_EXPORT unsigned numberOfActiveAnimationsForTesting() const;
private:
- DocumentTimeline(Document&);
+ DocumentTimeline(Document&, Seconds);
void scheduleInvalidationTaskIfNeeded();
void performInvalidationTask();
@@ -86,6 +88,7 @@
void maybeClearCachedCurrentTime();
RefPtr<Document> m_document;
+ Seconds m_originTime;
bool m_paused { false };
bool m_isSuspended { false };
bool m_waitingOnVMIdle { false };
Modified: trunk/Source/WebCore/animation/DocumentTimeline.idl (233666 => 233667)
--- trunk/Source/WebCore/animation/DocumentTimeline.idl 2018-07-09 23:48:52 UTC (rev 233666)
+++ trunk/Source/WebCore/animation/DocumentTimeline.idl 2018-07-09 23:52:54 UTC (rev 233667)
@@ -24,6 +24,9 @@
*/
[
- EnabledAtRuntime=WebAnimations
+ EnabledAtRuntime=WebAnimations,
+ Exposed=Window,
+ ConstructorCallWith=Document,
+ Constructor (optional DocumentTimelineOptions options)
] interface DocumentTimeline : AnimationTimeline {
};
Copied: trunk/Source/WebCore/animation/DocumentTimelineOptions.h (from rev 233666, trunk/Source/WebCore/animation/DocumentTimeline.idl) (0 => 233667)
--- trunk/Source/WebCore/animation/DocumentTimelineOptions.h (rev 0)
+++ trunk/Source/WebCore/animation/DocumentTimelineOptions.h 2018-07-09 23:52:54 UTC (rev 233667)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "DOMHighResTimeStamp.h"
+
+namespace WebCore {
+
+struct DocumentTimelineOptions {
+ DOMHighResTimeStamp originTime;
+};
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/animation/DocumentTimelineOptions.idl (from rev 233666, trunk/Source/WebCore/animation/DocumentTimeline.idl) (0 => 233667)
--- trunk/Source/WebCore/animation/DocumentTimelineOptions.idl (rev 0)
+++ trunk/Source/WebCore/animation/DocumentTimelineOptions.idl 2018-07-09 23:52:54 UTC (rev 233667)
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+typedef double DOMHighResTimeStamp;
+
+dictionary DocumentTimelineOptions {
+ DOMHighResTimeStamp originTime = 0;
+};