2010-11-08 John Knottenbelt <jknotten@chromium.org>

        Reviewed by Steve Block.

        Convert to and from DOMTimeStamp with converter functions.
        This is a refactoring only, covered by existing layout tests.
        https://bugs.webkit.org/show_bug.cgi?id=49066

        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * dom/DOMTimeStamp.h: Added.
        (WebCore::convertSecondsToDOMTimeStamp):
        (WebCore::convertDOMTimeStampToSeconds):
        * dom/Event.cpp:
        (WebCore::Event::Event):
        * dom/Event.h:
        * page/Geolocation.cpp:
        (WebCore::Geolocation::haveSuitableCachedPosition):
        * platform/android/GeolocationServiceAndroid.cpp:
        (WebCore::GeolocationServiceAndroid::isPositionMoreTimely):
2010-11-08  John Knottenbelt  <jknotten@chromium.org>

        Reviewed by Steve Block.

        Convert to and from DOMTimeStamp with converter functions
        https://bugs.webkit.org/show_bug.cgi?id=49066

        * src/WebDataSourceImpl.cpp:
        (WebKit::WebDataSourceImpl::triggeringEventTime):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 454339dd
2010-11-08 John Knottenbelt <jknotten@chromium.org>
Reviewed by Steve Block.
Convert to and from DOMTimeStamp with converter functions.
This is a refactoring only, covered by existing layout tests.
https://bugs.webkit.org/show_bug.cgi?id=49066
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMTimeStamp.h: Added.
(WebCore::convertSecondsToDOMTimeStamp):
(WebCore::convertDOMTimeStampToSeconds):
* dom/Event.cpp:
(WebCore::Event::Event):
* dom/Event.h:
* page/Geolocation.cpp:
(WebCore::Geolocation::haveSuitableCachedPosition):
* platform/android/GeolocationServiceAndroid.cpp:
(WebCore::GeolocationServiceAndroid::isPositionMoreTimely):
2010-11-08 Ryosuke Niwa <rniwa@webkit.org>
Unreviewed build fix for Chromium Mac for r71590.
......@@ -1121,6 +1121,7 @@ webcore_sources += \
WebCore/dom/DOMStringList.h \
WebCore/dom/DOMStringMap.cpp \
WebCore/dom/DOMStringMap.h \
WebCore/dom/DOMTimeStamp.h \
WebCore/dom/DynamicNodeList.cpp \
WebCore/dom/DynamicNodeList.h \
WebCore/dom/EditingText.cpp \
......
......@@ -1157,6 +1157,7 @@
'dom/DOMStringList.h',
'dom/DOMStringMap.cpp',
'dom/DOMStringMap.h',
'dom/DOMTimeStamp.h',
'dom/DatasetDOMStringMap.cpp',
'dom/DatasetDOMStringMap.h',
'dom/DecodedDataDocumentParser.cpp',
......
......@@ -1622,6 +1622,7 @@ HEADERS += \
dom/DOMImplementation.h \
dom/DOMStringList.h \
dom/DOMStringMap.h \
dom/DOMTimeStamp.h \
dom/DatasetDOMStringMap.h \
dom/DynamicNodeList.h \
dom/EditingText.h \
......
......@@ -41932,6 +41932,10 @@
>
</File>
<File
RelativePath="..\dom\DOMTimeStamp.h"
>
</File>
<File
RelativePath="..\dom\DynamicNodeList.cpp"
>
<FileConfiguration
......@@ -36,6 +36,7 @@
0014628A103CD1DE000B20DB /* OriginAccessEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */; };
0014628B103CD1DE000B20DB /* OriginAccessEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 00146289103CD1DE000B20DB /* OriginAccessEntry.h */; };
003F1FEA11E6AB43008258D9 /* UserContentTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 003F1FE911E6AB43008258D9 /* UserContentTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
06027CAD0B1CBFC000884B2D /* ContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */; };
062287840B4DB322000C34DF /* FocusDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 062287830B4DB322000C34DF /* FocusDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -6079,6 +6080,7 @@
00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OriginAccessEntry.cpp; sourceTree = "<group>"; };
00146289103CD1DE000B20DB /* OriginAccessEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OriginAccessEntry.h; sourceTree = "<group>"; };
003F1FE911E6AB43008258D9 /* UserContentTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserContentTypes.h; sourceTree = "<group>"; };
05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTimeStamp.h; sourceTree = "<group>"; };
06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenuItem.h; sourceTree = "<group>"; };
06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuItemMac.mm; sourceTree = "<group>"; };
062287830B4DB322000C34DF /* FocusDirection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FocusDirection.h; sourceTree = "<group>"; };
......@@ -18221,6 +18223,7 @@
BC64640711D7F304006455B0 /* DOMStringMap.cpp */,
BC64640811D7F304006455B0 /* DOMStringMap.h */,
BC64647911D800CD006455B0 /* DOMStringMap.idl */,
05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */,
BC7FA61E0D1F0CBD00DB22A9 /* DynamicNodeList.cpp */,
BC7FA61F0D1F0CBD00DB22A9 /* DynamicNodeList.h */,
6550B699099DF0270090D781 /* EditingText.cpp */,
......@@ -19500,6 +19503,7 @@
DDE63ED50B7D45A800226998 /* DOMTextEvent.h in Headers */,
85E711D90AC5D5350053270F /* DOMTextInternal.h in Headers */,
188604B40F2E654A000B6443 /* DOMTimer.h in Headers */,
05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */,
76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */,
BC1A37BE097C715F0019F3D8 /* DOMTraversal.h in Headers */,
85526CD20AB0B7D9000302EA /* DOMTreeWalker.h in Headers */,
/*
* Copyright (C) 2010 Google 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
* OWNER OR 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.
*/
#ifndef DOMTimeStamp_h
#define DOMTimeStamp_h
namespace WebCore {
typedef unsigned long long DOMTimeStamp;
inline DOMTimeStamp convertSecondsToDOMTimeStamp(double seconds)
{
return static_cast<DOMTimeStamp>(seconds * 1000.0);
}
inline double convertDOMTimeStampToSeconds(DOMTimeStamp milliseconds)
{
return milliseconds / 1000.0;
}
} // namespace WebCore
#endif // DOMTimeStamp_h
......@@ -39,7 +39,7 @@ Event::Event()
, m_cancelBubble(false)
, m_eventPhase(0)
, m_currentTarget(0)
, m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0))
, m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
{
}
......@@ -54,7 +54,7 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr
, m_cancelBubble(false)
, m_eventPhase(0)
, m_currentTarget(0)
, m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0))
, m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
{
}
......
......@@ -24,6 +24,7 @@
#ifndef Event_h
#define Event_h
#include "DOMTimeStamp.h"
#include "EventTarget.h"
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
......@@ -32,9 +33,6 @@ namespace WebCore {
class Clipboard;
// FIXME: this should probably defined elsewhere.
typedef unsigned long long DOMTimeStamp;
class Event : public RefCounted<Event> {
public:
enum PhaseType {
......
......@@ -390,7 +390,7 @@ bool Geolocation::haveSuitableCachedPosition(PositionOptions* options)
return true;
if (!options->maximumAge())
return false;
DOMTimeStamp currentTimeMillis = currentTime() * 1000.0;
DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(currentTime());
return m_positionCache->cachedPosition()->timestamp() > currentTimeMillis - options->maximumAge();
}
......
......@@ -171,9 +171,9 @@ bool GeolocationServiceAndroid::isPositionMoreAccurate(Geoposition* position1, G
bool GeolocationServiceAndroid::isPositionMoreTimely(Geoposition* position1, Geoposition* position2)
{
ASSERT(position1 && position2);
DOMTimeStamp currentTimeMillis = WTF::currentTime() * 1000.0;
DOMTimeStamp maximumAgeMillis = 10 * 60 * 1000; // 10 minutes
return currentTimeMillis - position1->timestamp() > maximumAgeMillis;
DOMTimeStamp currentTime = convertSecondsToDOMTimeStamp(WTF::currentTime());
DOMTimeStamp maximumAge = convertSecondsToDOMTimeStamp(10 * 60); // 10 minutes
return currentTime - position1->timestamp() > maximumAge;
}
} // namespace WebCore
2010-11-08 John Knottenbelt <jknotten@chromium.org>
Reviewed by Steve Block.
Convert to and from DOMTimeStamp with converter functions
https://bugs.webkit.org/show_bug.cgi?id=49066
* src/WebDataSourceImpl.cpp:
(WebKit::WebDataSourceImpl::triggeringEventTime):
2010-11-08 Pierre-Antoine LaFayette <pierre.lafayette@gmail.com>
Reviewed by Darin Fisher.
......
......@@ -96,7 +96,7 @@ double WebDataSourceImpl::triggeringEventTime() const
return 0.0;
// DOMTimeStamp uses units of milliseconds.
return triggeringAction().event()->timeStamp() / 1000.0;
return convertDOMTimeStampToSeconds(triggeringAction().event()->timeStamp());
}
WebDataSource::ExtraData* WebDataSourceImpl::extraData() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment