Diff
Modified: trunk/LayoutTests/ChangeLog (243644 => 243645)
--- trunk/LayoutTests/ChangeLog 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/LayoutTests/ChangeLog 2019-03-29 15:54:02 UTC (rev 243645)
@@ -1,3 +1,20 @@
+2019-03-28 Antoine Quint <grao...@apple.com>
+
+ All PointerEvent.isTrusted is always false.
+ https://bugs.webkit.org/show_bug.cgi?id=196075
+ <rdar://problem/49158778>
+
+ Reviewed by Chris Dumez.
+
+ Add tests to the macOS and iOS series of tests that check that isTrusted is indeed true. This uncovered a couple of issues with how some tests were written.
+
+ * pointerevents/ios/pointer-events-is-primary.html: Ensure we end both touches so that further tests run cleanly.
+ * pointerevents/ios/pointer-events-is-trusted-expected.txt: Added.
+ * pointerevents/ios/pointer-events-is-trusted.html: Added.
+ * pointerevents/mouse/pointer-event-basic-properties.html: Ensure we wait for the event to be handled before finishing the test.
+ * pointerevents/utils.js:
+ (prototype._handlePointerEvent):
+
2019-03-29 Cathie Chen <cathiec...@igalia.com>
Implement ResizeObserver.
Modified: trunk/LayoutTests/pointerevents/ios/pointer-events-is-primary.html (243644 => 243645)
--- trunk/LayoutTests/pointerevents/ios/pointer-events-is-primary.html 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/LayoutTests/pointerevents/ios/pointer-events-is-primary.html 2019-03-29 15:54:02 UTC (rev 243645)
@@ -24,7 +24,8 @@
two.move({ x: 70, y: 70 }),
one.move({ x: 30, y: 30 }),
one.end(),
- two.move({ x: 50, y: 50 })
+ two.move({ x: 50, y: 50 }),
+ two.end()
]).then(() => {
eventTracker.assertMatchesEvents([
{ id: 1, type: "pointerdown", x: 10, y: 10, isPrimary: true },
Added: trunk/LayoutTests/pointerevents/ios/pointer-events-is-trusted-expected.txt (0 => 243645)
--- trunk/LayoutTests/pointerevents/ios/pointer-events-is-trusted-expected.txt (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/pointer-events-is-trusted-expected.txt 2019-03-29 15:54:02 UTC (rev 243645)
@@ -0,0 +1,3 @@
+
+PASS Testing that isTrusted is true for pointer events.
+
Added: trunk/LayoutTests/pointerevents/ios/pointer-events-is-trusted.html (0 => 243645)
--- trunk/LayoutTests/pointerevents/ios/pointer-events-is-trusted.html (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/pointer-events-is-trusted.html 2019-03-29 15:54:02 UTC (rev 243645)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+ const eventTracker = new EventTracker(target, ["pointerover", "pointerenter", "pointerdown", "pointerup", "pointerout", "pointerleave"]);
+
+ ui.tap({ x: 100, y: 100 }).then(() => {
+ eventTracker.assertMatchesEvents([
+ { type: "pointerover", isTrusted: true },
+ { type: "pointerenter", isTrusted: true },
+ { type: "pointerdown", isTrusted: true },
+ { type: "pointerup", isTrusted: true },
+ { type: "pointerout", isTrusted: true },
+ { type: "pointerleave", isTrusted: true },
+ ]);
+ test.done();
+ });
+}, `Testing that isTrusted is true for pointer events.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html (243644 => 243645)
--- trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html 2019-03-29 15:54:02 UTC (rev 243645)
@@ -12,16 +12,16 @@
'use strict';
target_test((target, test) => {
- eventSender.mouseMoveTo(50, 50);
- eventSender.mouseDown();
-
target.addEventListener("pointerdown", event => {
assert_equals(event.pointerId, 1, "The pointer's identifier is 1.");
assert_equals(event.pointerType, "mouse", "The pointer type is 'mouse'.");
assert_true(event.isPrimary, "The pointer is the primary pointer.");
+ assert_true(event.isTrusted, "The event is trusted.");
+ test.done();
});
- test.done();
+ eventSender.mouseMoveTo(50, 50);
+ eventSender.mouseDown();
}, `Testing the basic properties of a pointer event triggered by a mouse.`);
</script>
Modified: trunk/LayoutTests/pointerevents/utils.js (243644 => 243645)
--- trunk/LayoutTests/pointerevents/utils.js 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/LayoutTests/pointerevents/utils.js 2019-03-29 15:54:02 UTC (rev 243645)
@@ -67,7 +67,8 @@
type: event.type,
x: event.clientX,
y: event.clientY,
- isPrimary: event.isPrimary
+ isPrimary: event.isPrimary,
+ isTrusted: event.isTrusted
});
}
Modified: trunk/Source/WebCore/ChangeLog (243644 => 243645)
--- trunk/Source/WebCore/ChangeLog 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/Source/WebCore/ChangeLog 2019-03-29 15:54:02 UTC (rev 243645)
@@ -1,3 +1,26 @@
+2019-03-28 Antoine Quint <grao...@apple.com>
+
+ All PointerEvent.isTrusted is always false.
+ https://bugs.webkit.org/show_bug.cgi?id=196075
+ <rdar://problem/49158778>
+
+ Reviewed by Chris Dumez.
+
+ Test: pointerevents/ios/pointer-events-is-trusted.html
+
+ The constructors we were using for some PointerEvent::create() methods were using initializers which are expected to be used with JS APIs
+ and thus generate untrusted events. We switch to using constructors using dedicated parameters which will set isTrusted to true.
+
+ * dom/PointerEvent.cpp:
+ (WebCore::PointerEvent::create):
+ (WebCore::PointerEvent::createPointerCancelEvent):
+ (WebCore::PointerEvent::PointerEvent):
+ (WebCore::m_isPrimary):
+ (WebCore::m_pointerType):
+ * dom/PointerEvent.h:
+ * page/PointerCaptureController.cpp:
+ (WebCore::PointerCaptureController::cancelPointer):
+
2019-03-29 Philippe Normand <pnorm...@igalia.com>
[GStreamer] imxvpudecoder detection and handling
Modified: trunk/Source/WebCore/dom/PointerEvent.cpp (243644 => 243645)
--- trunk/Source/WebCore/dom/PointerEvent.cpp 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/Source/WebCore/dom/PointerEvent.cpp 2019-03-29 15:54:02 UTC (rev 243645)
@@ -71,6 +71,24 @@
return nullAtom();
}
+RefPtr<PointerEvent> PointerEvent::create(const MouseEvent& mouseEvent)
+{
+ auto type = pointerEventType(mouseEvent.type());
+ if (type.isEmpty())
+ return nullptr;
+
+ auto isEnterOrLeave = type == eventNames().pointerenterEvent || type == eventNames().pointerleaveEvent;
+ auto canBubble = isEnterOrLeave ? CanBubble::No : CanBubble::Yes;
+ auto isCancelable = isEnterOrLeave ? IsCancelable::No : IsCancelable::Yes;
+ auto isComposed = isEnterOrLeave ? IsComposed::No : IsComposed::Yes;
+ return adoptRef(*new PointerEvent(type, canBubble, isCancelable, isComposed, mouseEvent));
+}
+
+Ref<PointerEvent> PointerEvent::createPointerCancelEvent(PointerID pointerId, const String& pointerType)
+{
+ return adoptRef(*new PointerEvent(eventNames().pointercancelEvent, CanBubble::Yes, IsCancelable::No, IsComposed::Yes, pointerId, pointerType));
+}
+
PointerEvent::PointerEvent() = default;
PointerEvent::PointerEvent(const AtomicString& type, Init&& initializer)
@@ -88,35 +106,17 @@
{
}
-RefPtr<PointerEvent> PointerEvent::create(const MouseEvent& mouseEvent)
+PointerEvent::PointerEvent(const AtomicString& type, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, const MouseEvent& mouseEvent)
+ : MouseEvent(type, canBubble, isCancelable, isComposed, mouseEvent.view(), mouseEvent.detail(), mouseEvent.screenLocation(), { mouseEvent.clientX(), mouseEvent.clientY() }, mouseEvent.modifierKeys(), mouseEvent.button(), mouseEvent.buttons(), mouseEvent.syntheticClickType(), mouseEvent.relatedTarget())
+ , m_isPrimary(true)
{
- auto type = pointerEventType(mouseEvent.type());
- if (type.isEmpty())
- return nullptr;
+}
- auto isEnterOrLeave = type == eventNames().pointerenterEvent || type == eventNames().pointerleaveEvent;
-
- PointerEvent::Init init;
- init.bubbles = !isEnterOrLeave;
- init.cancelable = !isEnterOrLeave;
- init.composed = !isEnterOrLeave;
- init.view = mouseEvent.view();
- init.ctrlKey = mouseEvent.ctrlKey();
- init.shiftKey = mouseEvent.shiftKey();
- init.altKey = mouseEvent.altKey();
- init.metaKey = mouseEvent.metaKey();
- init.modifierAltGraph = mouseEvent.altGraphKey();
- init.modifierCapsLock = mouseEvent.capsLockKey();
- init.screenX = mouseEvent.screenX();
- init.screenY = mouseEvent.screenY();
- init.clientX = mouseEvent.clientX();
- init.clientY = mouseEvent.clientY();
- init.button = mouseEvent.button();
- init.buttons = mouseEvent.buttons();
- init.relatedTarget = mouseEvent.relatedTarget();
- init.isPrimary = true;
-
- return PointerEvent::create(type, WTFMove(init));
+PointerEvent::PointerEvent(const AtomicString& type, CanBubble canBubble, IsCancelable isCancelable, IsComposed isComposed, PointerID pointerId, const String& pointerType)
+ : MouseEvent(type, canBubble, isCancelable, isComposed, nullptr, 0, { }, { }, { }, 0, 0, 0, nullptr)
+ , m_pointerId(pointerId)
+ , m_pointerType(pointerType)
+{
}
PointerEvent::~PointerEvent() = default;
Modified: trunk/Source/WebCore/dom/PointerEvent.h (243644 => 243645)
--- trunk/Source/WebCore/dom/PointerEvent.h 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/Source/WebCore/dom/PointerEvent.h 2019-03-29 15:54:02 UTC (rev 243645)
@@ -57,15 +57,6 @@
return adoptRef(*new PointerEvent(type, WTFMove(initializer)));
}
- static Ref<PointerEvent> create(const AtomicString& type, PointerID pointerId, String pointerType)
- {
- Init initializer;
- initializer.bubbles = true;
- initializer.pointerId = pointerId;
- initializer.pointerType = pointerType;
- return adoptRef(*new PointerEvent(type, WTFMove(initializer)));
- }
-
static Ref<PointerEvent> createForPointerCapture(const AtomicString& type, const PointerEvent& pointerEvent)
{
Init initializer;
@@ -82,6 +73,7 @@
}
static RefPtr<PointerEvent> create(const MouseEvent&);
+ static Ref<PointerEvent> createPointerCancelEvent(PointerID, const String& pointerType);
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
static Ref<PointerEvent> create(const PlatformTouchEvent&, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
@@ -113,6 +105,8 @@
private:
PointerEvent();
PointerEvent(const AtomicString&, Init&&);
+ PointerEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, const MouseEvent&);
+ PointerEvent(const AtomicString& type, CanBubble, IsCancelable, IsComposed, PointerID, const String& pointerType);
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
PointerEvent(const AtomicString& type, const PlatformTouchEvent&, IsCancelable isCancelable, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
#endif
Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (243644 => 243645)
--- trunk/Source/WebCore/page/PointerCaptureController.cpp 2019-03-29 10:43:30 UTC (rev 243644)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp 2019-03-29 15:54:02 UTC (rev 243645)
@@ -281,7 +281,7 @@
if (!target)
return;
- auto event = PointerEvent::create(eventNames().pointercancelEvent, pointerId, capturingData.pointerType);
+ auto event = PointerEvent::createPointerCancelEvent(pointerId, capturingData.pointerType);
target->dispatchEvent(event);
processPendingPointerCapture(WTFMove(event));
}