Commit 86738ed0 authored by Mustaq Ahmed's avatar Mustaq Ahmed Committed by Commit Bot

Make PointerEvent fromElement/toElement return null.

Also added web-platform-tests.

Blink intent thread:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/G2s1Ol3qcgA

Closes https://github.com/w3c/pointerevents/issues/167

Bug: 827271
Change-Id: I8429b9541f8cfc38223b3a34116b74c2aba92ee5
Reviewed-on: https://chromium-review.googlesource.com/986877Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550683}
parent d5de6d0d
......@@ -39,7 +39,8 @@ function check_PointerEvent(event, testNamePrefix) {
"long": function (v) { return typeof v === "number" && Math.round(v) === v; },
"float": function (v) { return typeof v === "number"; },
"string": function (v) { return typeof v === "string"; },
"boolean": function (v) { return typeof v === "boolean" }
"boolean": function (v) { return typeof v === "boolean" },
"object": function (v) { return typeof v === "object" }
};
[
["readonly", "long", "pointerId"],
......@@ -50,7 +51,9 @@ function check_PointerEvent(event, testNamePrefix) {
["readonly", "long", "tiltY"],
["readonly", "string", "pointerType"],
["readonly", "boolean", "isPrimary"],
["readonly", "long", "detail", 0]
["readonly", "long", "detail", 0],
["readonly", "object", "fromElement", null],
["readonly", "object", "toElement", null]
].forEach(function (attr) {
var readonly = attr[0];
var type = attr[1];
......@@ -75,7 +78,7 @@ function check_PointerEvent(event, testNamePrefix) {
}, pointerTestName + "." + name + " IDL type " + type + " (JS type was " + typeof event[name] + ")");
// value check if defined
if (value != undefined) {
if (value !== undefined) {
test(function () {
assert_equals(event[name], value, name + " attribute value");
}, pointerTestName + "." + name + " value is " + value + ".");
......
......@@ -105,8 +105,8 @@ class CORE_EXPORT MouseEvent : public UIEventWithKeyState {
}
const String& region() const { return region_; }
Node* toElement() const;
Node* fromElement() const;
virtual Node* toElement() const;
virtual Node* fromElement() const;
virtual DataTransfer* getDataTransfer() const { return nullptr; }
......
......@@ -104,6 +104,14 @@ void PointerEvent::ReceivedTarget() {
MouseEvent::ReceivedTarget();
}
Node* PointerEvent::toElement() const {
return nullptr;
}
Node* PointerEvent::fromElement() const {
return nullptr;
}
HeapVector<Member<PointerEvent>> PointerEvent::getCoalescedEvents() {
if (coalesced_events_targets_dirty_) {
for (auto coalesced_event : coalesced_events_)
......
......@@ -50,6 +50,11 @@ class CORE_EXPORT PointerEvent final : public MouseEvent {
void ReceivedTarget() override;
// Always return null for fromElement and toElement because these fields
// (inherited from MouseEvents) are non-standard.
Node* fromElement() const final;
Node* toElement() const final;
HeapVector<Member<PointerEvent>> getCoalescedEvents();
DispatchEventResult DispatchEvent(EventDispatcher&) override;
......
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