[Pointer Events] event.isPrimary doesn't always represent the oldest active touch
https://bugs.webkit.org/show_bug.cgi?id=191752
<rdar://problem/46129270>

Reviewed by Dean Jackson.

Source/WebCore:

Provide isPrimary to the constructor so its value can be determined at the call site.

Test: pointerevents/ios/pointer-events-is-primary.html

* dom/PointerEvent.h:
* dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::create):
(WebCore::PointerEvent::PointerEvent):
(WebCore::m_isPrimary):

LayoutTests:

Add a new test that checks that adding a touch after another existing touch does not make it be
the primary touch, but that removing the first touch makes the second touch become the primary touch.

To do this we add a new ui.sequence() method that allows a series of touch actions to be performed
in a linear sequence. The test author can create a finger and call various actions on it, currently
begin(), move() and end().

When these actions are processed, we compute all "stationary" actions for each part of the sequence
so that we can provide this to the uiController.sendEventStream() function.

Finally, we add a way to track events received by the target and assert that the events that were
received match those that were expected.

* pointerevents/ios/pointer-events-is-primary-expected.txt: Added.
* pointerevents/ios/pointer-events-is-primary.html: Added.
* pointerevents/utils.js:
(prototype.handleEvent):
(prototype.assertMatchesEvents):
(const.ui.new.UIController):
(const.ui.new.UIController.prototype.finger):
(const.ui.new.UIController.prototype.pinchOut):
(const.ui.new.UIController.prototype.sequence):
(const.ui.new.UIController.prototype._runEvents):
(prototype.begin):
(prototype.move):
(prototype.end):
(prototype.stationary):
(prototype._action):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@238344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/dom/PointerEvent.h b/Source/WebCore/dom/PointerEvent.h
index 58cfe50..cf09143 100644
--- a/Source/WebCore/dom/PointerEvent.h
+++ b/Source/WebCore/dom/PointerEvent.h
@@ -60,7 +60,7 @@
     }
 
 #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
-    static Ref<PointerEvent> create(const PlatformTouchEvent&, unsigned touchIndex, Ref<WindowProxy>&&);
+    static Ref<PointerEvent> create(const PlatformTouchEvent&, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
 #endif
 
     virtual ~PointerEvent();
@@ -84,7 +84,7 @@
     PointerEvent();
     PointerEvent(const AtomicString&, Init&&);
 #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
-    PointerEvent(const AtomicString& type, const PlatformTouchEvent&, IsCancelable isCancelable, unsigned touchIndex, Ref<WindowProxy>&&);
+    PointerEvent(const AtomicString& type, const PlatformTouchEvent&, IsCancelable isCancelable, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
 #endif
 
     long m_pointerId { 0 };