Commit 4edee417 authored by Byoungkown's avatar Byoungkown Committed by Commit Bot

[WebXR] Implement EventTarget for XRCoordinateSystem

The spec[1] states that XRCoordinateSystem inherits EventTarget.
This patch implements the inheritance.

[1]: https://immersive-web.github.io/webxr/#xrcoordinatesystem-interface

Bug: None
Change-Id: I509ff04c8bbe76a499655fa48a726ac10f444716
Reviewed-on: https://chromium-review.googlesource.com/1189503
Commit-Queue: Byoungkwon Ko <codeimpl@gmail.com>
Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592632}
parent 20eba307
......@@ -58,10 +58,10 @@ PASS XRFrame interface: attribute session
PASS XRFrame interface: attribute views
PASS XRFrame interface: operation getDevicePose(XRCoordinateSystem)
PASS XRFrame interface: operation getInputPose(XRInputSource, XRCoordinateSystem)
FAIL XRCoordinateSystem interface: existence and properties of interface object assert_equals: prototype of XRCoordinateSystem is not EventTarget expected function "function EventTarget() { [native code] }" but got function "function () { [native code] }"
PASS XRCoordinateSystem interface: existence and properties of interface object
PASS XRCoordinateSystem interface object length
PASS XRCoordinateSystem interface object name
FAIL XRCoordinateSystem interface: existence and properties of interface prototype object assert_equals: prototype of XRCoordinateSystem.prototype is not EventTarget.prototype expected object "[object EventTarget]" but got object "[object Object]"
PASS XRCoordinateSystem interface: existence and properties of interface prototype object
PASS XRCoordinateSystem interface: existence and properties of interface prototype object's "constructor" property
PASS XRCoordinateSystem interface: existence and properties of interface prototype object's @@unscopables property
PASS XRCoordinateSystem interface: operation getTransformTo(XRCoordinateSystem)
......
......@@ -10121,7 +10121,7 @@ interface XR : EventTarget
method constructor
method requestDevice
setter ondevicechange
interface XRCoordinateSystem
interface XRCoordinateSystem : EventTarget
attribute @@toStringTag
method constructor
method getTransformTo
......
......@@ -57,6 +57,7 @@
"modules/webmidi/MIDIInput",
"modules/webmidi/MIDIPort",
"modules/xr/XR",
"modules/xr/XRCoordinateSystem",
"modules/xr/XRSession",
{
name: "modules/websockets/WebSocket",
......
......@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/modules/xr/xr_coordinate_system.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/xr/xr_session.h"
namespace blink {
......@@ -29,9 +30,18 @@ DOMFloat32Array* XRCoordinateSystem::getTransformTo(
return nullptr;
}
ExecutionContext* XRCoordinateSystem::GetExecutionContext() const {
return session()->GetExecutionContext();
}
const AtomicString& XRCoordinateSystem::InterfaceName() const {
return EventTargetNames::XRCoordinateSystem;
}
void XRCoordinateSystem::Trace(blink::Visitor* visitor) {
visitor->Trace(session_);
ScriptWrappable::Trace(visitor);
EventTargetWithInlineData::Trace(visitor);
}
} // namespace blink
......@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_COORDINATE_SYSTEM_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_COORDINATE_SYSTEM_H_
#include "third_party/blink/renderer/core/dom/events/event_target.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
......@@ -15,7 +16,7 @@ namespace blink {
class TransformationMatrix;
class XRSession;
class XRCoordinateSystem : public ScriptWrappable {
class XRCoordinateSystem : public EventTargetWithInlineData {
DEFINE_WRAPPERTYPEINFO();
public:
......@@ -24,7 +25,11 @@ class XRCoordinateSystem : public ScriptWrappable {
DOMFloat32Array* getTransformTo(XRCoordinateSystem*) const;
XRSession* session() { return session_; }
XRSession* session() const { return session_; }
// EventTarget overrides.
ExecutionContext* GetExecutionContext() const override;
const AtomicString& InterfaceName() const override;
virtual std::unique_ptr<TransformationMatrix> TransformBasePose(
const TransformationMatrix& base_pose) = 0;
......
......@@ -7,6 +7,6 @@
SecureContext,
Exposed=Window,
OriginTrialEnabled=WebXR
] interface XRCoordinateSystem {
] interface XRCoordinateSystem : EventTarget {
Float32Array? getTransformTo(XRCoordinateSystem other);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment