haraken@, can you please take a look and let me know your feedback on the ...
4 years, 10 months ago
(2015-06-16 11:49:06 UTC)
#2
haraken@, can you please take a look and let me know your feedback on the
approach?
This is a WIP patch which, once agreed upon the approach, would be divided into
small logical patches.
4 years, 10 months ago
(2015-06-16 16:07:46 UTC)
#4
On 2015/06/16 11:53:03, vivekg_ wrote:
>
https://codereview.chromium.org/1186823014/diff/1/Source/modules/device_orien...
> File Source/modules/device_orientation/DeviceOrientationEvent.cpp (right):
>
>
https://codereview.chromium.org/1186823014/diff/1/Source/modules/device_orien...
> Source/modules/device_orientation/DeviceOrientationEvent.cpp:54: m_orientation
=
> DeviceOrientationData::create(alpha, alpha ? *alpha : false, beta, beta ?
*beta
> : false, gamma, gamma ? *gamma : false, absolute, absolute ? *absolute :
false);
> There is a bit of typo here: false should be actually 0:
>
> Will change this in the next CL once agreed.
>
> Replace this line
>
> m_orientation = DeviceOrientationData::create(alpha, alpha ? *alpha : false,
> beta, beta ? *beta : false, gamma, gamma ? *gamma : false, absolute, absolute
?
> *absolute : false);
>
> with
>
> m_orientation = DeviceOrientationData::create(alpha, alpha ? *alpha : 0, beta,
> beta ? *beta : 0, gamma, gamma ? *gamma : 0, absolute, absolute ? *absolute :
> false);
It's great that we can remove the custom bindings, but would there be any way to
avoid introducing [RawPrimitives]? For example, would it be helpful to introduce
[TreatUndefinedAs=False], [TreatNullAs=False] etc?
drive-by: can we just eliminate this in favor of the constructor per spec? http://w3c.github.io/deviceorientation/spec-source-orientation.html#deviceorientation Alternately, ...
4 years, 10 months ago
(2015-06-16 20:36:22 UTC)
#6
drive-by: can we just eliminate this in favor of the constructor per spec?
http://w3c.github.io/deviceorientation/spec-source-orientation.html#deviceori...
Alternately, given that the properties are nullable, does undefined->null
mapping work if they are defined as nullable in the idl? If not, can we (as
haraken suggests) reintroduce e.g. [TreatUndefinedAs=Null] ?
vivekg
On 2015/06/16 at 20:36:22, jsbell wrote: > drive-by: can we just eliminate this in favor ...
4 years, 10 months ago
(2015-06-17 14:22:04 UTC)
#7
On 2015/06/16 at 20:36:22, jsbell wrote:
> drive-by: can we just eliminate this in favor of the constructor per spec?
>
>
http://w3c.github.io/deviceorientation/spec-source-orientation.html#deviceori...
>
> Alternately, given that the properties are nullable, does undefined->null
mapping work if they are defined as nullable in the idl? If not, can we (as
haraken suggests) reintroduce e.g. [TreatUndefinedAs=Null] ?
Done, PTAL.
vivekg
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/IDLExtendedAttributes.txt File Source/bindings/IDLExtendedAttributes.txt (right): https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/IDLExtendedAttributes.txt#newcode102 Source/bindings/IDLExtendedAttributes.txt:102: TreatUndefinedAs=NullString|Null I should reorder this TreatUndefinedAs=Null|NullString https://codereview.chromium.org/1186823014/diff/20001/Source/modules/device_orientation/DeviceOrientationEvent.cpp File Source/modules/device_orientation/DeviceOrientationEvent.cpp ...
4 years, 10 months ago
(2015-06-17 14:23:46 UTC)
#8
On 2015/06/17 at 16:01:42, haraken wrote: > https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/scripts/v8_methods.py#newcode229 > Source/bindings/scripts/v8_methods.py:229: has_extended_attribute_value(argument, "Default", "Undefined") and \ ...
4 years, 10 months ago
(2015-06-17 17:32:46 UTC)
#10
On 2015/06/17 at 16:01:42, haraken wrote:
>
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/scripts...
> Source/bindings/scripts/v8_methods.py:229:
has_extended_attribute_value(argument, "Default", "Undefined") and \
>
> Do we need this condition? I mean, what should happen if JS passes undefined
for an DOM attribute that has [TreatUndefinedAs=Null] but doesn't have
[Default=Undefined]?
>
Yeah makes sense. I will remove the check.
>
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/tests/r...
> File Source/bindings/tests/results/core/V8TestObject.cpp (right):
>
>
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/tests/r...
> Source/bindings/tests/results/core/V8TestObject.cpp:10095:
impl->voidMethodTreadUndefinedAsNull(firstArg, secondArg, optionalDoubleArg);
>
> Would you help me understand why we need to pass a pointer to the C++
implementation? How are the fact that the DOM attribute/method has
[TreatUndefinedAs=Null] and the fact that we have to pass in a pointer related
with each other?
This is being used in DeviceOrientationEvent in which the existing binding code
would convert the |undefined| double to 0.
This situation makes it harder to determine whether this was actually sent by
the JS or something else.
If we have the ability to pass the pointer values, then the callee can easily
determine that this was indeed not sent by the user and appropriate action can
be taken.
haraken
On 2015/06/17 17:32:46, vivekg_ wrote: > On 2015/06/17 at 16:01:42, haraken wrote: > > > ...
4 years, 10 months ago
(2015-06-17 17:59:30 UTC)
#11
On 2015/06/17 17:32:46, vivekg_ wrote:
> On 2015/06/17 at 16:01:42, haraken wrote:
> >
>
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/scripts...
> > Source/bindings/scripts/v8_methods.py:229:
> has_extended_attribute_value(argument, "Default", "Undefined") and \
> >
> > Do we need this condition? I mean, what should happen if JS passes undefined
> for an DOM attribute that has [TreatUndefinedAs=Null] but doesn't have
> [Default=Undefined]?
> >
>
> Yeah makes sense. I will remove the check.
>
>
> >
>
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/tests/r...
> > File Source/bindings/tests/results/core/V8TestObject.cpp (right):
> >
> >
>
https://codereview.chromium.org/1186823014/diff/20001/Source/bindings/tests/r...
> > Source/bindings/tests/results/core/V8TestObject.cpp:10095:
> impl->voidMethodTreadUndefinedAsNull(firstArg, secondArg, optionalDoubleArg);
> >
> > Would you help me understand why we need to pass a pointer to the C++
> implementation? How are the fact that the DOM attribute/method has
> [TreatUndefinedAs=Null] and the fact that we have to pass in a pointer related
> with each other?
>
> This is being used in DeviceOrientationEvent in which the existing binding
code
> would convert the |undefined| double to 0.
> This situation makes it harder to determine whether this was actually sent by
> the JS or something else.
> If we have the ability to pass the pointer values, then the callee can easily
> determine that this was indeed not sent by the user and appropriate action can
> be taken.
Ah, I understand... but that is a nasty way to distinguish the two things. Would
it be possible to update the DeviceOrientationEvent code so that it doesn't
depend on whether the pointer value is nullptr or not?
vivekg
Simply making this Nullable works as pointed out by jsbell@ With this we don't need ...
4 years, 10 months ago
(2015-06-18 12:45:35 UTC)
#12
Simply making this Nullable works as pointed out by jsbell@
With this we don't need any special handling from the bindings code generator.
PTAL, thanks.
haraken
This looks much nicer! LGTM.
4 years, 10 months ago
(2015-06-18 16:02:55 UTC)
#13
This looks much nicer! LGTM.
vivekg
The CQ bit was checked by vivekg@chromium.org
4 years, 10 months ago
(2015-06-18 16:12:51 UTC)
#14
Issue 1186823014: [bindings] Eliminate custom bindings for DeviceOrientationEvent.
(Closed)
Created 4 years, 10 months ago by vivekg_samsung
Modified 4 years, 10 months ago
Reviewers: vivekg, haraken, jsbell
Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Comments: 6