Bug 1256562 part.1 Implement nsCocoaUtils::GetEventTimeStamp() to convert from timeStamp of NSEvent to TimeStamp r=birtles,mstange
This patch implements nsCocoaUtils::GetEventTimeStamp() which hides how to get TimeStamp from timeStamp of NSEvent from other developers. Different from Windows and GTK, we don't need to use SystemTimeConverter and implement CurrentTimeGetter class because the internal value of the macOS implementation of TimeStamp is based on mach_absolute_time(), which measures "ticks" since boot. Event timestamps are NSTimeIntervals (seconds) since boot. So the two time representations already have the same base; we only need to convert seconds into ticks. MozReview-Commit-ID: LvioyJOM7S9
This commit is contained in:
@@ -34,6 +34,7 @@ enum {
|
||||
class nsIWidget;
|
||||
|
||||
namespace mozilla {
|
||||
class TimeStamp;
|
||||
namespace gfx {
|
||||
class SourceSurface;
|
||||
} // namespace gfx
|
||||
@@ -377,6 +378,12 @@ public:
|
||||
const nsTArray<mozilla::FontRange>& aFontRanges,
|
||||
const bool aIsVertical,
|
||||
const CGFloat aBackingScaleFactor);
|
||||
|
||||
/**
|
||||
* Compute TimeStamp from an event's timestamp.
|
||||
* If aEventTime is 0, this returns current timestamp.
|
||||
*/
|
||||
static mozilla::TimeStamp GetEventTimeStamp(NSTimeInterval aEventTime);
|
||||
};
|
||||
|
||||
#endif // nsCocoaUtils_h_
|
||||
|
||||
Reference in New Issue
Block a user