⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 233667 in webkit


Ignore:
Timestamp:
Jul 9, 2018, 4:52:54 PM (8 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
https://bugs.webkit.org/show_bug.cgi?id=186498
<rdar://problem/41000205>
LayoutTests/imported/w3c:

Reviewed by Dean Jackson.

Mark 4 new WPT progressions.

  • web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt:

Source/WebCore:

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:
Location:
trunk
Files:
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r233666 r233667  
     12018-07-09  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=186498
     5        <rdar://problem/41000205>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Mark 4 new WPT progressions.
     10
     11        * web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt:
     12
    1132018-07-09  Antoine Quint  <graouts@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/DocumentTimeline/constructor-expected.txt

    r227598 r233667  
    11
    2 FAIL An origin time of zero is used when none is supplied function is not a constructor (evaluating 'new DocumentTimeline()')
    3 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 })')
    4 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 })')
    5 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 })')
     2PASS An origin time of zero is used when none is supplied
     3PASS A zero origin time produces a document timeline with a current time identical to the default document timeline
     4PASS A positive origin time makes the document timeline's current time lag behind the default document timeline
     5PASS A negative origin time makes the document timeline's current time run ahead of the default document timeline
    66
  • trunk/Source/WebCore/CMakeLists.txt

    r233443 r233667  
    455455    animation/ComputedTimingProperties.idl
    456456    animation/DocumentTimeline.idl
     457    animation/DocumentTimelineOptions.idl
    457458    animation/FillMode.idl
    458459    animation/IterationCompositeOperation.idl
  • trunk/Source/WebCore/ChangeLog

    r233666 r233667  
     12018-07-09  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
     4        https://bugs.webkit.org/show_bug.cgi?id=186498
     5        <rdar://problem/41000205>
     6       
     7        Reviewed by Dean Jackson.
     8
     9        Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided
     10        origin time. To ensure all DocumentTimeline instances report matching current times, we read the
     11        current time from the "main" document timeline, the one created by the Document automatically.
     12
     13        * CMakeLists.txt:
     14        * DerivedSources.make:
     15        * Sources.txt:
     16        * WebCore.xcodeproj/project.pbxproj:
     17        * animation/DocumentTimeline.cpp:
     18        (WebCore::DocumentTimeline::create):
     19        (WebCore::DocumentTimeline::DocumentTimeline):
     20        (WebCore::DocumentTimeline::currentTime):
     21        * animation/DocumentTimeline.h:
     22        * animation/DocumentTimeline.idl:
     23        * animation/DocumentTimelineOptions.h:
     24        * animation/DocumentTimelineOptions.idl:
     25
    1262018-07-09  Antoine Quint  <graouts@apple.com>
    227
  • trunk/Source/WebCore/DerivedSources.make

    r233443 r233667  
    375375    $(WebCore)/animation/CSSTransition.idl \
    376376    $(WebCore)/animation/DocumentTimeline.idl \
     377    $(WebCore)/animation/DocumentTimelineOptions.idl \
    377378    $(WebCore)/animation/FillMode.idl \
    378379    $(WebCore)/animation/IterationCompositeOperation.idl \
  • trunk/Source/WebCore/Sources.txt

    r233520 r233667  
    24972497JSCustomEvent.cpp
    24982498JSDocumentTimeline.cpp
     2499JSDocumentTimelineOptions.cpp
    24992500JSDOMApplicationCache.cpp
    25002501JSDOMCSSNamespace.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r233520 r233667  
    20282028                715AD7212050513F00D592DC /* CSSTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = 7123C186204739BA00789392 /* CSSTransition.h */; };
    20292029                716E55B020DBABF100F0CF29 /* DocumentAnimationScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 716E55AD20DBABDC00F0CF29 /* DocumentAnimationScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2030                71729F7B20F3BA4900801CE6 /* DocumentTimelineOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2031                71729F7E20F3BB4700801CE6 /* JSDocumentTimelineOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */; };
    20302032                71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
    20312033                71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; };
     
    91069108                716FA0FF1DB26591007323CC /* volume-slider.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "volume-slider.css"; sourceTree = "<group>"; };
    91079109                716FA1001DB26591007323CC /* volume-slider.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "volume-slider.js"; sourceTree = "<group>"; };
     9110                71729F7920F3BA3900801CE6 /* DocumentTimelineOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentTimelineOptions.idl; sourceTree = "<group>"; };
     9111                71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentTimelineOptions.h; sourceTree = "<group>"; };
     9112                71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDocumentTimelineOptions.h; sourceTree = "<group>"; };
     9113                71729F7D20F3BABA00801CE6 /* JSDocumentTimelineOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentTimelineOptions.cpp; sourceTree = "<group>"; };
    91089114                7177E2461DB80D2F00919A0B /* media-controller-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "media-controller-support.js"; sourceTree = "<group>"; };
    91099115                7177E2471DB80D2F00919A0B /* mute-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "mute-support.js"; sourceTree = "<group>"; };
     
    1581215818                                71025EDB1F99F1A8004A250C /* JSDocumentTimeline.cpp */,
    1581315819                                71025EDC1F99F1A8004A250C /* JSDocumentTimeline.h */,
     15820                                71729F7D20F3BABA00801CE6 /* JSDocumentTimelineOptions.cpp */,
     15821                                71729F7C20F3BAB900801CE6 /* JSDocumentTimelineOptions.h */,
    1581415822                                712BE4841FE867C2002031CC /* JSFillMode.cpp */,
    1581515823                                712BE4851FE86818002031CC /* JSFillMode.h */,
     
    1953319541                                71025EC51F99F096004A250C /* DocumentTimeline.h */,
    1953419542                                71025ECA1F99F096004A250C /* DocumentTimeline.idl */,
     19543                                71729F7A20F3BA3A00801CE6 /* DocumentTimelineOptions.h */,
     19544                                71729F7920F3BA3900801CE6 /* DocumentTimelineOptions.idl */,
    1953519545                                712BE4811FE865D4002031CC /* FillMode.h */,
    1953619546                                712BE4821FE865D5002031CC /* FillMode.idl */,
     
    2754527555                                A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
    2754627556                                946D372E1D6CB2940077084F /* CSSParser.h in Headers */,
     27557                                E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */,
    2754727558                                949C77011D6E1D9800C0DE4F /* CSSParserFastPaths.h in Headers */,
    2754827559                                946D37441D6CF7B20077084F /* CSSParserIdioms.h in Headers */,
     
    2771827729                                0B90561A0F2578BF0095FF6A /* DocumentThreadableLoader.h in Headers */,
    2771927730                                71025ED01F99F0CE004A250C /* DocumentTimeline.h in Headers */,
     27731                                71729F7B20F3BA4900801CE6 /* DocumentTimelineOptions.h in Headers */,
    2772027732                                86D982F7125C154000AD9E3D /* DocumentTiming.h in Headers */,
    2772127733                                A8185F3909765766005826D9 /* DocumentType.h in Headers */,
     
    2851128523                                1A494EDF0A123F4C00FDAFC1 /* JSDocumentFragment.h in Headers */,
    2851228524                                71025EE01F99F1EC004A250C /* JSDocumentTimeline.h in Headers */,
     28525                                71729F7E20F3BB4700801CE6 /* JSDocumentTimelineOptions.h in Headers */,
    2851328526                                65DF31F609D1CC60000BE325 /* JSDocumentType.h in Headers */,
    2851428527                                7C57BFE71EDE2F6100534A48 /* JSDOMAbstractOperations.h in Headers */,
     
    2879528808                                E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */,
    2879628809                                A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */,
    28797                                 E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */,
    2879828810                                830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */,
    2879928811                                65DF31FC09D1CC60000BE325 /* JSMutationEvent.h in Headers */,
  • trunk/Source/WebCore/animation/DocumentTimeline.cpp

    r233585 r233667  
    4343Ref<DocumentTimeline> DocumentTimeline::create(Document& document)
    4444{
    45     return adoptRef(*new DocumentTimeline(document));
    46 }
    47 
    48 DocumentTimeline::DocumentTimeline(Document& document)
     45    return adoptRef(*new DocumentTimeline(document, 0_s));
     46}
     47
     48Ref<DocumentTimeline> DocumentTimeline::create(Document& document, DocumentTimelineOptions&& options)
     49{
     50    return adoptRef(*new DocumentTimeline(document, Seconds::fromMilliseconds(options.originTime)));
     51}
     52
     53DocumentTimeline::DocumentTimeline(Document& document, Seconds originTime)
    4954    : AnimationTimeline(DocumentTimelineClass)
    5055    , m_document(&document)
     56    , m_originTime(originTime)
    5157    , m_animationScheduleTimer(*this, &DocumentTimeline::animationScheduleTimerFired)
    5258#if !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     
    134140    if (m_paused || m_isSuspended || !m_document || !m_document->domWindow())
    135141        return AnimationTimeline::currentTime();
     142
     143    if (auto* mainDocumentTimeline = m_document->existingTimeline()) {
     144        if (mainDocumentTimeline != this) {
     145            if (auto mainDocumentTimelineCurrentTime = mainDocumentTimeline->currentTime())
     146                return mainDocumentTimelineCurrentTime.value() - m_originTime;
     147            return std::nullopt;
     148        }
     149    }
    136150
    137151#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     
    166180        });
    167181    }
    168     return m_cachedCurrentTime;
     182    return m_cachedCurrentTime.value() - m_originTime;
    169183}
    170184
  • trunk/Source/WebCore/animation/DocumentTimeline.h

    r233394 r233667  
    2727
    2828#include "AnimationTimeline.h"
     29#include "DocumentTimelineOptions.h"
    2930#include "GenericTaskQueue.h"
    3031#include "Timer.h"
     
    4041public:
    4142    static Ref<DocumentTimeline> create(Document&);
     43    static Ref<DocumentTimeline> create(Document&, DocumentTimelineOptions&&);
    4244    ~DocumentTimeline();
    4345
     
    7577
    7678private:
    77     DocumentTimeline(Document&);
     79    DocumentTimeline(Document&, Seconds);
    7880
    7981    void scheduleInvalidationTaskIfNeeded();
     
    8789
    8890    RefPtr<Document> m_document;
     91    Seconds m_originTime;
    8992    bool m_paused { false };
    9093    bool m_isSuspended { false };
  • trunk/Source/WebCore/animation/DocumentTimeline.idl

    r223779 r233667  
    2525
    2626[
    27     EnabledAtRuntime=WebAnimations
     27    EnabledAtRuntime=WebAnimations,
     28    Exposed=Window,
     29    ConstructorCallWith=Document,
     30    Constructor (optional DocumentTimelineOptions options)
    2831] interface DocumentTimeline : AnimationTimeline {
    2932};
  • trunk/Source/WebCore/animation/DocumentTimelineOptions.h

    r233666 r233667  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 [
    27     EnabledAtRuntime=WebAnimations
    28 ] interface DocumentTimeline : AnimationTimeline {
     26#pragma once
     27
     28#include "DOMHighResTimeStamp.h"
     29
     30namespace WebCore {
     31
     32struct DocumentTimelineOptions {
     33    DOMHighResTimeStamp originTime;
    2934};
     35
     36} // namespace WebCore
  • trunk/Source/WebCore/animation/DocumentTimelineOptions.idl

    r233666 r233667  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 [
    27     EnabledAtRuntime=WebAnimations
    28 ] interface DocumentTimeline : AnimationTimeline {
     26typedef double DOMHighResTimeStamp;
     27
     28dictionary DocumentTimelineOptions {
     29    DOMHighResTimeStamp originTime = 0;
    2930};
Note: See TracChangeset for help on using the changeset viewer.