imported/w3c/web-platform-tests/css/css-ui-3/text-overflow-015.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-ui-3/text-overflow-017.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-ui-3/text-overflow-021.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/dom/events/Event-timestamp-high-resolution.html [ Failure ]
imported/w3c/web-platform-tests/dom/nodes/Document-constructor-svg.svg [ Timeout ]
imported/w3c/web-platform-tests/fetch/security/dangling-markup-mitigation.tentative.html [ Pass Failure ]
imported/w3c/web-platform-tests/hr-time/timeOrigin.html [ Failure ]
+2017-09-22 Chris Dumez <cdumez@apple.com>
+
+ Use high resolution timestamp for event time
+ https://bugs.webkit.org/show_bug.cgi?id=154246
+ <rdar://problem/34333304>
+
+ Reviewed by Ryosuke Niwa.
+
+ Rebaseline WPT test now that more checks are passing.
+
+ * web-platform-tests/dom/events/Event-timestamp-high-resolution-expected.txt:
+
2017-09-22 Zan Dobersek <zdobersek@igalia.com>
Unreviewed WPE gardening. Updating the WPT EME idlharness.html
-FAIL Constructed MouseEvent timestamp should be high resolution and have the same time origin as performance.now() assert_less_than_equal: Event timestamp should be less than performance.now() timestamp taken after its creation expected a number less than or equal to 523.8000000000001 but got 1505770152566
-FAIL Constructed KeyboardEvent timestamp should be high resolution and have the same time origin as performance.now() assert_less_than_equal: Event timestamp should be less than performance.now() timestamp taken after its creation expected a number less than or equal to 524.4 but got 1505770152566
-FAIL Constructed WheelEvent timestamp should be high resolution and have the same time origin as performance.now() assert_less_than_equal: Event timestamp should be less than performance.now() timestamp taken after its creation expected a number less than or equal to 524.5000000000001 but got 1505770152566
-FAIL Constructed GamepadEvent timestamp should be high resolution and have the same time origin as performance.now() Not enough arguments
-FAIL Constructed FocusEvent timestamp should be high resolution and have the same time origin as performance.now() assert_less_than_equal: Event timestamp should be less than performance.now() timestamp taken after its creation expected a number less than or equal to 524.6 but got 1505770152566
+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()
+PASS Constructed GamepadEvent timestamp should be high resolution and have the same time origin as performance.now()
+PASS Constructed FocusEvent timestamp should be high resolution and have the same time origin as performance.now()
+2017-09-22 Chris Dumez <cdumez@apple.com>
+
+ Use high resolution timestamp for event time
+ https://bugs.webkit.org/show_bug.cgi?id=154246
+ <rdar://problem/34333304>
+
+ Reviewed by Ryosuke Niwa.
+
+ 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):
+
2017-09-22 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr>
[GTK] HTMLMediaElement resize event not fired when video size changes
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 */; };
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>"; };
BC60D6E80D28D83400B9918F /* DOMException.h */,
BC60D6EB0D28D99900B9918F /* DOMException.idl */,
BC9A6141146859D9006057FD /* DOMExceptions.in */,
+ 46E016AD1F72D61E00282B2C /* DOMHighResTimeStamp.h */,
A8185F3609765765005826D9 /* DOMImplementation.cpp */,
A8185F3309765765005826D9 /* DOMImplementation.h */,
93EEC1E909C2877700C515D1 /* DOMImplementation.idl */,
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 */,
--- /dev/null
+/*
+ * 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;
+
+}
if (!frame)
return false;
- PlatformMouseEvent platformMouseEvent { frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WTF::currentTime(), ForceAtClick, NoTap };
+ PlatformMouseEvent platformMouseEvent { frame->eventHandler().lastKnownMousePosition(), frame->eventHandler().lastKnownMouseGlobalPosition(), NoButton, PlatformEvent::NoType, 1, false, false, false, false, WallTime::now(), ForceAtClick, NoTap };
auto mouseForceWillBeginEvent = MouseEvent::create(eventNames().webkitmouseforcewillbeginEvent, document().defaultView(), platformMouseEvent, 0, nullptr);
mouseForceWillBeginEvent->setTarget(this);
dispatchEvent(mouseForceWillBeginEvent);
#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())
{
}
, 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)
{
}
, m_cancelable(initializer.cancelable)
, m_composed(initializer.composed)
, m_isTrusted(isTrusted == IsTrusted::Yes)
- , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
+ , m_createTime(MonotonicTime::now())
{
}
m_underlyingEvent = underlyingEvent;
}
+DOMHighResTimeStamp Event::timeStampForBindings(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->relativeTimeFromTimeOriginInReducedResolution(m_createTime);
+}
+
} // namespace WebCore
#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>
bool cancelable() const { return m_cancelable; }
WEBCORE_EXPORT bool composed() const;
- DOMTimeStamp timeStamp() const { return m_createTime; }
+ DOMHighResTimeStamp timeStampForBindings(ScriptExecutionContext&) const;
+ MonotonicTime timeStamp() const { return m_createTime; }
void setEventPath(const EventPath& path) { m_eventPath = &path; }
void clearEventPath() { m_eventPath = nullptr; }
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();
RefPtr<EventTarget> m_currentTarget;
const EventPath* m_eventPath { nullptr };
RefPtr<EventTarget> m_target;
- DOMTimeStamp m_createTime;
+ MonotonicTime m_createTime;
RefPtr<Event> m_underlyingEvent;
};
* Boston, MA 02110-1301, USA.
*/
+typedef double DOMHighResTimeStamp;
+
[
Constructor(DOMString type, optional EventInit eventInitDict),
CustomToJSObject,
[EnabledAtRuntime=ShadowDOM] readonly attribute boolean composed;
[Unforgeable] readonly attribute boolean isTrusted;
- readonly attribute DOMTimeStamp timeStamp;
+ [CallWith=ScriptExecutionContext, ImplementedAs=timeStampForBindings] readonly attribute DOMHighResTimeStamp timeStamp;
void initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // Historical.
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, key.timestamp().approximateMonotonicTime(), 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)
#include "JSEventTargetCustom.h"
#include "PlatformMouseEvent.h"
#include "RuntimeApplicationChecks.h"
-#include <wtf/CurrentTime.h>
namespace WebCore {
bool isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave;
bool canBubble = !isMouseEnterOrLeave;
- return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp(), view,
+ return MouseEvent::create(eventType, canBubble, isCancelable, event.timestamp().approximateMonotonicTime(), view,
detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
#if ENABLE(POINTER_LOCK)
event.movementDelta().x(), event.movementDelta().y(),
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
{
}
-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
}
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
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
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,
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,
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,
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->timeStamp() : MonotonicTime::now(), view, 0, { }, { },
#if ENABLE(POINTER_LOCK)
{ },
#endif
#include "TouchEvent.h"
#include "EventDispatcher.h"
-#include <wtf/CurrentTime.h>
namespace WebCore {
TouchList* changedTouches, const AtomicString& type,
DOMWindow* view, int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
- : MouseRelatedEvent(type, true, true, currentTime(), view, 0, IntPoint(screenX, screenY),
+ : MouseRelatedEvent(type, true, true, MonotonicTime::now(), view, 0, IntPoint(screenX, screenY),
IntPoint(pageX, pageY),
#if ENABLE(POINTER_LOCK)
IntPoint(0, 0),
{
}
-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)
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:
{
}
- 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)
}
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, event.timestamp().approximateMonotonicTime(), view, 0, event.globalPosition(), event.position()
#if ENABLE(POINTER_LOCK)
, { }
#endif
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)
{
return -1;
int optionCount = m_dataSource->optionCount();
- DOMTimeStamp delta = event->timeStamp() - m_lastTypeTime;
+ Seconds delta = event->timeStamp() - m_lastTypeTime;
m_lastTypeTime = event->timeStamp();
UChar c = event->charCode();
#pragma once
-#include "DOMTimeStamp.h"
+#include <wtf/MonotonicTime.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
private:
TypeAheadDataSource* m_dataSource;
- DOMTimeStamp m_lastTypeTime;
+ MonotonicTime m_lastTypeTime;
UChar m_repeatingChar;
StringBuilder m_buffer;
};
#include "RenderView.h"
#include "ScrollView.h"
#include "Settings.h"
-#include <wtf/CurrentTime.h>
namespace WebCore {
// Delay time in second for start autoscroll if pointer is in border edge of scrollable element.
-static const double autoscrollDelay = 0.2;
+static const Seconds autoscrollDelay { 200_ms };
// When the autoscroll or the panScroll is triggered when do the scroll every 50ms to make it smooth.
static const Seconds autoscrollInterval { 50_ms };
: m_autoscrollTimer(*this, &AutoscrollController::autoscrollTimerFired)
, m_autoscrollRenderer(nullptr)
, m_autoscrollType(NoAutoscroll)
- , m_dragAndDropAutoscrollStartTime(0)
{
}
m_autoscrollRenderer = is<RenderBox>(renderer) ? downcast<RenderBox>(renderer) : nullptr;
}
-void AutoscrollController::updateDragAndDrop(Node* dropTargetNode, const IntPoint& eventPosition, double eventTime)
+void AutoscrollController::updateDragAndDrop(Node* dropTargetNode, const IntPoint& eventPosition, WallTime eventTime)
{
if (!dropTargetNode) {
stopAutoscrollTimer();
Frame& frame = m_autoscrollRenderer->frame();
switch (m_autoscrollType) {
case AutoscrollForDragAndDrop:
- if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDelay)
+ if (WallTime::now() - m_dragAndDropAutoscrollStartTime > autoscrollDelay)
m_autoscrollRenderer->autoscroll(m_dragAndDropAutoscrollReferencePosition);
break;
case AutoscrollForSelection: {
#include "IntPoint.h"
#include "Timer.h"
+#include <wtf/WallTime.h>
namespace WebCore {
void startAutoscrollForSelection(RenderObject*);
void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
void updateAutoscrollRenderer();
- void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, double eventTime);
+ void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, WallTime eventTime);
#if ENABLE(PAN_SCROLLING)
void didPanScrollStart();
void didPanScrollStop();
RenderBox* m_autoscrollRenderer;
AutoscrollType m_autoscrollType;
IntPoint m_dragAndDropAutoscrollReferencePosition;
- double m_dragAndDropAutoscrollStartTime;
+ WallTime m_dragAndDropAutoscrollStartTime;
#if ENABLE(PAN_SCROLLING)
IntPoint m_panScrollStartPos;
#endif
#include "UserTypingGestureIndicator.h"
#include "WindowFeatures.h"
#include "markup.h"
+#include <wtf/WallTime.h>
#include <wtf/unicode/CharacterNames.h>
using namespace WTF;
clearContextMenu();
// Simulate a click in the middle of the accessibility object.
- PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), ForceAtClick, NoTap);
+ PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, WallTime::now(), ForceAtClick, NoTap);
frame.eventHandler().handleMousePressEvent(mouseEvent);
bool handled = frame.eventHandler().sendContextMenuEvent(mouseEvent);
if (handled)
return PlatformMouseEvent(dragData.clientPosition(), dragData.globalPosition(),
LeftButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey,
- metaKey, currentTime(), ForceAtClick, NoTap);
+ metaKey, WallTime::now(), ForceAtClick, NoTap);
}
DragController::DragController(Page& page, DragClient& client)
const int TextDragHysteresis = 3;
const int GeneralDragHysteresis = 3;
#if PLATFORM(COCOA)
-const double EventHandler::TextDragDelay = 0.15;
+const Seconds EventHandler::TextDragDelay { 150_ms };
#endif
#endif // ENABLE(DRAG_SUPPORT)
view->disableLayerFlushThrottlingTemporarilyForInteraction();
Ref<MouseEvent> me = MouseEvent::create(eventType,
- true, true, event.timestamp(), m_frame.document()->defaultView(),
+ true, true, event.timestamp().approximateMonotonicTime(), 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(),
PlatformEvent::Type eventType = PlatformEvent::MousePressed;
#endif
- PlatformMouseEvent platformMouseEvent(position, globalPosition, RightButton, eventType, 1, false, false, false, false, WTF::currentTime(), ForceAtClick, NoTap);
+ PlatformMouseEvent platformMouseEvent(position, globalPosition, RightButton, eventType, 1, false, false, false, false, WallTime::now(), ForceAtClick, NoTap);
return sendContextMenuEvent(platformMouseEvent);
}
bool altKey;
bool metaKey;
PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey);
- PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownMouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime(), 0, NoTap);
+ PlatformMouseEvent fakeMouseMoveEvent(m_lastKnownMousePosition, m_lastKnownMouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, NoTap);
mouseMoved(fakeMouseMoveEvent);
}
#endif // !ENABLE(IOS_TOUCH_EVENTS)
private:
#if ENABLE(DRAG_SUPPORT)
static DragState& dragState();
- static const double TextDragDelay;
+ static const Seconds TextDragDelay;
Ref<DataTransfer> createDraggingDataTransfer() const;
#endif
IntPoint m_lastKnownMousePosition;
IntPoint m_lastKnownMouseGlobalPosition;
IntPoint m_mouseDownPos; // In our view's coords.
- double m_mouseDownTimestamp { 0 };
+ WallTime m_mouseDownTimestamp;
PlatformMouseEvent m_mouseDown;
#if PLATFORM(COCOA)
ContextDestructionObserver::contextDestroyed();
}
-double Performance::now() const
+DOMHighResTimeStamp Performance::now() const
{
Seconds now = MonotonicTime::now() - m_timeOrigin;
return reduceTimeResolution(now).milliseconds();
return Seconds(reduced);
}
+DOMHighResTimeStamp Performance::relativeTimeFromTimeOriginInReducedResolution(MonotonicTime timestamp) const
+{
+ Seconds seconds = timestamp - m_timeOrigin;
+ return reduceTimeResolution(seconds).milliseconds();
+}
+
PerformanceNavigation* Performance::navigation()
{
if (!is<Document>(scriptExecutionContext()))
#pragma once
#include "ContextDestructionObserver.h"
+#include "DOMHighResTimeStamp.h"
#include "EventTarget.h"
#include "ExceptionOr.h"
#include "GenericTaskQueue.h"
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();
static Seconds reduceTimeResolution(Seconds);
+ DOMHighResTimeStamp relativeTimeFromTimeOriginInReducedResolution(MonotonicTime) const;
+
ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
using RefCounted::ref;
IntPoint adjustedClientPosition = roundedIntPoint(adjustedClientPositionAsFloatPoint);
IntPoint adjustedGlobalPosition = protectedFrame->view()->windowToContents(adjustedClientPosition);
- PlatformMouseEvent syntheticMousePressEvent(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), 0, NoTap);
- PlatformMouseEvent syntheticMouseMoveEvent(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, NoTap);
+ PlatformMouseEvent syntheticMousePressEvent(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, WallTime::now(), 0, NoTap);
+ PlatformMouseEvent syntheticMouseMoveEvent(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), 0, NoTap);
HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent);
auto documentPoint = protectedFrame->view() ? protectedFrame->view()->windowToContents(syntheticMouseMoveEvent.position()) : syntheticMouseMoveEvent.position();
namespace WebCore {
#if ENABLE(DRAG_SUPPORT)
-const double EventHandler::TextDragDelay = 0.0;
+const Seconds EventHandler::TextDragDelay { 0_s };
#endif
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
#pragma once
#include <wtf/OptionSet.h>
+#include <wtf/WallTime.h>
namespace WebCore {
OptionSet<Modifier> modifiers() const { return m_modifiers; }
- double timestamp() const { return m_timestamp; }
+ WallTime timestamp() const { return m_timestamp; }
protected:
PlatformEvent()
: m_type(NoType)
- , m_timestamp(0)
{
}
explicit PlatformEvent(Type type)
: m_type(type)
- , m_timestamp(0)
{
}
- PlatformEvent(Type type, OptionSet<Modifier> modifiers, double timestamp)
+ PlatformEvent(Type type, OptionSet<Modifier> modifiers, WallTime timestamp)
: m_type(type)
, m_modifiers(modifiers)
, m_timestamp(timestamp)
{
}
- PlatformEvent(Type type, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp)
+ PlatformEvent(Type type, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, WallTime timestamp)
: m_type(type)
, m_timestamp(timestamp)
{
unsigned m_type;
OptionSet<Modifier> m_modifiers;
- double m_timestamp;
+ WallTime m_timestamp;
};
} // namespace WebCore
#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
const String& code,
#endif
- const String& keyIdentifier, int windowsVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, double timestamp)
+ const String& keyIdentifier, int windowsVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, OptionSet<Modifier> modifiers, WallTime timestamp)
: PlatformEvent(type, modifiers, timestamp)
, m_text(text)
, m_unmodifiedText(unmodifiedText)
}
PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type,
- int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, double timestamp, double force, SyntheticClickType syntheticClickType)
+ int clickCount, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
: PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
}
PlatformWheelEvent(IntPoint position, IntPoint globalPosition, float deltaX, float deltaY, float wheelTicksX, float wheelTicksY, PlatformWheelEventGranularity granularity, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey)
- : PlatformEvent(PlatformEvent::Wheel, shiftKey, ctrlKey, altKey, metaKey, 0)
+ : PlatformEvent(PlatformEvent::Wheel, shiftKey, ctrlKey, altKey, metaKey, { })
, m_position(position)
, m_globalPosition(globalPosition)
, m_deltaX(deltaX)
if (!m_momentumScrollInProgress && (momentumPhase == PlatformWheelEventPhaseBegan || momentumPhase == PlatformWheelEventPhaseChanged))
m_momentumScrollInProgress = true;
- CFTimeInterval timeDelta = wheelEvent.timestamp() - m_lastMomentumScrollTimestamp;
+ CFTimeInterval timeDelta = wheelEvent.timestamp().secondsSinceEpoch().value() - m_lastMomentumScrollTimestamp;
if (m_inScrollGesture || m_momentumScrollInProgress) {
if (m_lastMomentumScrollTimestamp && timeDelta > 0 && timeDelta < scrollVelocityZeroingTimeout) {
m_momentumVelocity.setWidth(eventCoalescedDeltaX / (float)timeDelta);
m_momentumVelocity.setHeight(eventCoalescedDeltaY / (float)timeDelta);
- m_lastMomentumScrollTimestamp = wheelEvent.timestamp();
+ m_lastMomentumScrollTimestamp = wheelEvent.timestamp().secondsSinceEpoch().value();
} else {
- m_lastMomentumScrollTimestamp = wheelEvent.timestamp();
+ m_lastMomentumScrollTimestamp = wheelEvent.timestamp().secondsSinceEpoch().value();
m_momentumVelocity = FloatSize();
}
namespace WebCore {
#if ENABLE(DRAG_SUPPORT)
-const double EventHandler::TextDragDelay = 0.0;
+const Seconds EventHandler::TextDragDelay { 0_s };
#endif
bool EventHandler::tabsToAllFormControls(KeyboardEvent&) const
// Keep this in sync with the other platform event constructors
PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEventKey* event, const CompositionResults& compositionResults)
- : PlatformEvent(eventTypeForGdkKeyEvent(event), modifiersForGdkKeyEvent(event), currentTime())
+ : PlatformEvent(eventTypeForGdkKeyEvent(event), modifiersForGdkKeyEvent(event), WallTime::now())
, m_text(compositionResults.simpleString.length() ? compositionResults.simpleString : singleCharacterString(event->keyval))
, m_unmodifiedText(m_text)
, m_key(keyValueForGdkKeyCode(event->keyval))
// Keep this in sync with the other platform event constructors
PlatformMouseEvent::PlatformMouseEvent(GdkEventButton* event)
{
- m_timestamp = event->time;
+ m_timestamp = WallTime::fromRawSeconds(event->time);
m_position = IntPoint((int)event->x, (int)event->y);
m_globalPosition = IntPoint((int)event->x_root, (int)event->y_root);
m_button = NoButton;
PlatformMouseEvent::PlatformMouseEvent(GdkEventMotion* motion)
{
- m_timestamp = motion->time;
+ m_timestamp = WallTime::fromRawSeconds(motion->time);
m_position = IntPoint((int)motion->x, (int)motion->y);
m_globalPosition = IntPoint((int)motion->x_root, (int)motion->y_root);
m_button = NoButton;
#include "Scrollbar.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#include <wtf/CurrentTime.h>
+#include <wtf/WallTime.h>
namespace WebCore {
static const float delta = 1;
m_type = PlatformEvent::Wheel;
- m_timestamp = currentTime();
+ m_timestamp = WallTime::now();
if (event->state & GDK_SHIFT_MASK)
m_modifiers |= Modifier::ShiftKey;
if (m_scrollHistory.isEmpty())
return { };
- double first = m_scrollHistory[0].timestamp();
- double last = m_scrollHistory.rbegin()->timestamp();
+ auto first = m_scrollHistory[0].timestamp();
+ auto last = m_scrollHistory.rbegin()->timestamp();
if (last == first)
return { };
m_scrollHistory.clear();
- return FloatPoint(accumDelta.x() * -1000 / (last - first), accumDelta.y() * -1000 / (last - first));
+ return FloatPoint(accumDelta.x() * -1000 / (last - first).value(), accumDelta.y() * -1000 / (last - first).value());
}
bool ScrollAnimatorGtk::handleWheelEvent(const PlatformWheelEvent& event)
m_kineticAnimation->stop();
m_scrollHistory.removeAllMatching([&event] (PlatformWheelEvent& otherEvent) -> bool {
- return Seconds::fromMilliseconds(event.timestamp() - otherEvent.timestamp()) > scrollCaptureThreshold;
+ return (event.timestamp() - otherEvent.timestamp()) > scrollCaptureThreshold;
});
if (event.isEndOfNonMomentumScroll()) {
#import "WAKAppKitStubs.h"
#import "WebEvent.h"
#import "WindowsKeyboardCodes.h"
-#import <wtf/CurrentTime.h>
+#import <wtf/WallTime.h>
namespace WebCore {
PlatformMouseEventBuilder(WebEvent *event)
{
m_type = mouseEventType(event);
- m_timestamp = currentTime();
+ m_timestamp = WallTime::now();
m_position = pointForEvent(event);
m_globalPosition = globalPointForEvent(event);
ASSERT(event.type == WebEventScrollWheel);
m_type = PlatformEvent::Wheel;
- m_timestamp = currentTime();
+ m_timestamp = WallTime::now();
m_position = pointForEvent(event);
m_globalPosition = globalPointForEvent(event);
m_type = (event.type == WebEventKeyUp ? PlatformEvent::KeyUp : PlatformEvent::KeyDown);
m_modifiers = modifiersForEvent(event);
- m_timestamp = currentTime();
+ m_timestamp = WallTime::now();
m_text = event.characters;
m_unmodifiedText = event.charactersIgnoringModifiers;
{
m_type = touchEventType(event);
m_modifiers = modifiersForEvent(event);
- m_timestamp = event.timestamp;
+ m_timestamp = WallTime::fromRawSeconds(event.timestamp);
m_gestureScale = event.gestureScale;
m_gestureRotation = event.gestureRotation;
PlatformTouchEventBuilder(PlatformEvent::Type type, IntPoint location)
{
m_type = type;
- m_timestamp = currentTime();
+ m_timestamp = WallTime::now();
m_gestureScale = 1;
m_gestureRotation = 0;
WEBCORE_EXPORT String keyIdentifierForKeyEvent(NSEvent *);
WEBCORE_EXPORT String keyForKeyEvent(NSEvent *);
WEBCORE_EXPORT String codeForKeyEvent(NSEvent *);
-WEBCORE_EXPORT double eventTimeStampSince1970(NSEvent *);
+WEBCORE_EXPORT WallTime eventTimeStampSince1970(NSEvent *);
WEBCORE_EXPORT void getWheelEventDeltas(NSEvent *, float& deltaX, float& deltaY, BOOL& continuous);
WEBCORE_EXPORT UInt8 keyCharForEvent(NSEvent *);
#import <pal/spi/mac/NSEventSPI.h>
#import <pal/spi/mac/NSMenuSPI.h>
#import <wtf/ASCIICType.h>
+#import <wtf/WallTime.h>
namespace WebCore {
return systemStartupTime;
}
-double eventTimeStampSince1970(NSEvent* event)
+WallTime eventTimeStampSince1970(NSEvent* event)
{
- return static_cast<double>(cachedStartupTimeIntervalSince1970() + [event timestamp]);
+ return WallTime::fromRawSeconds(static_cast<double>(cachedStartupTimeIntervalSince1970() + [event timestamp]));
}
static inline bool isKeyUpEvent(NSEvent *event)
}
PlatformKeyboardEvent::PlatformKeyboardEvent(HWND, WPARAM code, LPARAM keyData, Type type, bool systemKey)
- : PlatformEvent(type, GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, false, ::GetTickCount() * 0.001)
+ : PlatformEvent(type, GetKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, false, WallTime::fromRawSeconds(::GetTickCount() * 0.001))
, m_text((type == PlatformEvent::Char) ? singleCharacterString(code) : String())
, m_unmodifiedText((type == PlatformEvent::Char) ? singleCharacterString(code) : String())
, m_keyIdentifier((type == PlatformEvent::Char) ? String() : keyIdentifierForWindowsKeyCode(code))
}
PlatformMouseEvent::PlatformMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool didActivateWebView)
- : PlatformEvent(messageToEventType(message), wParam & MK_SHIFT, wParam & MK_CONTROL, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, currentTime())
+ : PlatformEvent(messageToEventType(message), wParam & MK_SHIFT, wParam & MK_CONTROL, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, WallTime::now())
, m_position(positionForEvent(hWnd, lParam))
, m_globalPosition(globalPositionForEvent(hWnd, lParam))
, m_clickCount(0)
}
PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, const FloatSize& delta, const FloatPoint& location)
- : PlatformEvent(PlatformEvent::Wheel, false, false, false, false, ::GetTickCount() * 0.001)
+ : PlatformEvent(PlatformEvent::Wheel, false, false, false, false, WallTime::fromRawSeconds(::GetTickCount() * 0.001))
, m_directionInvertedFromDevice(false)
{
m_deltaX = delta.width();
}
PlatformWheelEvent::PlatformWheelEvent(HWND hWnd, WPARAM wParam, LPARAM lParam, bool isMouseHWheel)
- : PlatformEvent(PlatformEvent::Wheel, wParam & MK_SHIFT, wParam & MK_CONTROL, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, ::GetTickCount() * 0.001)
+ : PlatformEvent(PlatformEvent::Wheel, wParam & MK_SHIFT, wParam & MK_CONTROL, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, GetKeyState(VK_MENU) & HIGH_BIT_MASK_SHORT, WallTime::fromRawSeconds(::GetTickCount() * 0.001))
, m_position(positionForEvent(hWnd, lParam))
, m_globalPosition(globalPositionForEvent(hWnd, lParam))
, m_directionInvertedFromDevice(false)
+2017-09-22 Chris Dumez <cdumez@apple.com>
+
+ Use high resolution timestamp for event time
+ https://bugs.webkit.org/show_bug.cgi?id=154246
+ <rdar://problem/34333304>
+
+ Reviewed by Ryosuke Niwa.
+
+ 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):
+
2017-09-22 Fujii Hironori <Hironori.Fujii@sony.com>
[GTK] Web Inspector: Can't load three.js
#include <pal/SessionID.h>
#include <wtf/MonotonicTime.h>
#include <wtf/Seconds.h>
+#include <wtf/WallTime.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringHash.h>
return true;
}
+void ArgumentCoder<WallTime>::encode(Encoder& encoder, const WallTime& time)
+{
+ encoder << time.secondsSinceEpoch().value();
+}
+
+bool ArgumentCoder<WallTime>::decode(Decoder& decoder, WallTime& time)
+{
+ double value;
+ if (!decoder.decode(value))
+ return false;
+
+ time = WallTime::fromRawSeconds(value);
+ return true;
+}
+
void ArgumentCoder<Seconds>::encode(Encoder& encoder, const Seconds& seconds)
{
encoder << seconds.value();
namespace WTF {
class MonotonicTime;
class Seconds;
+class WallTime;
}
namespace WebCore {
static bool decode(Decoder&, WTF::MonotonicTime&);
};
+template<> struct ArgumentCoder<WTF::WallTime> {
+ static void encode(Encoder&, const WTF::WallTime&);
+ static bool decode(Decoder&, WTF::WallTime&);
+};
+
template<> struct ArgumentCoder<WTF::Seconds> {
static void encode(Encoder&, const WTF::Seconds&);
static bool decode(Decoder&, WTF::Seconds&);
#include "Decoder.h"
#include "Encoder.h"
+#include "WebCoreArgumentCoders.h"
namespace WebKit {
WebEvent::WebEvent()
: m_type(static_cast<uint32_t>(NoType))
, m_modifiers(0)
- , m_timestamp(0)
{
}
-WebEvent::WebEvent(Type type, Modifiers modifiers, double timestamp)
+WebEvent::WebEvent(Type type, Modifiers modifiers, WallTime timestamp)
: m_type(type)
, m_modifiers(modifiers)
, m_timestamp(timestamp)
#include <WebCore/FloatSize.h>
#include <WebCore/IntPoint.h>
#include <WebCore/IntSize.h>
+#include <wtf/WallTime.h>
#include <wtf/text/WTFString.h>
namespace IPC {
Modifiers modifiers() const { return static_cast<Modifiers>(m_modifiers); }
- double timestamp() const { return m_timestamp; }
+ WallTime timestamp() const { return m_timestamp; }
protected:
WebEvent();
- WebEvent(Type, Modifiers, double timestamp);
+ WebEvent(Type, Modifiers, WallTime timestamp);
void encode(IPC::Encoder&) const;
static bool decode(IPC::Decoder&, WebEvent&);
private:
uint32_t m_type; // Type
uint32_t m_modifiers; // Modifiers
- double m_timestamp;
+ WallTime m_timestamp;
};
// FIXME: Move this class to its own header file.
WebMouseEvent();
#if PLATFORM(MAC)
- WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
+ WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
#else
- WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, double force = 0, SyntheticClickType = NoTap);
+ WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
#endif
Button button() const { return static_cast<Button>(m_button); }
WebWheelEvent() { }
- WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Modifiers, double timestamp);
+ WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Modifiers, WallTime timestamp);
#if PLATFORM(COCOA)
- WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, bool directionInvertedFromDevice, Phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, Modifiers, double timestamp);
+ WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, bool directionInvertedFromDevice, Phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, Modifiers, WallTime timestamp);
#elif PLATFORM(GTK)
- WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Phase, Phase momentumPhase, Granularity, Modifiers, double timestamp);
+ WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Phase, Phase momentumPhase, Granularity, Modifiers, WallTime timestamp);
#endif
const WebCore::IntPoint position() const { return m_position; }
~WebKeyboardEvent();
#if USE(APPKIT)
- WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>&, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, WallTime timestamp);
#elif PLATFORM(GTK)
- WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers, double timestamp);
+ WebKeyboardEvent(Type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers, WallTime timestamp);
#elif PLATFORM(IOS)
- WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, WallTime timestamp);
#else
- WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, double timestamp);
+ WebKeyboardEvent(Type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers, WallTime timestamp);
#endif
const String& text() const { return m_text; }
class WebTouchEvent : public WebEvent {
public:
WebTouchEvent() { }
- WebTouchEvent(WebEvent::Type type, Modifiers modifiers, double timestamp, const Vector<WebPlatformTouchPoint>& touchPoints, WebCore::IntPoint position, bool isPotentialTap, bool isGesture, float gestureScale, float gestureRotation)
+ WebTouchEvent(WebEvent::Type type, Modifiers modifiers, WallTime timestamp, const Vector<WebPlatformTouchPoint>& touchPoints, WebCore::IntPoint position, bool isPotentialTap, bool isGesture, float gestureScale, float gestureRotation)
: WebEvent(type, modifiers, timestamp)
, m_touchPoints(touchPoints)
, m_position(position)
class WebTouchEvent : public WebEvent {
public:
WebTouchEvent() { }
- WebTouchEvent(Type, Vector<WebPlatformTouchPoint>&&, Modifiers, double timestamp);
+ WebTouchEvent(Type, Vector<WebPlatformTouchPoint>&&, Modifiers, WallTime timestamp);
const Vector<WebPlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
#if USE(APPKIT)
-WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool handledByInputMethod, const Vector<WebCore::KeypressCommand>& commands, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_text(text)
, m_unmodifiedText(unmodifiedText)
#elif PLATFORM(GTK)
-WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers modifiers, double timestamp)
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, bool handledByInputMethod, Vector<String>&& commands, bool isKeypad, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_text(text)
, m_unmodifiedText(text)
#elif PLATFORM(IOS)
-WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& key, const String& code, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_text(text)
, m_unmodifiedText(unmodifiedText)
#else
-WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, double timestamp)
+WebKeyboardEvent::WebKeyboardEvent(Type type, const String& text, const String& unmodifiedText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtualKeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_text(text)
, m_unmodifiedText(unmodifiedText)
}
#if PLATFORM(MAC)
-WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
#else
-WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp, double force, SyntheticClickType syntheticClickType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
#endif
: WebEvent(type, modifiers, timestamp)
, m_button(button)
namespace WebKit {
-WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint>&& touchPoints, Modifiers modifiers, double timestamp)
+WebTouchEvent::WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint>&& touchPoints, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_touchPoints(WTFMove(touchPoints))
{
namespace WebKit {
-WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Modifiers modifiers, double timestamp)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
}
#if PLATFORM(COCOA)
-WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, bool directionInvertedFromDevice, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, Modifiers modifiers, double timestamp)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, bool directionInvertedFromDevice, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
ASSERT(isWheelEventType(type));
}
#elif PLATFORM(GTK)
-WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Phase phase, Phase momentumPhase, Granularity granularity, Modifiers modifiers, double timestamp)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Phase phase, Phase momentumPhase, Granularity granularity, Modifiers modifiers, WallTime timestamp)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
0 /* deltaZ */,
currentClickCount,
modifiersForEvent(event),
- gdk_event_get_time(event));
+ WallTime::fromRawSeconds(gdk_event_get_time(event)));
}
WebWheelEvent WebEventFactory::createWebWheelEvent(const GdkEvent* event)
momentumPhase,
WebWheelEvent::ScrollByPixelWheelEvent,
modifiersForEvent(event),
- gdk_event_get_time(event));
+ WallTime::fromRawSeconds(gdk_event_get_time(event)));
}
WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(const GdkEvent* event, const WebCore::CompositionResults& compositionResults, Vector<String>&& commands)
WTFMove(commands),
isGdkKeyCodeFromKeyPad(event->key.keyval),
modifiersForEvent(event),
- gdk_event_get_time(event));
+ WallTime::fromRawSeconds(gdk_event_get_time(event)));
}
#if ENABLE(TOUCH_EVENTS)
ASSERT_NOT_REACHED();
}
- return WebTouchEvent(type, WTFMove(touchPoints), modifiersForEvent(event), gdk_event_get_time(event));
+ return WebTouchEvent(type, WTFMove(touchPoints), modifiersForEvent(event), WallTime::fromRawSeconds(gdk_event_get_time(event)));
#else
return WebTouchEvent();
#endif // GTK_API_VERSION_2
: WebTouchEvent(
webEventTypeForUIWebTouchEventType(event->type),
static_cast<Modifiers>(0),
- event->timestamp,
+ WallTime::fromRawSeconds(event->timestamp),
extractWebTouchPoint(event),
positionForCGPoint(event->locationInDocumentCoordinates),
#if defined UI_WEB_TOUCH_EVENT_HAS_IS_POTENTIAL_TAP && UI_WEB_TOUCH_EVENT_HAS_IS_POTENTIAL_TAP
unmodifiedText = text;
}
- return WebKit::WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
+ return WebKit::WebKeyboardEvent(type, text, unmodifiedText, key, code, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, macCharCode, autoRepeat, isKeypad, isSystemKey, modifiers, WallTime::fromRawSeconds(timestamp));
}
#endif // PLATFORM(IOS)
#import "WebEvent.h"
#import "WebGestureEvent.h"
#import <WebCore/IntPoint.h>
-#import <wtf/CurrentTime.h>
+#import <WebCore/PlatformEventFactoryMac.h>
namespace WebKit {
: WebGestureEvent(
webEventTypeForNSEvent(event),
static_cast<Modifiers>(0),
- event.timestamp,
+ WebCore::eventTimeStampSince1970(event),
WebCore::IntPoint(pointForEvent(event, view)),
event.type == NSEventTypeMagnify ? event.magnification : 0,
event.type == NSEventTypeRotate ? event.rotation : 0)
float deltaZ = [event deltaZ];
int clickCount = clickCountForEvent(event);
WebEvent::Modifiers modifiers = modifiersForEvent(event);
- double timestamp = eventTimeStampSince1970(event);
+ auto timestamp = eventTimeStampSince1970(event);
int eventNumber = [event eventNumber];
int menuTypeForEvent = typeForEvent(event);
}
WebEvent::Modifiers modifiers = modifiersForEvent(event);
- double timestamp = eventTimeStampSince1970(event);
+ auto timestamp = eventTimeStampSince1970(event);
return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, directionInvertedFromDevice, phase, momentumPhase, hasPreciseScrollingDeltas, scrollCount, unacceleratedScrollingDelta, modifiers, timestamp);
}
bool isKeypad = isKeypadEvent(event);
bool isSystemKey = false; // SystemKey is always false on the Mac.
WebEvent::Modifiers modifiers = modifiersForEvent(event);
- double timestamp = eventTimeStampSince1970(event);
+ auto timestamp = eventTimeStampSince1970(event);
// Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
if (windowsVirtualKeyCode == VK_RETURN) {
class WebGestureEvent : public WebEvent {
public:
WebGestureEvent() { }
- WebGestureEvent(WebEvent::Type type, Modifiers modifiers, double timestamp, WebCore::IntPoint position, float gestureScale, float gestureRotation)
+ WebGestureEvent(WebEvent::Type type, Modifiers modifiers, WallTime timestamp, WebCore::IntPoint position, float gestureScale, float gestureRotation)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_gestureScale(gestureScale)
singleCharacterString, singleCharacterString, identifierString,
wpe_input_windows_key_code_for_key_event(wpe_input_key_mapper_get_singleton(), event),
event->keyCode, 0, false, false, false,
- modifiersForEvent(event), event->time);
+ modifiersForEvent(event), WallTime::fromRawSeconds(event->time));
}
WebMouseEvent WebEventFactory::createWebMouseEvent(struct wpe_input_pointer_event* event, float deviceScaleFactor)
WebCore::IntPoint position(event->x, event->y);
position.scale(1 / deviceScaleFactor);
return WebMouseEvent(type, button, position, position,
- 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), event->time);
+ 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(0), WallTime::fromRawSeconds(event->time));
}
WebWheelEvent WebEventFactory::createWebWheelEvent(struct wpe_input_axis_event* event, float deviceScaleFactor)
WebCore::IntPoint position(event->x, event->y);
position.scale(1 / deviceScaleFactor);
return WebWheelEvent(WebEvent::Wheel, position, position,
- delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, static_cast<WebEvent::Modifiers>(0), event->time);
+ delta, wheelTicks, WebWheelEvent::ScrollByPixelWheelEvent, static_cast<WebEvent::Modifiers>(0), WallTime::fromRawSeconds(event->time));
}
static WebKit::WebPlatformTouchPoint::TouchPointState stateForTouchPoint(int mainEventId, const struct wpe_input_touch_event_raw* point)
pointCoordinates, pointCoordinates));
}
- return WebTouchEvent(type, WTFMove(touchPoints), WebEvent::Modifiers(0), event->time);
+ return WebTouchEvent(type, WTFMove(touchPoints), WebEvent::Modifiers(0), WallTime::fromRawSeconds(event->time));
}
} // namespace WebKit
void WKBundlePageSimulateMouseDown(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time)
{
- toImpl(page)->simulateMouseDown(button, toIntPoint(position), clickCount, modifiers, time);
+ toImpl(page)->simulateMouseDown(button, toIntPoint(position), clickCount, modifiers, WallTime::fromRawSeconds(time));
}
void WKBundlePageSimulateMouseUp(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time)
{
- toImpl(page)->simulateMouseUp(button, toIntPoint(position), clickCount, modifiers, time);
+ toImpl(page)->simulateMouseUp(button, toIntPoint(position), clickCount, modifiers, WallTime::fromRawSeconds(time));
}
void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint position, double time)
{
- toImpl(page)->simulateMouseMotion(toIntPoint(position), time);
+ toImpl(page)->simulateMouseMotion(toIntPoint(position), WallTime::fromRawSeconds(time));
}
uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef pageRef)
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_EVENT(self), 0);
WebCore::Event* item = WebKit::core(self);
- guint32 result = item->timeStamp();
+ guint32 result = item->timeStamp().approximateWallTime().secondsSinceEpoch().milliseconds();
return result;
}
event.xany.window = 0;
}
-static inline uint64_t xTimeStamp(double timestampInSeconds)
+static inline uint64_t xTimeStamp(WallTime timestamp)
{
- return timestampInSeconds * 1000;
+ return timestamp.secondsSinceEpoch().milliseconds();
}
static inline unsigned xKeyModifiers(const WebEvent& event)
{
FrameView* frameView = webFrame()->coreFrame()->view();
IntPoint contentsPoint = frameView->contentsToRootView(point);
- WebMouseEvent event(WebEvent::MouseDown, WebMouseEvent::RightButton, contentsPoint, contentsPoint, 0, 0, 0, 1, static_cast<WebEvent::Modifiers>(0), monotonicallyIncreasingTime(), WebCore::ForceAtClick);
+ WebMouseEvent event(WebEvent::MouseDown, WebMouseEvent::RightButton, contentsPoint, contentsPoint, 0, 0, 0, 1, static_cast<WebEvent::Modifiers>(0), WallTime::now(), WebCore::ForceAtClick);
return handleContextMenuEvent(event);
}
if (event.metaKey())
modifiers |= WebEvent::MetaKey;
- return std::make_unique<WebMouseEvent>(type, button, m_plugin->convertToRootView(IntPoint(event.offsetX(), event.offsetY())), event.screenLocation(), 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(modifiers), 0, 0);
+ return std::make_unique<WebMouseEvent>(type, button, m_plugin->convertToRootView(IntPoint(event.offsetX(), event.offsetY())), event.screenLocation(), 0, 0, 0, clickCount, static_cast<WebEvent::Modifiers>(modifiers), WallTime { }, 0);
}
void PluginView::handleEvent(Event& event)
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
corePage()->contextMenuController().clearContextMenu();
// Simulate a mouse click to generate the correct menu.
- PlatformMouseEvent mousePressEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
+ PlatformMouseEvent mousePressEvent(point, point, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap);
corePage()->userInputBridge().handleMousePressEvent(mousePressEvent);
bool handled = corePage()->userInputBridge().handleContextMenuEvent(mousePressEvent, corePage()->mainFrame());
auto* menu = handled ? contextMenu() : nullptr;
- PlatformMouseEvent mouseReleaseEvent(point, point, RightButton, PlatformEvent::MouseReleased, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
+ PlatformMouseEvent mouseReleaseEvent(point, point, RightButton, PlatformEvent::MouseReleased, 1, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap);
corePage()->userInputBridge().handleMouseReleaseEvent(mouseReleaseEvent);
return menu;
if (!view)
return;
// FIXME: These are fake modifier keys here, but they should be real ones instead.
- PlatformMouseEvent event(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, WebCore::NoTap);
+ PlatformMouseEvent event(adjustedClientPosition, adjustedGlobalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), 0, WebCore::NoTap);
m_page->mainFrame().eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
send(Messages::WebPageProxy::DidEndDragging());
}
#endif
-void WebPage::simulateMouseDown(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, double time)
+void WebPage::simulateMouseDown(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, WallTime time)
{
mouseEvent(WebMouseEvent(WebMouseEvent::MouseDown, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
}
-void WebPage::simulateMouseUp(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, double time)
+void WebPage::simulateMouseUp(int button, WebCore::IntPoint position, int clickCount, WKEventModifiers modifiers, WallTime time)
{
mouseEvent(WebMouseEvent(WebMouseEvent::MouseUp, static_cast<WebMouseEvent::Button>(button), position, position, 0, 0, 0, clickCount, static_cast<WebMouseEvent::Modifiers>(modifiers), time, WebCore::ForceAtClick, WebMouseEvent::NoTap));
}
-void WebPage::simulateMouseMotion(WebCore::IntPoint position, double time)
+void WebPage::simulateMouseMotion(WebCore::IntPoint position, WallTime time)
{
mouseEvent(WebMouseEvent(WebMouseEvent::MouseMove, WebMouseEvent::NoButton, position, position, 0, 0, 0, 0, WebMouseEvent::Modifiers(), time, 0, WebMouseEvent::NoTap));
}
#include <wtf/RefPtr.h>
#include <wtf/RunLoop.h>
#include <wtf/Seconds.h>
+#include <wtf/WallTime.h>
#include <wtf/text/WTFString.h>
#if HAVE(ACCESSIBILITY) && PLATFORM(GTK)
#endif
// For testing purpose.
- void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
- void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, double time);
- void simulateMouseMotion(WebCore::IntPoint, double time);
+ void simulateMouseDown(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
+ void simulateMouseUp(int button, WebCore::IntPoint, int clickCount, WKEventModifiers, WallTime);
+ void simulateMouseMotion(WebCore::IntPoint, WallTime);
#if ENABLE(CONTEXT_MENUS)
void contextMenuShowing() { m_isShowingContextMenu = true; }
WKBeginObservingContentChanges(true);
- mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap));
+ mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap));
mainframe.document()->updateStyleIfNeeded();
WKStopObservingContentChanges();
bool tapWasHandled = false;
m_lastInteractionLocation = roundedAdjustedPoint;
- tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, syntheticClickType));
+ tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, syntheticClickType));
if (m_isClosed)
return;
- tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, syntheticClickType));
+ tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, syntheticClickType));
if (m_isClosed)
return;
// To augment the platform drag session with additional items, end the current drag session and begin a new drag session with the new drag item.
// This process is opaque to the UI process, which still maintains the old drag item in its drag session. Similarly, this persistent drag session
// is opaque to the web process, which only sees that the current drag has ended, and that a new one is beginning.
- PlatformMouseEvent event(clientPosition, globalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, NoTap);
+ PlatformMouseEvent event(clientPosition, globalPosition, LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), 0, NoTap);
m_page->dragController().dragEnded();
m_page->mainFrame().eventHandler().dragSourceEndedAt(event, DragOperationNone, MayExtendDragSession::Yes);
IntPoint adjustedPoint = roundedIntPoint(position);
Frame& mainframe = m_page->mainFrame();
- mainframe.eventHandler().mouseMoved(PlatformMouseEvent(adjustedPoint, adjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0, 0, WebCore::NoTap));
+ mainframe.eventHandler().mouseMoved(PlatformMouseEvent(adjustedPoint, adjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, { }, 0, WebCore::NoTap));
mainframe.document()->updateStyleIfNeeded();
}
+2017-09-22 Chris Dumez <cdumez@apple.com>
+
+ Use high resolution timestamp for event time
+ https://bugs.webkit.org/show_bug.cgi?id=154246
+ <rdar://problem/34333304>
+
+ Reviewed by Ryosuke Niwa.
+
+ Use WallTime / MonotonicTime instead of double type for clarity.
+
+ * WebView/WebPDFViewPlaceholder.mm:
+ (-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):
+
2017-08-09 Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com>
[PAL] Move spi/cocoa and spi/cg directories into PAL
#import <WebKitLegacy/WebNSViewExtras.h>
#import <WebKitLegacy/WebPDFDocumentExtras.h>
#import <WebKitLegacy/WebViewPrivate.h>
-#import <wtf/CurrentTime.h>
+#import <wtf/MonotonicTime.h>
#import <wtf/SoftLinking.h>
#import <wtf/Vector.h>
return;
// Construct an event to simulate a click.
- RefPtr<Event> event = MouseEvent::create(eventNames().clickEvent, true, true, currentTime(), 0, 1, 0, 0, 0, 0,
+ RefPtr<Event> event = MouseEvent::create(eventNames().clickEvent, true, true, MonotonicTime::now(), 0, 1, 0, 0, 0, 0,
#if ENABLE(POINTER_LOCK)
0, 0,
#endif
+2017-09-22 Chris Dumez <cdumez@apple.com>
+
+ Use high resolution timestamp for event time
+ https://bugs.webkit.org/show_bug.cgi?id=154246
+ <rdar://problem/34333304>
+
+ Reviewed by Ryosuke Niwa.
+
+ 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:]):
+
2017-09-21 Ryosuke Niwa <rniwa@webkit.org>
Enable dataTransfer.items on macOS and iOS
- (DOMTimeStamp)timeStamp
{
WebCore::JSMainThreadNullState state;
- return IMPL->timeStamp();
+ return IMPL->timeStamp().approximateWallTime().secondsSinceEpoch().milliseconds();
}
- (BOOL)defaultPrevented
return;
// FIXME: These are fake modifier keys here, but they should be real ones instead.
PlatformMouseEvent event(IntPoint(windowLoc), IntPoint(globalPoint(windowLoc, [view->platformWidget() window])),
- LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap);
+ LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap);
_private->coreFrame->eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
}
#endif // ENABLE(DRAG_SUPPORT) && PLATFORM(MAC)
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
if (SUCCEEDED(webView->viewWindow(&viewWindow)))
::ScreenToClient(viewWindow, reinterpret_cast<LPPOINT>(&localpt));
return PlatformMouseEvent(IntPoint(localpt.x, localpt.y), IntPoint(pt.x, pt.y),
- isDrag ? LeftButton : NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), 0, NoTap);
+ isDrag ? LeftButton : NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, WallTime::now(), 0, NoTap);
}
STDMETHODIMP WebDropSource::QueryContinueDrag(_In_ BOOL fEscapePressed, _In_ DWORD grfKeyState)