Commit f463566e authored by paroga@webkit.org's avatar paroga@webkit.org

Move JSC::parseDate() from DateConversion to JSDateMath

https://bugs.webkit.org/show_bug.cgi?id=91982

Reviewed by Geoffrey Garen.

Moveing this function into the other files removes the dependency
on JSC spcific classes in DateConversion.{cpp|h}.

* runtime/DateConversion.cpp:
* runtime/DateConversion.h:
(JSC):
* runtime/JSDateMath.cpp:
(JSC::parseDate):
(JSC):
* runtime/JSDateMath.h:
(JSC):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1ee21910
2012-07-23 Patrick Gansterer <paroga@webkit.org>
Move JSC::parseDate() from DateConversion to JSDateMath
https://bugs.webkit.org/show_bug.cgi?id=91982
Reviewed by Geoffrey Garen.
Moveing this function into the other files removes the dependency
on JSC spcific classes in DateConversion.{cpp|h}.
* runtime/DateConversion.cpp:
* runtime/DateConversion.h:
(JSC):
* runtime/JSDateMath.cpp:
(JSC::parseDate):
(JSC):
* runtime/JSDateMath.h:
(JSC):
2012-07-23 Simon Fraser <simon.fraser@apple.com>
Part 1 of: Implement sticky positioning
......
......@@ -55,18 +55,6 @@ using namespace WTF;
namespace JSC {
double parseDate(ExecState* exec, const UString &date)
{
if (date == exec->globalData().cachedDateString)
return exec->globalData().cachedDateStringValue;
double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
if (isnan(value))
value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
exec->globalData().cachedDateString = date;
exec->globalData().cachedDateStringValue = value;
return value;
}
void formatDate(const GregorianDateTime &t, DateConversionBuffer& buffer)
{
snprintf(buffer, DateConversionBufferSize, "%s %s %02d %04d",
......
......@@ -42,8 +42,6 @@
#ifndef DateConversion_h
#define DateConversion_h
#include "UString.h"
namespace JSC {
class ExecState;
......@@ -52,7 +50,6 @@ struct GregorianDateTime;
static const unsigned DateConversionBufferSize = 100;
typedef char DateConversionBuffer[DateConversionBufferSize];
double parseDate(ExecState* exec, const UString&);
void formatDate(const GregorianDateTime&, DateConversionBuffer&);
void formatDateUTCVariant(const GregorianDateTime&, DateConversionBuffer&);
void formatTime(const GregorianDateTime&, DateConversionBuffer&);
......
......@@ -259,4 +259,16 @@ double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateSt
return ms - (offset * WTF::msPerMinute);
}
double parseDate(ExecState* exec, const UString& date)
{
if (date == exec->globalData().cachedDateString)
return exec->globalData().cachedDateStringValue;
double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
if (isnan(value))
value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
exec->globalData().cachedDateString = date;
exec->globalData().cachedDateStringValue = value;
return value;
}
} // namespace JSC
......@@ -48,12 +48,14 @@
namespace JSC {
class ExecState;
class UString;
struct GregorianDateTime;
void msToGregorianDateTime(ExecState*, double, bool outputIsUTC, GregorianDateTime&);
double gregorianDateTimeToMS(ExecState*, const GregorianDateTime&, double, bool inputIsUTC);
double getUTCOffset(ExecState*);
double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString);
double parseDate(ExecState*, const UString&);
// Intentionally overridding the default tm of the system.
// The members of tm differ on various operating systems.
......
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