Skip to content

Commit

Permalink
Pass idlharness.window.html
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland committed Oct 6, 2024
1 parent 5da0828 commit 387df2b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/init-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export function initPolyfill() {
}

if (
!Reflect.defineProperty(window, 'ScrollTimeline', { value: ScrollTimeline })
!Reflect.defineProperty(window, 'ScrollTimeline', { value: ScrollTimeline, writable: true, configurable: true })
) {
throw Error(
'Error installing ScrollTimeline polyfill: could not attach ScrollTimeline to window'
);
}
if (
!Reflect.defineProperty(window, 'ViewTimeline', { value: ViewTimeline })
!Reflect.defineProperty(window, 'ViewTimeline', { value: ViewTimeline, writable: true, configurable: true })
) {
throw Error(
'Error installing ViewTimeline polyfill: could not attach ViewTimeline to window'
Expand Down
38 changes: 18 additions & 20 deletions src/scroll-timeline-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export function _getStlOptions(scrollTimeline) {
}

export class ScrollTimeline {
constructor(options) {
constructor(options = {}) {
scrollTimelineOptions.set(this, {
source: null,
axis: DEFAULT_TIMELINE_AXIS,
Expand Down Expand Up @@ -405,24 +405,10 @@ export class ScrollTimeline {
updateInternal(this);
}

set source(element) {
updateSource(this, element);
updateInternal(this);
}

get source() {
return scrollTimelineOptions.get(this).source;
}

set axis(axis) {
if (!isValidAxis(axis)) {
throw TypeError("Invalid axis");
}

scrollTimelineOptions.get(this).axis = axis;
updateInternal(this);
}

get axis() {
return scrollTimelineOptions.get(this).axis;
}
Expand Down Expand Up @@ -480,6 +466,16 @@ export class ScrollTimeline {
return true;
}
}
// Extend AnimationTimeline
Object.setPrototypeOf(ScrollTimeline, AnimationTimeline);
Object.setPrototypeOf(ScrollTimeline.prototype, AnimationTimeline.prototype);
// Set toStringTag
Object.defineProperty(ScrollTimeline.prototype, Symbol.toStringTag, {value: "ScrollTimeline" });

// Make properties enumerable
Object.defineProperty(ScrollTimeline.prototype, 'source', {enumerable: true, set: undefined});
Object.defineProperty(ScrollTimeline.prototype, 'axis', {enumerable: true, set: undefined});


// Methods for calculation of the containing block.
// See https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block.
Expand Down Expand Up @@ -826,7 +822,7 @@ export class ViewTimeline extends ScrollTimeline {
// Proceeding under the assumption that subject will be added to
// ViewTimelineOptions. Inferring the source from the subject if not
// explicitly set.
constructor(options) {
constructor(options = {}) {
super(options);
const details = scrollTimelineOptions.get(this);
details.subject = options && options.subject ? options.subject : undefined;
Expand Down Expand Up @@ -855,10 +851,6 @@ export class ViewTimeline extends ScrollTimeline {
return scrollTimelineOptions.get(this).source;
}

set source(source) {
throw new Error("Cannot set the source of a view timeline");
}

get subject() {
return scrollTimelineOptions.get(this).subject;
}
Expand Down Expand Up @@ -893,3 +885,9 @@ export class ViewTimeline extends ScrollTimeline {
}

}

// Make properties enumerable
Object.defineProperty(ViewTimeline.prototype, 'subject', {enumerable: true, set: undefined});
Object.defineProperty(ViewTimeline.prototype, 'startOffset', {enumerable: true, set: undefined});
Object.defineProperty(ViewTimeline.prototype, 'endOffset', {enumerable: true, set: undefined});

24 changes: 13 additions & 11 deletions test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ PASS /scroll-animations/scroll-timelines/current-time-root-scroller.html current
PASS /scroll-animations/scroll-timelines/current-time-writing-modes.html currentTime handles direction: rtl correctly
PASS /scroll-animations/scroll-timelines/current-time-writing-modes.html currentTime handles writing-mode: vertical-rl correctly
PASS /scroll-animations/scroll-timelines/current-time-writing-modes.html currentTime handles writing-mode: vertical-lr correctly
PASS /scroll-animations/scroll-timelines/duration.html The duration of a scroll timeline is 100%
PASS /scroll-animations/scroll-timelines/effect-updateTiming.html Allows setting the delay to a positive number
PASS /scroll-animations/scroll-timelines/effect-updateTiming.html Allows setting the delay to a negative number
PASS /scroll-animations/scroll-timelines/effect-updateTiming.html Allows setting the delay of an animation in progress: positive delay that causes the animation to be no longer in-effect
Expand Down Expand Up @@ -791,27 +792,27 @@ PASS /scroll-animations/scroll-timelines/idlharness.window.html Element includes
PASS /scroll-animations/scroll-timelines/idlharness.window.html Element includes NonDocumentTypeChildNode: member names are unique
PASS /scroll-animations/scroll-timelines/idlharness.window.html Element includes ChildNode: member names are unique
PASS /scroll-animations/scroll-timelines/idlharness.window.html Element includes Slottable: member names are unique
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: existence and properties of interface object
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface object length
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: existence and properties of interface object
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface object length
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface object name
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: existence and properties of interface prototype object
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: existence and properties of interface prototype object
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: existence and properties of interface prototype object's "constructor" property
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: existence and properties of interface prototype object's @@unscopables property
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: attribute source
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: attribute axis
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: attribute source
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: attribute axis
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline must be primary interface of new ScrollTimeline()
FAIL /scroll-animations/scroll-timelines/idlharness.window.html Stringification of new ScrollTimeline()
PASS /scroll-animations/scroll-timelines/idlharness.window.html Stringification of new ScrollTimeline()
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: new ScrollTimeline() must inherit property "source" with the proper type
PASS /scroll-animations/scroll-timelines/idlharness.window.html ScrollTimeline interface: new ScrollTimeline() must inherit property "axis" with the proper type
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: existence and properties of interface object
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface object length
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: existence and properties of interface object
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface object length
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface object name
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: existence and properties of interface prototype object
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: existence and properties of interface prototype object's "constructor" property
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: existence and properties of interface prototype object's @@unscopables property
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: attribute subject
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: attribute startOffset
FAIL /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: attribute endOffset
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: attribute subject
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: attribute startOffset
PASS /scroll-animations/scroll-timelines/idlharness.window.html ViewTimeline interface: attribute endOffset
PASS /scroll-animations/scroll-timelines/intrinsic-iteration-duration.tentative.html Computed duration in percent even when specified in ms
FAIL /scroll-animations/scroll-timelines/intrinsic-iteration-duration.tentative.html Time-based duration normalized to fill animation range.
PASS /scroll-animations/scroll-timelines/intrinsic-iteration-duration.tentative.html Time-based duration normalized to preserve proportional delays.
Expand Down Expand Up @@ -1026,6 +1027,7 @@ PASS /scroll-animations/view-timelines/block-view-timeline-current-time.tentativ
FAIL /scroll-animations/view-timelines/block-view-timeline-nested-subject.tentative.html View timeline with subject that is not a direct descendant of the scroll container
FAIL /scroll-animations/view-timelines/change-animation-range-updates-play-state.html Changing the animation range updates the play state
FAIL /scroll-animations/view-timelines/contain-alignment.html Stability of animated elements aligned to the bounds of a contain region
PASS /scroll-animations/view-timelines/duration.html The duration of a view timeline is 100%
PASS /scroll-animations/view-timelines/fieldset-source.html Fieldset is a valid source for a view timeline
FAIL /scroll-animations/view-timelines/get-keyframes-with-timeline-offset.html Report specified timeline offsets
FAIL /scroll-animations/view-timelines/get-keyframes-with-timeline-offset.html Computed offsets can be outside [0,1] for keyframes with timeline offsets
Expand Down

0 comments on commit 387df2b

Please sign in to comment.