Changeset 52454 in webkit
- Timestamp:
- Dec 21, 2009 1:26:43 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52451 r52454 1 2009-12-19 Kent Tamura <tkent@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Add support for V8 Date binding. 6 https://bugs.webkit.org/show_bug.cgi?id=32699 7 8 This implements the same behavior as the recent change of 9 CodeGeneratorJS.pm and JSDOMBinding.cpp. 10 11 * bindings/scripts/CodeGeneratorV8.pm: 12 Produce toWebCoreDate() or v8DateOrNull() for Date type. 13 * bindings/v8/V8Binding.cpp: 14 (WebCore::toWebCoreDate): 15 Converts a JavaScript object to a double representing Date. 16 (WebCore::v8DateOrNull): 17 Converts a double representing Date to a JavaScript Date object or null. 18 * bindings/v8/V8Binding.h: Declare toWebCoreDate() and v8DateOrNull(). 19 * html/HTMLInputElement.idl: Delete V8_BINGIN exclusion for valueAsDate. 20 1 21 2009-12-21 Darin Adler <darin@apple.com> 2 22 -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r52373 r52454 157 157 # When we're finished with the one-file-per-class 158 158 # reorganization, we won't need these special cases. 159 if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type) ) {159 if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type) or $type eq "Date") { 160 160 } elsif ($type =~ /SVGPathSeg/) { 161 161 $joinedName = $type; … … 1973 1973 return "unsigned" if $type eq "unsigned int"; 1974 1974 return "Node*" if $type eq "EventTarget" and $isParameter; 1975 return "double" if $type eq "Date"; 1975 1976 1976 1977 return "String" if $type eq "DOMUserData"; # FIXME: Temporary hack? … … 2107 2108 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow"; 2108 2109 return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType"; 2110 return "toWebCoreDate($value)" if $type eq "Date"; 2109 2111 2110 2112 if ($type eq "DOMString" or $type eq "DOMUserData") { … … 2369 2371 } 2370 2372 2373 if ($type eq "Date") { 2374 return "return v8DateOrNull($value);"; 2375 } 2376 2371 2377 else { 2372 2378 $implIncludes{"wtf/RefCounted.h"} = 1; -
trunk/WebCore/bindings/v8/V8Binding.cpp
r51707 r52454 240 240 } 241 241 242 double toWebCoreDate(v8::Handle<v8::Value> object) 243 { 244 return (object->IsDate() || object->IsNumber()) ? object->NumberValue() : std::numeric_limits<double>::quiet_NaN(); 245 } 246 247 v8::Handle<v8::Value> v8DateOrNull(double value) 248 { 249 if (isfinite(value)) 250 return v8::Date::New(value); 251 return v8::Null(); 252 } 242 253 243 254 template <class S> struct StringTraits -
trunk/WebCore/bindings/v8/V8Binding.h
r52080 r52454 206 206 207 207 v8::Handle<v8::Value> v8StringOrFalse(const String& str); 208 209 double toWebCoreDate(v8::Handle<v8::Value> object); 210 211 v8::Handle<v8::Value> v8DateOrNull(double value); 208 212 209 213 v8::Persistent<v8::FunctionTemplate> createRawTemplate(); -
trunk/WebCore/html/HTMLInputElement.idl
r52434 r52454 68 68 attribute [ConvertNullToNullString] DOMString useMap; 69 69 attribute [ConvertNullToNullString] DOMString value; 70 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT && !(defined(V8_BINDING) && V8_BINDING)71 // FIXME: Add Date support for V8, Objective-C,and COM.70 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT 71 // FIXME: Add Date support for Objective-C and COM. 72 72 attribute Date valueAsDate setter raises(DOMException); 73 73 #endif
Note: See TracChangeset
for help on using the changeset viewer.