WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 215625
PannerNode's rolloffFactor should be clamped to [0, 1] internally when distanceModel is "linear"
https://bugs.webkit.org/show_bug.cgi?id=215625
Summary
PannerNode's rolloffFactor should be clamped to [0, 1] internally when distan...
Chris Dumez
Reported
2020-08-18 14:19:36 PDT
PannerNode.rolloffFactor setter should clamp value to [0, 1] when distanceModel is "linear": -
https://www.w3.org/TR/webaudio/#dom-pannernode-rollofffactor
Attachments
Patch
(5.67 KB, patch)
2020-08-18 14:52 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(5.60 KB, patch)
2020-08-18 15:36 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2020-08-18 14:52:31 PDT
Created
attachment 406814
[details]
Patch
Darin Adler
Comment 2
2020-08-18 15:03:29 PDT
Comment on
attachment 406814
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406814&action=review
> Source/WebCore/platform/audio/Distance.cpp:72 > + auto clampedRolloffFactor = std::min(m_rolloffFactor, 1.0);
This says clamped but it only does the 1.0 half of the clamping. I’d expect to see std::max or std::clamp here.
Darin Adler
Comment 3
2020-08-18 15:04:37 PDT
Comment on
attachment 406814
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406814&action=review
>> Source/WebCore/platform/audio/Distance.cpp:72 >> + auto clampedRolloffFactor = std::min(m_rolloffFactor, 1.0); > > This says clamped but it only does the 1.0 half of the clamping. I’d expect to see std::max or std::clamp here.
to handle the 0.0 minimum.
Chris Dumez
Comment 4
2020-08-18 15:11:17 PDT
(In reply to Darin Adler from
comment #3
)
> Comment on
attachment 406814
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=406814&action=review
> > >> Source/WebCore/platform/audio/Distance.cpp:72 > >> + auto clampedRolloffFactor = std::min(m_rolloffFactor, 1.0); > > > > This says clamped but it only does the 1.0 half of the clamping. I’d expect to see std::max or std::clamp here. > > to handle the 0.0 minimum.
We already throw an exception in the setter if the JS tries to set a negative value. Therefore, we only need to make sure the value is no more than 1.
Chris Dumez
Comment 5
2020-08-18 15:12:23 PDT
(In reply to Chris Dumez from
comment #4
)
> (In reply to Darin Adler from
comment #3
) > > Comment on
attachment 406814
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=406814&action=review
> > > > >> Source/WebCore/platform/audio/Distance.cpp:72 > > >> + auto clampedRolloffFactor = std::min(m_rolloffFactor, 1.0); > > > > > > This says clamped but it only does the 1.0 half of the clamping. I’d expect to see std::max or std::clamp here. > > > > to handle the 0.0 minimum. > > We already throw an exception in the setter if the JS tries to set a > negative value. Therefore, we only need to make sure the value is no more > than 1.
From
https://www.w3.org/TR/webaudio/#dom-pannernode-rollofffactor
: "A RangeError exception MUST be thrown if this is set to a negative value."
Chris Dumez
Comment 6
2020-08-18 15:15:41 PDT
Comment on
attachment 406814
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406814&action=review
> Source/WebCore/Modules/webaudio/PannerNode.cpp:282 > return Exception { RangeError, "rolloffFactor cannot be set to a negative value"_s };
Throwing happens here if value is negative.
Chris Dumez
Comment 7
2020-08-18 15:36:16 PDT
Created
attachment 406819
[details]
Patch
EWS
Comment 8
2020-08-18 16:15:33 PDT
Committed
r265838
: <
https://trac.webkit.org/changeset/265838
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 406819
[details]
.
Radar WebKit Bug Importer
Comment 9
2020-08-18 16:16:16 PDT
<
rdar://problem/67360120
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug