WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP Patch
154246_DOMHighResTimeStamp_wip.patch (text/plain), 33.17 KB, created by
Chris Dumez
on 2017-09-20 13:20:16 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2017-09-20 13:20:16 PDT
Size:
33.17 KB
patch
obsolete
>diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution-expected.txt >new file mode 100644 >index 00000000000..6eb10e8735a >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution-expected.txt >@@ -0,0 +1,7 @@ >+ >+PASS Constructed MouseEvent timestamp should be high resolution and have the same time origin as performance.now() >+PASS Constructed KeyboardEvent timestamp should be high resolution and have the same time origin as performance.now() >+PASS Constructed WheelEvent timestamp should be high resolution and have the same time origin as performance.now() >+FAIL Constructed GamepadEvent timestamp should be high resolution and have the same time origin as performance.now() Not enough arguments >+PASS Constructed FocusEvent timestamp should be high resolution and have the same time origin as performance.now() >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution.html b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution.html >new file mode 100644 >index 00000000000..15aa014cfb7 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution.html >@@ -0,0 +1,16 @@ >+<!DOCTYPE html> >+ >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script type="text/javascript"> >+'use strict'; >+for (let eventType of [MouseEvent, KeyboardEvent, WheelEvent, GamepadEvent, FocusEvent]) { >+ test(function() { >+ let before = performance.now(); >+ let e = new eventType('test'); >+ let after = performance.now(); >+ assert_greater_than_equal(e.timeStamp, before, "Event timestamp should be greater than performance.now() timestamp taken before its creation"); >+ assert_less_than_equal(e.timeStamp, after, "Event timestamp should be less than performance.now() timestamp taken after its creation"); >+ }, `Constructed ${eventType.prototype.constructor.name} timestamp should be high resolution and have the same time origin as performance.now()`); >+} >+</script> >\ No newline at end of file >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 7cdd8fb779b..9fabb4f855a 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1959,6 +1959,7 @@ > 460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB6141D0A1BEC00221812 /* Base64Utilities.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 460CBF351D4BCD0E0092E88E /* JSDOMWindowProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460CBF331D4BCCFE0092E88E /* JSDOMWindowProperties.cpp */; }; > 460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */; }; >+ 46218ACB1F72D64E00574FBE /* DOMHighResTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 46E016AD1F72D61E00282B2C /* DOMHighResTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; }; > 463EB6221B8789E00096ED51 /* TagCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463EB6201B8789CB0096ED51 /* TagCollection.cpp */; }; > 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; }; >@@ -9842,6 +9843,7 @@ > 46DFF4971DC2601300B80B48 /* ShadowRootMode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ShadowRootMode.idl; sourceTree = "<group>"; }; > 46DFF4991DC261F900B80B48 /* JSShadowRootMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSShadowRootMode.cpp; sourceTree = "<group>"; }; > 46DFF49A1DC261F900B80B48 /* JSShadowRootMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSShadowRootMode.h; sourceTree = "<group>"; }; >+ 46E016AD1F72D61E00282B2C /* DOMHighResTimeStamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHighResTimeStamp.h; sourceTree = "<group>"; }; > 46EBEA011B7D4D5D00BE4941 /* CollectionTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CollectionTraversal.h; sourceTree = "<group>"; }; > 46EFAF0D1E5FB9C200E7F34B /* LowPowerModeNotifierIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LowPowerModeNotifierIOS.mm; sourceTree = "<group>"; }; > 46EFAF0F1E5FB9E100E7F34B /* LowPowerModeNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LowPowerModeNotifier.cpp; sourceTree = "<group>"; }; >@@ -26255,6 +26257,7 @@ > BC60D6E80D28D83400B9918F /* DOMException.h */, > BC60D6EB0D28D99900B9918F /* DOMException.idl */, > BC9A6141146859D9006057FD /* DOMExceptions.in */, >+ 46E016AD1F72D61E00282B2C /* DOMHighResTimeStamp.h */, > A8185F3609765765005826D9 /* DOMImplementation.cpp */, > A8185F3309765765005826D9 /* DOMImplementation.h */, > 93EEC1E909C2877700C515D1 /* DOMImplementation.idl */, >@@ -27707,6 +27710,7 @@ > BC60D6E90D28D83400B9918F /* DOMException.h in Headers */, > 8399470C1F50B63E00E9D86B /* DOMFileSystem.h in Headers */, > 2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */, >+ 46218ACB1F72D64E00574FBE /* DOMHighResTimeStamp.h in Headers */, > A8185F3B09765766005826D9 /* DOMImplementation.h in Headers */, > E3C99A091DC3D41C00794AD3 /* DOMJITCheckDOM.h in Headers */, > E3150EA71DA7219300194012 /* DOMJITHelpers.h in Headers */, >@@ -28832,7 +28836,6 @@ > 316DCB201E78CA55001B5F87 /* JSRTCOfferAnswerOptions.h in Headers */, > 07969DBA17D14151007FF842 /* JSRTCPeerConnection.h in Headers */, > 07969DB817D14151007FF842 /* JSRTCPeerConnectionIceEvent.h in Headers */, >- E18C35441F71970C00FF632D /* WebArchiveResourceWebResourceHandler.h in Headers */, > 5E2C43741BCF0D750001E2BE /* JSRTCRtpParameters.h in Headers */, > 5E2C43721BCF0D750001E2BC /* JSRTCRtpReceiver.h in Headers */, > 5E2C43741BCF0D750001E2BC /* JSRTCRtpSender.h in Headers */, >@@ -30317,7 +30320,6 @@ > 0806E57A12893045007CED32 /* SVGMatrix.h in Headers */, > 08CA3D4412894A3800FFF260 /* SVGMatrixTearOff.h in Headers */, > 7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */, >- E18536841F4E481400FE091B /* WebArchiveResourceFromNSAttributedString.h in Headers */, > B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */, > B2A1F2B10CEF0ABF00442F6A /* SVGMissingGlyphElement.h in Headers */, > B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */, >@@ -30651,6 +30653,8 @@ > AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */, > AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */, > 2D3EF4481917915C00034184 /* WebActionDisablingCALayerDelegate.h in Headers */, >+ E18536841F4E481400FE091B /* WebArchiveResourceFromNSAttributedString.h in Headers */, >+ E18C35441F71970C00FF632D /* WebArchiveResourceWebResourceHandler.h in Headers */, > CDE667A51E4BBF1500E8154A /* WebAudioBufferList.h in Headers */, > 41B2A6261EF1BF6D002B9D7A /* WebAudioSourceProvider.h in Headers */, > 07D637401BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.h in Headers */, >@@ -32071,7 +32075,6 @@ > E12DE7171E4B749C00F9ACCF /* GridTrackSizingAlgorithm.cpp in Sources */, > 414C25D71E9EFEDE00BEE141 /* H264VideoToolBoxEncoder.mm in Sources */, > F55B3DBF1251F12D003EF269 /* HiddenInputType.cpp in Sources */, >- 073BDC051F68436100EE34ED /* TrackPrivateBase.cpp in Sources */, > 515BE19B1D54F6C100DD7C68 /* HIDGamepad.cpp in Sources */, > 515BE19D1D54F6C100DD7C68 /* HIDGamepadProvider.cpp in Sources */, > BC94D1530C275C8B006BC617 /* History.cpp in Sources */, >@@ -32656,7 +32659,6 @@ > A6148A7812E41E3B0044A784 /* JSHTMLKeygenElement.cpp in Sources */, > 1AE2AB210A1CE63B00B42B25 /* JSHTMLLabelElement.cpp in Sources */, > 1AE2AB230A1CE63B00B42B25 /* JSHTMLLegendElement.cpp in Sources */, >- E18C35431F71970100FF632D /* WebArchiveResourceWebResourceHandler.mm in Sources */, > 1AE2AB250A1CE63B00B42B25 /* JSHTMLLIElement.cpp in Sources */, > A80E7B100A19D606007FB8C5 /* JSHTMLLinkElement.cpp in Sources */, > 1AE2AB270A1CE63B00B42B25 /* JSHTMLMapElement.cpp in Sources */, >@@ -32824,7 +32826,6 @@ > A1CC56781F4614A500A4555B /* JSPaymentRequest.cpp in Sources */, > A1F600571F4765050077E83F /* JSPaymentRequestUpdateEvent.cpp in Sources */, > A1F600591F4765050077E83F /* JSPaymentRequestUpdateEventInit.cpp in Sources */, >- E18536851F50906100FE091B /* WebArchiveResourceFromNSAttributedString.mm in Sources */, > A1CC567A1F4614AA00A4555B /* JSPaymentResponse.cpp in Sources */, > A1CC567C1F4614AF00A4555B /* JSPaymentShippingOption.cpp in Sources */, > A1CC567E1F4614B400A4555B /* JSPaymentShippingType.cpp in Sources */, >@@ -34329,6 +34330,7 @@ > 070334D9145A006F008D8D45 /* TrackBase.cpp in Sources */, > 070334D31459FFAD008D8D45 /* TrackEvent.cpp in Sources */, > BE88E0C11715CE2600658D98 /* TrackListBase.cpp in Sources */, >+ 073BDC051F68436100EE34ED /* TrackPrivateBase.cpp in Sources */, > FFAC30FF184FB145008C4F1E /* TrailingObjects.cpp in Sources */, > 51D7EFEC1BDEFA5100E93E10 /* TransactionOperation.cpp in Sources */, > 49E911C30EF86D47009D0CAF /* TransformationMatrix.cpp in Sources */, >@@ -34431,6 +34433,8 @@ > AA478A8016CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.mm in Sources */, > 2D3EF4491917915C00034184 /* WebActionDisablingCALayerDelegate.mm in Sources */, > 120DE3ED1C86CA3E00B6D4DD /* WebAnimation.cpp in Sources */, >+ E18536851F50906100FE091B /* WebArchiveResourceFromNSAttributedString.mm in Sources */, >+ E18C35431F71970100FF632D /* WebArchiveResourceWebResourceHandler.mm in Sources */, > CDE667A41E4BBF1500E8154A /* WebAudioBufferList.cpp in Sources */, > 07D637411BB0B11300256CE9 /* WebAudioSourceProviderAVFObjC.mm in Sources */, > CDA29A311CBF74DA00901CCF /* WebAVPlayerController.mm in Sources */, >diff --git a/Source/WebCore/dom/DOMHighResTimeStamp.h b/Source/WebCore/dom/DOMHighResTimeStamp.h >new file mode 100644 >index 00000000000..11b67860093 >--- /dev/null >+++ b/Source/WebCore/dom/DOMHighResTimeStamp.h >@@ -0,0 +1,32 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+using DOMHighResTimeStamp = double; >+ >+} >diff --git a/Source/WebCore/dom/Event.cpp b/Source/WebCore/dom/Event.cpp >index 870595184e1..42d8fa968ab 100644 >--- a/Source/WebCore/dom/Event.cpp >+++ b/Source/WebCore/dom/Event.cpp >@@ -23,17 +23,21 @@ > #include "config.h" > #include "Event.h" > >+#include "DOMWindow.h" >+#include "Document.h" > #include "EventNames.h" > #include "EventPath.h" > #include "EventTarget.h" >+#include "Performance.h" > #include "UserGestureIndicator.h" >+#include "WorkerGlobalScope.h" > #include <wtf/CurrentTime.h> > > namespace WebCore { > > Event::Event(IsTrusted isTrusted) > : m_isTrusted(isTrusted == IsTrusted::Yes) >- , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) >+ , m_createTime(MonotonicTime::now()) > { > } > >@@ -43,17 +47,17 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr > , m_canBubble(canBubbleArg) > , m_cancelable(cancelableArg) > , m_isTrusted(true) >- , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) >+ , m_createTime(MonotonicTime::now()) > { > } > >-Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, double timestamp) >+Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, MonotonicTime timestamp) > : m_type(eventType) > , m_isInitialized(true) > , m_canBubble(canBubbleArg) > , m_cancelable(cancelableArg) > , m_isTrusted(true) >- , m_createTime(convertSecondsToDOMTimeStamp(timestamp)) >+ , m_createTime(timestamp) > { > } > >@@ -64,7 +68,7 @@ Event::Event(const AtomicString& eventType, const EventInit& initializer, IsTrus > , m_cancelable(initializer.cancelable) > , m_composed(initializer.composed) > , m_isTrusted(isTrusted == IsTrusted::Yes) >- , m_createTime(convertSecondsToDOMTimeStamp(currentTime())) >+ , m_createTime(MonotonicTime::now()) > { > } > >@@ -216,4 +220,18 @@ void Event::setUnderlyingEvent(Event* underlyingEvent) > m_underlyingEvent = underlyingEvent; > } > >+DOMHighResTimeStamp Event::timeStamp(ScriptExecutionContext& context) const >+{ >+ Performance* performance = nullptr; >+ if (is<WorkerGlobalScope>(context)) >+ performance = &downcast<WorkerGlobalScope>(context).performance(); >+ else if (auto* window = downcast<Document>(context).domWindow()) >+ performance = window->performance(); >+ >+ if (!performance) >+ return 0; >+ >+ return performance->monotonicTimeToHighResTimeStamp(m_createTime); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h >index 9edb3af31ec..579fa5fab3c 100644 >--- a/Source/WebCore/dom/Event.h >+++ b/Source/WebCore/dom/Event.h >@@ -23,11 +23,12 @@ > > #pragma once > >-#include "DOMTimeStamp.h" >+#include "DOMHighResTimeStamp.h" > #include "EventInit.h" > #include "EventInterfaces.h" > #include "ExceptionOr.h" > #include "ScriptWrappable.h" >+#include <wtf/MonotonicTime.h> > #include <wtf/RefCounted.h> > #include <wtf/TypeCasts.h> > #include <wtf/text/AtomicString.h> >@@ -96,7 +97,9 @@ public: > bool cancelable() const { return m_cancelable; } > WEBCORE_EXPORT bool composed() const; > >- DOMTimeStamp timeStamp() const { return m_createTime; } >+ DOMHighResTimeStamp timeStamp(ScriptExecutionContext&) const; >+ >+ MonotonicTime timeStampAsMonotonicTime() const { return m_createTime; } > > void setEventPath(const EventPath& path) { m_eventPath = &path; } > void clearEventPath() { m_eventPath = nullptr; } >@@ -170,7 +173,7 @@ public: > protected: > Event(IsTrusted = IsTrusted::No); > WEBCORE_EXPORT Event(const AtomicString& type, bool canBubble, bool cancelable); >- Event(const AtomicString& type, bool canBubble, bool cancelable, double timestamp); >+ Event(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp); > Event(const AtomicString& type, const EventInit&, IsTrusted); > > virtual void receivedTarget(); >@@ -195,7 +198,7 @@ private: > RefPtr<EventTarget> m_currentTarget; > const EventPath* m_eventPath { nullptr }; > RefPtr<EventTarget> m_target; >- DOMTimeStamp m_createTime; >+ MonotonicTime m_createTime; > > RefPtr<Event> m_underlyingEvent; > }; >diff --git a/Source/WebCore/dom/Event.idl b/Source/WebCore/dom/Event.idl >index 533f31cc8d5..231688edb31 100644 >--- a/Source/WebCore/dom/Event.idl >+++ b/Source/WebCore/dom/Event.idl >@@ -18,6 +18,8 @@ > * Boston, MA 02110-1301, USA. > */ > >+typedef double DOMHighResTimeStamp; >+ > [ > Constructor(DOMString type, optional EventInit eventInitDict), > CustomToJSObject, >@@ -48,7 +50,7 @@ > [EnabledAtRuntime=ShadowDOM] readonly attribute boolean composed; > > [Unforgeable] readonly attribute boolean isTrusted; >- readonly attribute DOMTimeStamp timeStamp; >+ [CallWith=ScriptExecutionContext] readonly attribute DOMHighResTimeStamp timeStamp; > > void initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // Historical. > >diff --git a/Source/WebCore/dom/KeyboardEvent.cpp b/Source/WebCore/dom/KeyboardEvent.cpp >index 2bd931fc480..0d97d77775c 100644 >--- a/Source/WebCore/dom/KeyboardEvent.cpp >+++ b/Source/WebCore/dom/KeyboardEvent.cpp >@@ -95,7 +95,7 @@ KeyboardEvent::KeyboardEvent() = default; > > KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow* view) > : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()) >- , true, true, key.timestamp(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey() >+ , true, true, MonotonicTime::fromRawSeconds(key.timestamp()), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey() > , key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey)) > , m_keyEvent(std::make_unique<PlatformKeyboardEvent>(key)) > #if ENABLE(KEYBOARD_KEY_ATTRIBUTE) >diff --git a/Source/WebCore/dom/MouseEvent.cpp b/Source/WebCore/dom/MouseEvent.cpp >index eb76d6af91f..78ce0132a05 100644 >--- a/Source/WebCore/dom/MouseEvent.cpp >+++ b/Source/WebCore/dom/MouseEvent.cpp >@@ -34,7 +34,6 @@ > #include "JSEventTargetCustom.h" > #include "PlatformMouseEvent.h" > #include "RuntimeApplicationChecks.h" >-#include <wtf/CurrentTime.h> > > namespace WebCore { > >@@ -51,7 +50,7 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, DOMWindow* vie > bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave; > bool canBubble = !isMouseEnterOrLeave; > >- return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp(), view, >+ return MouseEvent::create(eventType, canBubble, isCancelable, MonotonicTime::fromRawSeconds(event.timestamp()), view, > detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), > #if ENABLE(POINTER_LOCK) > event.movementDelta().x(), event.movementDelta().y(), >@@ -60,7 +59,7 @@ Ref<MouseEvent> MouseEvent::create(const AtomicString& eventType, DOMWindow* vie > relatedTarget, event.force(), event.syntheticClickType()); > } > >-Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow* view, int detail, int screenX, int screenY, int pageX, int pageY, >+Ref<MouseEvent> MouseEvent::create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, int detail, int screenX, int screenY, int pageX, int pageY, > #if ENABLE(POINTER_LOCK) > int movementX, int movementY, > #endif >@@ -83,7 +82,7 @@ MouseEvent::MouseEvent() > { > } > >-MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double timestamp, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, >+MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, > #endif >@@ -103,7 +102,7 @@ MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance > } > > MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cancelable, DOMWindow* view, int detail, const IntPoint& screenLocation, const IntPoint& clientLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short syntheticClickType, EventTarget* relatedTarget) >- : MouseRelatedEvent(eventType, canBubble, cancelable, WTF::currentTime(), view, detail, screenLocation, { }, >+ : MouseRelatedEvent(eventType, canBubble, cancelable, MonotonicTime::now(), view, detail, screenLocation, { }, > #if ENABLE(POINTER_LOCK) > { }, > #endif >diff --git a/Source/WebCore/dom/MouseEvent.h b/Source/WebCore/dom/MouseEvent.h >index e30082bd3af..5f1c03a451b 100644 >--- a/Source/WebCore/dom/MouseEvent.h >+++ b/Source/WebCore/dom/MouseEvent.h >@@ -33,7 +33,7 @@ class PlatformMouseEvent; > > class MouseEvent : public MouseRelatedEvent { > public: >- WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, int detail, int screenX, int screenY, int pageX, int pageY, >+ WEBCORE_EXPORT static Ref<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, int detail, int screenX, int screenY, int pageX, int pageY, > #if ENABLE(POINTER_LOCK) > int movementX, int movementY, > #endif >@@ -71,7 +71,7 @@ public: > int which() const final; > > protected: >- MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, >+ MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, > int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, >diff --git a/Source/WebCore/dom/MouseRelatedEvent.cpp b/Source/WebCore/dom/MouseRelatedEvent.cpp >index eba9a7a92ae..6915e9c3076 100644 >--- a/Source/WebCore/dom/MouseRelatedEvent.cpp >+++ b/Source/WebCore/dom/MouseRelatedEvent.cpp >@@ -32,7 +32,7 @@ > > namespace WebCore { > >-MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double timestamp, DOMWindow* DOMWindow, >+MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* DOMWindow, > int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, >diff --git a/Source/WebCore/dom/MouseRelatedEvent.h b/Source/WebCore/dom/MouseRelatedEvent.h >index 80a730a208a..e35d293c411 100644 >--- a/Source/WebCore/dom/MouseRelatedEvent.h >+++ b/Source/WebCore/dom/MouseRelatedEvent.h >@@ -73,7 +73,7 @@ public: > > protected: > MouseRelatedEvent() = default; >- MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, >+ MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, > int detail, const IntPoint& screenLocation, const IntPoint& windowLocation, > #if ENABLE(POINTER_LOCK) > const IntPoint& movementDelta, >diff --git a/Source/WebCore/dom/SimulatedClick.cpp b/Source/WebCore/dom/SimulatedClick.cpp >index 6fb3b4d7f72..b9077a26daa 100644 >--- a/Source/WebCore/dom/SimulatedClick.cpp >+++ b/Source/WebCore/dom/SimulatedClick.cpp >@@ -46,7 +46,7 @@ public: > > private: > SimulatedMouseEvent(const AtomicString& eventType, DOMWindow* view, RefPtr<Event>&& underlyingEvent, Element& target, SimulatedClickSource source) >- : MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStamp() : currentTime(), view, 0, { }, { }, >+ : MouseEvent(eventType, true, true, underlyingEvent ? underlyingEvent->timeStampAsMonotonicTime() : MonotonicTime::now(), view, 0, { }, { }, > #if ENABLE(POINTER_LOCK) > { }, > #endif >diff --git a/Source/WebCore/dom/UIEvent.cpp b/Source/WebCore/dom/UIEvent.cpp >index 4cb2239ec5b..e815af97afe 100644 >--- a/Source/WebCore/dom/UIEvent.cpp >+++ b/Source/WebCore/dom/UIEvent.cpp >@@ -39,7 +39,7 @@ UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelab > { > } > >-UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, double timestamp, DOMWindow* viewArg, int detailArg) >+UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, MonotonicTime timestamp, DOMWindow* viewArg, int detailArg) > : Event(eventType, canBubbleArg, cancelableArg, timestamp) > , m_view(viewArg) > , m_detail(detailArg) >diff --git a/Source/WebCore/dom/UIEvent.h b/Source/WebCore/dom/UIEvent.h >index 973d73ef3fa..baa731fcf81 100644 >--- a/Source/WebCore/dom/UIEvent.h >+++ b/Source/WebCore/dom/UIEvent.h >@@ -66,7 +66,7 @@ public: > protected: > UIEvent(); > UIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail); >- UIEvent(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, int detail); >+ UIEvent(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow*, int detail); > UIEvent(const AtomicString&, const UIEventInit&, IsTrusted); > > private: >diff --git a/Source/WebCore/dom/UIEventWithKeyState.h b/Source/WebCore/dom/UIEventWithKeyState.h >index bfea387c212..0a8e4031248 100644 >--- a/Source/WebCore/dom/UIEventWithKeyState.h >+++ b/Source/WebCore/dom/UIEventWithKeyState.h >@@ -49,7 +49,7 @@ protected: > { > } > >- UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow* view, >+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, MonotonicTime timestamp, DOMWindow* view, > int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey, bool capsLockKey) > : UIEvent(type, canBubble, cancelable, timestamp, view, detail) > , m_ctrlKey(ctrlKey) >diff --git a/Source/WebCore/dom/WheelEvent.cpp b/Source/WebCore/dom/WheelEvent.cpp >index 530e6b01192..d373f381eb9 100644 >--- a/Source/WebCore/dom/WheelEvent.cpp >+++ b/Source/WebCore/dom/WheelEvent.cpp >@@ -50,7 +50,7 @@ WheelEvent::WheelEvent(const AtomicString& type, const Init& initializer, IsTrus > } > > WheelEvent::WheelEvent(const PlatformWheelEvent& event, DOMWindow* view) >- : MouseEvent(eventNames().wheelEvent, true, true, event.timestamp(), view, 0, event.globalPosition(), event.position() >+ : MouseEvent(eventNames().wheelEvent, true, true, MonotonicTime::fromRawSeconds(event.timestamp()), view, 0, event.globalPosition(), event.position() > #if ENABLE(POINTER_LOCK) > , { } > #endif >diff --git a/Source/WebCore/html/TypeAhead.cpp b/Source/WebCore/html/TypeAhead.cpp >index d26f57d849a..5ffc6c99e79 100644 >--- a/Source/WebCore/html/TypeAhead.cpp >+++ b/Source/WebCore/html/TypeAhead.cpp >@@ -37,12 +37,11 @@ namespace WebCore { > > TypeAhead::TypeAhead(TypeAheadDataSource* dataSource) > : m_dataSource(dataSource) >- , m_lastTypeTime(0) > , m_repeatingChar(0) > { > } > >-static const DOMTimeStamp typeAheadTimeout = 1000; >+static const Seconds typeAheadTimeout { 1_s }; > > static String stripLeadingWhiteSpace(const String& string) > { >@@ -59,12 +58,12 @@ static String stripLeadingWhiteSpace(const String& string) > > int TypeAhead::handleEvent(KeyboardEvent* event, MatchModeFlags matchMode) > { >- if (event->timeStamp() < m_lastTypeTime) >+ if (event->timeStampAsMonotonicTime() < m_lastTypeTime) > return -1; > > int optionCount = m_dataSource->optionCount(); >- DOMTimeStamp delta = event->timeStamp() - m_lastTypeTime; >- m_lastTypeTime = event->timeStamp(); >+ Seconds delta = event->timeStampAsMonotonicTime() - m_lastTypeTime; >+ m_lastTypeTime = event->timeStampAsMonotonicTime(); > > UChar c = event->charCode(); > >diff --git a/Source/WebCore/html/TypeAhead.h b/Source/WebCore/html/TypeAhead.h >index 610ac78288b..f33ca1d073e 100644 >--- a/Source/WebCore/html/TypeAhead.h >+++ b/Source/WebCore/html/TypeAhead.h >@@ -25,7 +25,7 @@ > > #pragma once > >-#include "DOMTimeStamp.h" >+#include "wtf/MonotonicTime.h" > #include <wtf/text/StringBuilder.h> > #include <wtf/text/WTFString.h> > >@@ -58,7 +58,7 @@ public: > > private: > TypeAheadDataSource* m_dataSource; >- DOMTimeStamp m_lastTypeTime; >+ MonotonicTime m_lastTypeTime; > UChar m_repeatingChar; > StringBuilder m_buffer; > }; >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index 5c848afd9b0..44e645a26b9 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -2190,7 +2190,7 @@ bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Element& dra > > view->disableLayerFlushThrottlingTemporarilyForInteraction(); > Ref<MouseEvent> me = MouseEvent::create(eventType, >- true, true, event.timestamp(), m_frame.document()->defaultView(), >+ true, true, MonotonicTime::fromRawSeconds(event.timestamp()), m_frame.document()->defaultView(), > 0, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(), > #if ENABLE(POINTER_LOCK) > event.movementDelta().x(), event.movementDelta().y(), >diff --git a/Source/WebCore/page/Performance.cpp b/Source/WebCore/page/Performance.cpp >index 1afa3645913..f2e14bcf75b 100644 >--- a/Source/WebCore/page/Performance.cpp >+++ b/Source/WebCore/page/Performance.cpp >@@ -69,7 +69,7 @@ void Performance::contextDestroyed() > ContextDestructionObserver::contextDestroyed(); > } > >-double Performance::now() const >+DOMHighResTimeStamp Performance::now() const > { > Seconds now = MonotonicTime::now() - m_timeOrigin; > return reduceTimeResolution(now).milliseconds(); >@@ -82,6 +82,12 @@ Seconds Performance::reduceTimeResolution(Seconds seconds) > return Seconds(reduced); > } > >+DOMHighResTimeStamp Performance::monotonicTimeToHighResTimeStamp(MonotonicTime timestamp) const >+{ >+ Seconds seconds = timestamp - m_timeOrigin; >+ return reduceTimeResolution(seconds).milliseconds(); >+} >+ > PerformanceNavigation* Performance::navigation() > { > if (!is<Document>(scriptExecutionContext())) >diff --git a/Source/WebCore/page/Performance.h b/Source/WebCore/page/Performance.h >index 9a60ec0ab2c..d1486b835f2 100644 >--- a/Source/WebCore/page/Performance.h >+++ b/Source/WebCore/page/Performance.h >@@ -33,6 +33,7 @@ > #pragma once > > #include "ContextDestructionObserver.h" >+#include "DOMHighResTimeStamp.h" > #include "EventTarget.h" > #include "ExceptionOr.h" > #include "GenericTaskQueue.h" >@@ -56,7 +57,7 @@ public: > static Ref<Performance> create(ScriptExecutionContext& context, MonotonicTime timeOrigin) { return adoptRef(*new Performance(context, timeOrigin)); } > ~Performance(); > >- double now() const; >+ DOMHighResTimeStamp now() const; > > PerformanceNavigation* navigation(); > PerformanceTiming* timing(); >@@ -82,6 +83,8 @@ public: > > static Seconds reduceTimeResolution(Seconds); > >+ DOMHighResTimeStamp monotonicTimeToHighResTimeStamp(MonotonicTime) const; >+ > ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); } > > using RefCounted::ref; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 0eabe65990d..f52a45b59c7 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -1281,7 +1281,7 @@ void WebPage::navigateToPDFLinkWithSimulatedClick(const String& url, IntPoint do > return; > > const int singleClick = 1; >- RefPtr<MouseEvent> mouseEvent = MouseEvent::create(eventNames().clickEvent, true, true, currentTime(), nullptr, singleClick, screenPoint.x(), screenPoint.y(), documentPoint.x(), documentPoint.y(), >+ RefPtr<MouseEvent> mouseEvent = MouseEvent::create(eventNames().clickEvent, true, true, MonotonicTime::now(), nullptr, singleClick, screenPoint.x(), screenPoint.y(), documentPoint.x(), documentPoint.y(), > #if ENABLE(POINTER_LOCK) > 0, 0, > #endif >diff --git a/Source/WebKitLegacy/mac/DOM/DOMEvent.mm b/Source/WebKitLegacy/mac/DOM/DOMEvent.mm >index 95f84dd25a8..a5988c8be09 100644 >--- a/Source/WebKitLegacy/mac/DOM/DOMEvent.mm >+++ b/Source/WebKitLegacy/mac/DOM/DOMEvent.mm >@@ -97,7 +97,7 @@ > - (DOMTimeStamp)timeStamp > { > WebCore::JSMainThreadNullState state; >- return IMPL->timeStamp(); >+ return IMPL->timeStampAsMonotonicTime().secondsSinceEpoch().milliseconds(); > } > > - (BOOL)defaultPrevented >diff --git a/Source/WebKitLegacy/mac/WebView/WebPDFView.mm b/Source/WebKitLegacy/mac/WebView/WebPDFView.mm >index ec57c88a6ca..18e35a5bd04 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPDFView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebPDFView.mm >@@ -1018,14 +1018,14 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range) > case NSEventTypeKeyDown: { > PlatformKeyboardEvent pe = PlatformEventFactory::createPlatformKeyboardEvent(nsEvent); > pe.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); >- event = KeyboardEvent::create(pe, 0); >+ event = KeyboardEvent::create(pe, nullptr); > break; > } > default: > break; > } > if (button != noButton) { >- event = MouseEvent::create(eventNames().clickEvent, true, true, currentTime(), 0, [nsEvent clickCount], 0, 0, 0, 0, >+ event = MouseEvent::create(eventNames().clickEvent, true, true, MonotonicTime::now(), 0, [nsEvent clickCount], 0, 0, 0, 0, > #if ENABLE(POINTER_LOCK) > 0, 0, > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 154246
:
321348
|
321384
|
321385
|
321387
|
321388
|
321390
|
321430
|
321432
|
321433
|
321435
|
321437
|
321440
|
321458
|
321462
|
321463
|
321466
|
321473
|
321474
|
321551
|
321556