RESOLVED FIXED 32699
[V8] Date binding support
https://bugs.webkit.org/show_bug.cgi?id=32699
Summary [V8] Date binding support
Kent Tamura
Reported 2009-12-17 22:18:00 PST
HTML5's HTMLInputElement IDL has > attribute Date valueAsDate; We need to support binding for Date.
Attachments
Proposed patch (3.78 KB, patch)
2009-12-18 01:38 PST, Kent Tamura
tkent: review-
Proposed patch (5.49 KB, patch)
2009-12-19 21:17 PST, Kent Tamura
abarth: review+
abarth: commit-queue-
Kent Tamura
Comment 1 2009-12-18 01:38:28 PST
Created attachment 45131 [details] Proposed patch Generated code for "Date valueAsDate setter raises(DOMException)" will be like: static v8::Handle<v8::Value> valueAsDateAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.HTMLInputElement.valueAsDate._get"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = v8DOMWrapperToNode<HTMLInputElement>(info); double v = imp->valueAsDate(); if (isnan(v) || isinf(v)) return v8::Null(); else return v8::Date::New(v); } static void valueAsDateAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.HTMLInputElement.valueAsDate._set"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = v8DOMWrapperToNode<HTMLInputElement>(info); double v = value->IsDate() ? value->NumberValue() : std::numeric_limits<double>::quiet_NaN(); ExceptionCode ec = 0; imp->setValueAsDate(v, ec); if (UNLIKELY(ec)) V8Proxy::setDOMException(ec); return; }
Kent Tamura
Comment 2 2009-12-19 21:17:57 PST
Created attachment 45256 [details] Proposed patch Note: This depends on a patch in Bug#32698, and EWS will report a failure.
Kent Tamura
Comment 3 2009-12-19 21:19:29 PST
(In reply to comment #2) Generated code for "Date valueAsDate setter raises(DOMException)" will be like: static v8::Handle<v8::Value> valueAsDateAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.HTMLInputElement.valueAsDate._get"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = v8DOMWrapperToNode<HTMLInputElement>(info); return v8DateOrNull(imp->valueAsDate());; } static void valueAsDateAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { INC_STATS("DOM.HTMLInputElement.valueAsDate._set"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = v8DOMWrapperToNode<HTMLInputElement>(info); double v = toWebCoreDate(value); ExceptionCode ec = 0; imp->setValueAsDate(v, ec); if (UNLIKELY(ec)) V8Proxy::setDOMException(ec); return; }
Adam Barth
Comment 4 2009-12-21 12:56:36 PST
Comment on attachment 45256 [details] Proposed patch This looks fine. Please update the FIXME to match the patch: "FIXME: Add Date support for V8, Objective-C, and COM."
Peter Kasting
Comment 5 2009-12-21 13:27:29 PST
Landed in r52454.
Note You need to log in before you can comment on or make changes to this bug.