webkit 有关Date类型底层实现
来源:互联网 发布:农行软件开发中心 编辑:程序博客网 时间:2024/06/03 07:15
我们在JavaScript中使用
new Date() 这样来使用
这个date的原型在webkit内部的对应实际上是double
这个在idl文件构造的时候已经进行了映射对应的就是double
return "int" if $type eq "int";
return "int" if $type eq "short" or $type eq "unsigned short";
return "unsigned" if $type eq "unsigned long";
return "int" if $type eq "long";
return "long long" if $type eq "long long";
return "unsigned long long" if $type eq "unsigned long long";
return "bool" if $type eq "boolean";
return "String" if $type eq "DOMString";
return "Range::CompareHow" if $type eq "CompareHow";
return "FloatRect" if $type eq "SVGRect";
return "FloatPoint" if $type eq "SVGPoint";
return "AffineTransform" if $type eq "SVGMatrix";
return "SVGTransform" if $type eq "SVGTransform";
return "SVGLength" if $type eq "SVGLength";
return "SVGAngle" if $type eq "SVGAngle";
return "float" if $type eq "SVGNumber";
return "SVGPreserveAspectRatio" if $type eq "SVGPreserveAspectRatio";
return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType";
return "DOMTimeStamp" if $type eq "DOMTimeStamp";
return "unsigned" if $type eq "unsigned int";
return "Node*" if $type eq "EventTarget" and $isParameter;
return "double" if $type eq "Date";
这个地方已经证明对应的是double
在webkit应用的地方:
HTMLInputElement.idl
attribute Date valueAsDate setter raises(DOMException);
HTMLInputElement.cpp:
double HTMLInputElement::valueAsDate() const
{
switch (inputType()) {
case DATE:
case DATETIME:
case TIME:
case WEEK:
return parseToDouble(value(), DateComponents::invalidMilliseconds());
case MONTH: {
DateComponents date;
if (!formStringToDateComponents(inputType(), value(), &date))
return DateComponents::invalidMilliseconds();
double msec = date.millisecondsSinceEpoch();
ASSERT(isfinite(msec));
return msec;
}
case BUTTON:
case CHECKBOX:
case COLOR:
case DATETIMELOCAL: // valueAsDate doesn't work for the DATETIMELOCAL type according to the standard.
case EMAIL:
case FILE:
case HIDDEN:
case IMAGE:
case ISINDEX:
case NUMBER:
case PASSWORD:
case RADIO:
case RANGE:
case RESET:
case SEARCH:
case SUBMIT:
case TELEPHONE:
case TEXT:
case URL:
return DateComponents::invalidMilliseconds();
}
ASSERT_NOT_REACHED();
return DateComponents::invalidMilliseconds();
}
上面是一个简单的实例就是可以简单的测试应用。
- webkit 有关Date类型底层实现
- 有关date类型
- iBatis Date类型时间丢失有关问题
- js有关input type=date传值类型
- Redis基本类型和底层实现
- 有关webkit-gtk
- SpringMVC返回字符串类型Date实现方法
- 自定义tag标签-实现long类型转换成Date类型
- 自定义tag标签-实现long类型转换成Date类型
- Date类型
- Date类型
- Date类型
- Date类型
- Date类型
- Date类型
- Date类型
- Date类型
- Redis的五种对象类型及其底层实现
- 析构函数virtual与非virtual区别
- 使用QueryPerformanceCounter()记录时间
- 《sed的流艺术之四》-linux命令五分钟系列之二十四
- 关于sql server 代理(已禁用代理xp)
- 取得当前VIew或者UIImage某个点的RGB信息
- webkit 有关Date类型底层实现
- Paydown
- 文件下载
- 想呼吸新鲜空气时,要做的只是打开我的窗户
- Linux Programs(摘自Linux程序设计英文原版)
- 分手后,我依然祝你幸福
- 《tr命令-优化版》-linux命令五分钟系列之二十五
- GXT之旅:第七章:MVC——标准的MVC与GXT MVC
- seq 使用