Skip to content

Commit

Permalink
Alias webkitPreservesPitch as preservesPitch
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=214922
rdar://66579074

Reviewed by Tim Nguyen.

Alias webkitPreservesPitch as preservesPitch so web developers won't
have to branch anymore. We'll keep webkitPreservesPitch around for now
for compatibility.

* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/preserves-pitch-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/preserves-pitch.html:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https_include=HTML._-expected.txt:
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
(WebCore::HTMLMediaElement::preservesPitch const):
(WebCore::HTMLMediaElement::setPreservesPitch):
(WebCore::HTMLMediaElement::webkitPreservesPitch const): Deleted.
(WebCore::HTMLMediaElement::setWebkitPreservesPitch): Deleted.
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/HTMLMediaElement.idl:
* Source/WebKitLegacy/mac/DOM/DOMHTMLMediaElement.mm:
(-[DOMHTMLMediaElement webkitPreservesPitch]):
(-[DOMHTMLMediaElement setWebkitPreservesPitch:]):

Canonical link: https://commits.webkit.org/267341@main
  • Loading branch information
annevk committed Aug 28, 2023
1 parent 5b575ff commit 1c14031
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ PASS HTMLMediaElement interface: document.createElement("video") must inherit pr
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: document.createElement("video") must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "played" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1203,7 +1203,7 @@ PASS HTMLMediaElement interface: document.createElement("audio") must inherit pr
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: document.createElement("audio") must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "played" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1252,7 +1252,7 @@ PASS HTMLMediaElement interface: new Audio() must inherit property "getStartDate
PASS HTMLMediaElement interface: new Audio() must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: new Audio() must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: new Audio() must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "played" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1346,7 +1346,7 @@ PASS HTMLMediaElement interface: operation getStartDate()
PASS HTMLMediaElement interface: attribute paused
PASS HTMLMediaElement interface: attribute defaultPlaybackRate
PASS HTMLMediaElement interface: attribute playbackRate
FAIL HTMLMediaElement interface: attribute preservesPitch assert_true: The prototype object must have a property "preservesPitch" expected true got false
PASS HTMLMediaElement interface: attribute preservesPitch
PASS HTMLMediaElement interface: attribute played
PASS HTMLMediaElement interface: attribute seekable
PASS HTMLMediaElement interface: attribute ended
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
CONSOLE MESSAGE: Unhandled Promise Rejection: NotSupportedError: The operation is not supported.

Harness Error (FAIL), message = Unhandled rejection: The operation is not supported.

FAIL Test that preservesPitch is present and unprefixed. assert_true: expected true got false
PASS Test that preservesPitch is present and unprefixed.
PASS Test that preservesPitch is on by default
FAIL Setup Audio element and AudioContext promise_test: Unhandled rejection with value: object "NotSupportedError: The operation is not supported."
TIMEOUT The default playbackRate should not affect pitch Test timed out
NOTRUN The default playbackRate should not affect pitch, even with preservesPitch=false
NOTRUN Speed-ups should not change the pitch when preservesPitch=true
NOTRUN Slow-downs should not change the pitch when preservesPitch=true
NOTRUN Speed-ups should change the pitch when preservesPitch=false
NOTRUN Slow-downs should change the pitch when preservesPitch=false
PASS Setup Audio element and AudioContext
PASS The default playbackRate should not affect pitch
PASS The default playbackRate should not affect pitch, even with preservesPitch=false
PASS Speed-ups should not change the pitch when preservesPitch=true
PASS Slow-downs should not change the pitch when preservesPitch=true
FAIL Speed-ups should change the pitch when preservesPitch=false assert_approx_equals: The actual pitch should be close to the expected pitch. expected 880 +/- 21.55425219941349 but got 452.63929618768327
FAIL Slow-downs should change the pitch when preservesPitch=false assert_approx_equals: The actual pitch should be close to the expected pitch. expected 220 +/- 21.55425219941349 but got 0

Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
if ("preservesPitch" in HTMLAudioElement.prototype) {
return audio.preservesPitch;
}
if ("mozPreservesPitch" in HTMLAudioElement.prototype) {
return audio.mozPreservesPitch;
}
if ("webkitPreservesPitch" in HTMLAudioElement.prototype) {
return audio.webkitPreservesPitch;
}
Expand All @@ -25,8 +22,6 @@
function setPreservesPitch(audio, value) {
if ("preservesPitch" in HTMLAudioElement.prototype) {
audio.preservesPitch = value;
} else if ("mozPreservesPitch" in HTMLAudioElement.prototype) {
audio.mozPreservesPitch = value;
} else if ("webkitPreservesPitch" in HTMLAudioElement.prototype) {
audio.webkitPreservesPitch = value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ PASS HTMLMediaElement interface: document.createElement("video") must inherit pr
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: document.createElement("video") must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "played" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1203,7 +1203,7 @@ PASS HTMLMediaElement interface: document.createElement("audio") must inherit pr
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: document.createElement("audio") must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "played" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1252,7 +1252,7 @@ PASS HTMLMediaElement interface: new Audio() must inherit property "getStartDate
PASS HTMLMediaElement interface: new Audio() must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: new Audio() must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: new Audio() must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "played" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1346,7 +1346,7 @@ PASS HTMLMediaElement interface: operation getStartDate()
PASS HTMLMediaElement interface: attribute paused
PASS HTMLMediaElement interface: attribute defaultPlaybackRate
PASS HTMLMediaElement interface: attribute playbackRate
FAIL HTMLMediaElement interface: attribute preservesPitch assert_true: The prototype object must have a property "preservesPitch" expected true got false
PASS HTMLMediaElement interface: attribute preservesPitch
PASS HTMLMediaElement interface: attribute played
PASS HTMLMediaElement interface: attribute seekable
PASS HTMLMediaElement interface: attribute ended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ PASS HTMLMediaElement interface: document.createElement("video") must inherit pr
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: document.createElement("video") must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "played" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: document.createElement("video") must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1203,7 +1203,7 @@ PASS HTMLMediaElement interface: document.createElement("audio") must inherit pr
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: document.createElement("audio") must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "played" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: document.createElement("audio") must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1252,7 +1252,7 @@ PASS HTMLMediaElement interface: new Audio() must inherit property "getStartDate
PASS HTMLMediaElement interface: new Audio() must inherit property "paused" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "defaultPlaybackRate" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "playbackRate" with the proper type
FAIL HTMLMediaElement interface: new Audio() must inherit property "preservesPitch" with the proper type assert_inherits: property "preservesPitch" not found in prototype chain
PASS HTMLMediaElement interface: new Audio() must inherit property "preservesPitch" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "played" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "seekable" with the proper type
PASS HTMLMediaElement interface: new Audio() must inherit property "ended" with the proper type
Expand Down Expand Up @@ -1346,7 +1346,7 @@ PASS HTMLMediaElement interface: operation getStartDate()
PASS HTMLMediaElement interface: attribute paused
PASS HTMLMediaElement interface: attribute defaultPlaybackRate
PASS HTMLMediaElement interface: attribute playbackRate
FAIL HTMLMediaElement interface: attribute preservesPitch assert_true: The prototype object must have a property "preservesPitch" expected true got false
PASS HTMLMediaElement interface: attribute preservesPitch
PASS HTMLMediaElement interface: attribute played
PASS HTMLMediaElement interface: attribute seekable
PASS HTMLMediaElement interface: attribute ended
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/html/HTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ void HTMLMediaElement::loadResource(const URL& initialURL, ContentType& contentT

if (!autoplay() && !m_havePreparedToPlay)
m_player->setPreload(mediaSession().effectivePreloadForElement());
m_player->setPreservesPitch(m_webkitPreservesPitch);
m_player->setPreservesPitch(m_preservesPitch);
m_player->setPitchCorrectionAlgorithm(document().settings().pitchCorrectionAlgorithm());

if (!m_explicitlyMuted) {
Expand Down Expand Up @@ -3912,16 +3912,16 @@ void HTMLMediaElement::updatePlaybackRate()
m_player->setRate(requestedRate);
}

bool HTMLMediaElement::webkitPreservesPitch() const
bool HTMLMediaElement::preservesPitch() const
{
return m_webkitPreservesPitch;
return m_preservesPitch;
}

void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch)
void HTMLMediaElement::setPreservesPitch(bool preservesPitch)
{
INFO_LOG(LOGIDENTIFIER, preservesPitch);

m_webkitPreservesPitch = preservesPitch;
m_preservesPitch = preservesPitch;

if (!m_player)
return;
Expand Down
7 changes: 4 additions & 3 deletions Source/WebCore/html/HTMLMediaElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ class HTMLMediaElement
void setDefaultPlaybackRate(double) override;
WEBCORE_EXPORT double playbackRate() const override;
void setPlaybackRate(double) override;
WEBCORE_EXPORT bool preservesPitch() const;
WEBCORE_EXPORT void setPreservesPitch(bool);


// MediaTime versions of playback state
MediaTime currentMediaTime() const;
Expand All @@ -274,8 +277,6 @@ class HTMLMediaElement
WEBCORE_EXPORT void fastSeek(const MediaTime&);

void updatePlaybackRate();
WEBCORE_EXPORT bool webkitPreservesPitch() const;
WEBCORE_EXPORT void setWebkitPreservesPitch(bool);
Ref<TimeRanges> played() override;
Ref<TimeRanges> seekable() const override;
double seekableTimeRangesLastModifiedTime() const;
Expand Down Expand Up @@ -1070,7 +1071,7 @@ class HTMLMediaElement
double m_requestedPlaybackRate { 1 };
double m_reportedPlaybackRate { 1 };
double m_defaultPlaybackRate { 1 };
bool m_webkitPreservesPitch { true };
bool m_preservesPitch { true };
NetworkState m_networkState { NETWORK_EMPTY };
ReadyState m_readyState { HAVE_NOTHING };
ReadyState m_readyStateMaximum { HAVE_NOTHING };
Expand Down
6 changes: 4 additions & 2 deletions Source/WebCore/html/HTMLMediaElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ typedef (
readonly attribute boolean paused;
attribute double defaultPlaybackRate;
attribute double playbackRate;
[CEReactions=NotNeeded] attribute boolean preservesPitch;
readonly attribute TimeRanges played;
readonly attribute TimeRanges seekable;
readonly attribute boolean ended;
Expand All @@ -99,9 +100,10 @@ typedef (
attribute boolean muted;
[CEReactions=NotNeeded, Reflect=muted] attribute boolean defaultMuted;

// WebKit extensions
[CEReactions=NotNeeded] attribute boolean webkitPreservesPitch;
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=250871
[CEReactions=NotNeeded, ImplementedAs=preservesPitch] attribute boolean webkitPreservesPitch;

// FIXME: https://bugs.webkit.org/show_bug.cgi?id=250870
readonly attribute boolean webkitHasClosedCaptions;
attribute boolean webkitClosedCaptionsVisible;

Expand Down
4 changes: 2 additions & 2 deletions Source/WebKitLegacy/mac/DOM/DOMHTMLMediaElement.mm
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ - (void)setDefaultMuted:(BOOL)newDefaultMuted
- (BOOL)webkitPreservesPitch
{
WebCore::JSMainThreadNullState state;
return IMPL->webkitPreservesPitch();
return IMPL->preservesPitch();
}

- (void)setWebkitPreservesPitch:(BOOL)newWebkitPreservesPitch
{
WebCore::JSMainThreadNullState state;
IMPL->setWebkitPreservesPitch(newWebkitPreservesPitch);
IMPL->setPreservesPitch(newWebkitPreservesPitch);
}

- (BOOL)webkitHasClosedCaptions
Expand Down

0 comments on commit 1c14031

Please sign in to comment.