Use high resolution timestamp for event time
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Sep 2017 17:13:06 +0000 (17:13 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Sep 2017 17:13:06 +0000 (17:13 +0000)
commit1eff62e2eb2341a64c32a0d6bb4f201573337c35
tree2aa3b3b96d99ae84d4a9021709a1b3dd5929415d
parentd8785460bbbd4943e246c547d3bb647d24332880
Use high resolution timestamp for event time
https://bugs.webkit.org/show_bug.cgi?id=154246
<rdar://problem/34333304>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline WPT test now that more checks are passing.

* web-platform-tests/dom/events/Event-timestamp-high-resolution-expected.txt:

Source/WebCore:

Have event.timeStamp return a DOMHighResTimeStamp instead of a DOMResTimeStamp. It now
has better precision, is monotonic and is relative to PerformanceTiming.navigationStart.

This is as per:
- https://dom.spec.whatwg.org/#interface-event

Chrome, Firefox and Edge all already ship this so the compatibility risk should be low.

Also use WallTime / MonotonicTime instead of double type for clarity.

Test: imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution.html

* WebCore.xcodeproj/project.pbxproj:
* dom/DOMHighResTimeStamp.h: Copied from Source/WebKit/Shared/WebTouchEvent.cpp.
* dom/Element.cpp:
(WebCore::Element::dispatchMouseForceWillBegin):
* dom/Event.cpp:
(WebCore::Event::Event):
(WebCore::Event::timeStampForBindings const):
* dom/Event.h:
(WebCore::Event::timeStamp const):
* dom/Event.idl:
* dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::KeyboardEvent):
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):
* dom/MouseEvent.h:
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent):
* dom/MouseRelatedEvent.h:
* dom/SimulatedClick.cpp:
* dom/TouchEvent.cpp:
(WebCore::TouchEvent::TouchEvent):
* dom/UIEvent.cpp:
(WebCore::UIEvent::UIEvent):
* dom/UIEvent.h:
* dom/UIEventWithKeyState.h:
(WebCore::UIEventWithKeyState::UIEventWithKeyState):
* dom/WheelEvent.cpp:
(WebCore::WheelEvent::WheelEvent):
* html/TypeAhead.cpp:
(WebCore::TypeAhead::TypeAhead):
(WebCore::TypeAhead::handleEvent):
* html/TypeAhead.h:
* page/AutoscrollController.cpp:
(WebCore::AutoscrollController::AutoscrollController):
(WebCore::AutoscrollController::updateDragAndDrop):
(WebCore::AutoscrollController::autoscrollTimerFired):
* page/AutoscrollController.h:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::showContextMenuAt):
* page/DragController.cpp:
(WebCore::createMouseEvent):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchDragEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::fakeMouseMoveEventTimerFired):
* page/EventHandler.h:
* page/Performance.cpp:
(WebCore::Performance::now const):
(WebCore::Performance::relativeTimeFromTimeOriginInReducedResolution const):
* page/Performance.h:
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
* page/win/EventHandlerWin.cpp:
* platform/PlatformEvent.h:
(WebCore::PlatformEvent::timestamp const):
(WebCore::PlatformEvent::PlatformEvent):
* platform/PlatformKeyboardEvent.h:
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
* platform/PlatformMouseEvent.h:
(WebCore::PlatformMouseEvent::PlatformMouseEvent):
* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::PlatformWheelEvent):
* platform/cocoa/ScrollController.mm:
(WebCore::ScrollController::handleWheelEvent):
* platform/glib/EventHandlerGLib.cpp:
* platform/gtk/ScrollAnimatorGtk.cpp:
(WebCore::ScrollAnimatorGtk::computeVelocity):
(WebCore::ScrollAnimatorGtk::handleWheelEvent):
* platform/ios/PlatformEventFactoryIOS.mm:
(WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
(WebCore::PlatformTouchEventBuilder::PlatformTouchEventBuilder):
* platform/mac/PlatformEventFactoryMac.h:
* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::eventTimeStampSince1970):

Source/WebKit:

Use WallTime / MonotonicTime instead of double type for clarity.

* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<WallTime>::encode):
(IPC::ArgumentCoder<WallTime>::decode):
* Shared/WebCoreArgumentCoders.h:
* Shared/WebEvent.cpp:
(WebKit::WebEvent::WebEvent):
* Shared/WebEvent.h:
(WebKit::WebEvent::timestamp const):
(WebKit::WebTouchEvent::WebTouchEvent):
* Shared/WebKeyboardEvent.cpp:
(WebKit::WebKeyboardEvent::WebKeyboardEvent):
* Shared/WebMouseEvent.cpp:
(WebKit::WebMouseEvent::WebMouseEvent):
* Shared/WebTouchEvent.cpp:
(WebKit::WebTouchEvent::WebTouchEvent):
* Shared/WebWheelEvent.cpp:
(WebKit::WebWheelEvent::WebWheelEvent):
* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* Shared/ios/NativeWebTouchEventIOS.mm:
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
* Shared/ios/WebIOSEventFactory.mm:
(WebIOSEventFactory::createWebKeyboardEvent):
* Shared/mac/NativeWebGestureEventMac.mm:
(WebKit::NativeWebGestureEvent::NativeWebGestureEvent):
* Shared/mac/WebEventFactory.mm:
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebKeyboardEvent):
* Shared/mac/WebGestureEvent.h:
(WebKit::WebGestureEvent::WebGestureEvent):
* Shared/wpe/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebKeyboardEvent):
(WebKit::WebEventFactory::createWebMouseEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageSimulateMouseDown):
(WKBundlePageSimulateMouseUp):
(WKBundlePageSimulateMouseMotion):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::showContextMenuAtPoint):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::createWebEvent const):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
(WebKit::WebPage::contextMenuAtPointInWindow):
(WebKit::WebPage::dragEnded):
(WebKit::WebPage::simulateMouseDown):
(WebKit::WebPage::simulateMouseUp):
(WebKit::WebPage::simulateMouseMotion):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::completeSyntheticClick):
(WebKit::WebPage::requestAdditionalItemsForDragSession):
(WebKit::WebPage::inspectorNodeSearchMovedToPosition):

Source/WebKitLegacy/ios:

Use WallTime / MonotonicTime instead of double type for clarity.

* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):

Source/WebKitLegacy/mac:

Use WallTime / MonotonicTime instead of double type for clarity.

* DOM/DOMEvent.mm:
(-[DOMEvent timeStamp]):
* WebView/WebFrame.mm:
(-[WebFrame _dragSourceEndedAt:operation:]):
* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
80 files changed:
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DOMHighResTimeStamp.h [new file with mode: 0644]
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Event.cpp
Source/WebCore/dom/Event.h
Source/WebCore/dom/Event.idl
Source/WebCore/dom/KeyboardEvent.cpp
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/MouseEvent.h
Source/WebCore/dom/MouseRelatedEvent.cpp
Source/WebCore/dom/MouseRelatedEvent.h
Source/WebCore/dom/SimulatedClick.cpp
Source/WebCore/dom/TouchEvent.cpp
Source/WebCore/dom/UIEvent.cpp
Source/WebCore/dom/UIEvent.h
Source/WebCore/dom/UIEventWithKeyState.h
Source/WebCore/dom/WheelEvent.cpp
Source/WebCore/html/TypeAhead.cpp
Source/WebCore/html/TypeAhead.h
Source/WebCore/page/AutoscrollController.cpp
Source/WebCore/page/AutoscrollController.h
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/Performance.cpp
Source/WebCore/page/Performance.h
Source/WebCore/page/ios/EventHandlerIOS.mm
Source/WebCore/page/win/EventHandlerWin.cpp
Source/WebCore/platform/PlatformEvent.h
Source/WebCore/platform/PlatformKeyboardEvent.h
Source/WebCore/platform/PlatformMouseEvent.h
Source/WebCore/platform/PlatformWheelEvent.h
Source/WebCore/platform/cocoa/ScrollController.mm
Source/WebCore/platform/glib/EventHandlerGLib.cpp
Source/WebCore/platform/gtk/PlatformKeyboardEventGtk.cpp
Source/WebCore/platform/gtk/PlatformMouseEventGtk.cpp
Source/WebCore/platform/gtk/PlatformWheelEventGtk.cpp
Source/WebCore/platform/gtk/ScrollAnimatorGtk.cpp
Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm
Source/WebCore/platform/mac/PlatformEventFactoryMac.h
Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
Source/WebCore/platform/win/KeyEventWin.cpp
Source/WebCore/platform/win/PlatformMouseEventWin.cpp
Source/WebCore/platform/win/WheelEventWin.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/Shared/WebCoreArgumentCoders.h
Source/WebKit/Shared/WebEvent.cpp
Source/WebKit/Shared/WebEvent.h
Source/WebKit/Shared/WebKeyboardEvent.cpp
Source/WebKit/Shared/WebMouseEvent.cpp
Source/WebKit/Shared/WebTouchEvent.cpp
Source/WebKit/Shared/WebWheelEvent.cpp
Source/WebKit/Shared/gtk/WebEventFactory.cpp
Source/WebKit/Shared/ios/NativeWebTouchEventIOS.mm
Source/WebKit/Shared/ios/WebIOSEventFactory.mm
Source/WebKit/Shared/mac/NativeWebGestureEventMac.mm
Source/WebKit/Shared/mac/WebEventFactory.mm
Source/WebKit/Shared/mac/WebGestureEvent.h
Source/WebKit/Shared/wpe/WebEventFactory.cpp
Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp
Source/WebKit/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOMEvent.mm
Source/WebKitLegacy/mac/WebView/WebFrame.mm
Source/WebKitLegacy/mac/WebView/WebPDFView.mm
Source/WebKitLegacy/win/WebDropSource.cpp