RESOLVED FIXED 32810
Date binding support for Objective-C
https://bugs.webkit.org/show_bug.cgi?id=32810
Summary Date binding support for Objective-C
Kent Tamura
Reported 2009-12-20 21:19:58 PST
Like Bug#32698 for JavaScriptCore, we need to support Date type binding for Objective-C DOM binding.
Attachments
Proposed patch (4.65 KB, patch)
2009-12-21 21:43 PST, Kent Tamura
no flags
Proposed patch (rev.2) (4.62 KB, patch)
2009-12-22 00:31 PST, Kent Tamura
timothy: review-
Proposed patch (rev.3) (8.53 KB, patch)
2009-12-23 23:46 PST, Kent Tamura
eric: review+
tkent: commit-queue-
Kent Tamura
Comment 1 2009-12-21 21:43:01 PST
Created attachment 45365 [details] Proposed patch This patch is similar to patches in Bug#32698 and Bug#32699.
WebKit Review Bot
Comment 2 2009-12-21 21:43:53 PST
style-queue ran check-webkit-style on attachment 45365 [details] without any errors.
Kent Tamura
Comment 3 2009-12-21 22:04:21 PST
Generated code will be: - (double)valueAsDate { return IMPL->valueAsDate(); } - (void)setValueAsDate:(double)newValueAsDate { WebCore::ExceptionCode ec = 0; IMPL->setValueAsDate(newValueAsDate, ec); WebCore::raiseOnDOMError(ec); }
Kent Tamura
Comment 4 2009-12-22 00:31:09 PST
Created attachment 45369 [details] Proposed patch (rev.2) - Remove #ifdef !LANGUAGE_COM. COM binding support was removed.
WebKit Review Bot
Comment 5 2009-12-22 00:31:42 PST
style-queue ran check-webkit-style on attachment 45369 [details] without any errors.
Darin Adler
Comment 6 2009-12-22 10:33:25 PST
Comment on attachment 45369 [details] Proposed patch (rev.2) The type should be NSAbsoluteTime, not double.
Timothy Hatcher
Comment 7 2009-12-22 10:35:17 PST
Comment on attachment 45369 [details] Proposed patch (rev.2) WOuld making IsPrimitiveType return true for Date give you more of the code paths you need with out $idlType eq "Date"? Or is IsPrimitiveType used other places we don't want for Date? Could those be specialcased for Date? Seems fine though…
Timothy Hatcher
Comment 8 2009-12-22 10:36:18 PST
Comment on attachment 45369 [details] Proposed patch (rev.2) Darin is right, this should be NSAbsoluteTime.
Darin Adler
Comment 9 2009-12-22 10:37:14 PST
I do think this can be done without adding "Date" in so many different places. Maybe we can claim it's a primitive type.
Kent Tamura
Comment 10 2009-12-22 11:27:18 PST
(In reply to comment #6) > The type should be NSAbsoluteTime, not double. Would you give me information about NSAbsoluteTime please? I couldn't find it in header files and references.
Darin Adler
Comment 11 2009-12-22 11:40:43 PST
(In reply to comment #10) > Would you give me information about NSAbsoluteTime please? > I couldn't find it in header files and references. Oops, sorry. It's NSTimeInterval (from NSDate.h). There should be an NSAbsoluteTime, but there is not!
Darin Adler
Comment 12 2009-12-22 11:43:01 PST
(In reply to comment #11) > Oops, sorry. It's NSTimeInterval (from NSDate.h). There should be an > NSAbsoluteTime, but there is not! But also, dates inside WebKit are in seconds from a base of 1970, whereas in AppKit they have a base of 2001. So we will need to correct by kCFAbsoluteTimeIntervalSince1970 as we do in CurrentTime.cpp.
Timothy Hatcher
Comment 13 2009-12-22 13:00:14 PST
(In reply to comment #11) > (In reply to comment #10) > > Would you give me information about NSAbsoluteTime please? > > I couldn't find it in header files and references. > > Oops, sorry. It's NSTimeInterval (from NSDate.h). There should be an > NSAbsoluteTime, but there is not! There is CFAbsoluteTime, documented with an epoch of 2001. But I think NSTimeInterval is better to use since we are not a CF API.
Kent Tamura
Comment 14 2009-12-23 23:46:26 PST
Created attachment 45464 [details] Proposed patch (rev.3) - Map Date to NSTimeInterval - Introduce functions to convert double from/to NSTimeInterval. - Make Date a primitive type
WebKit Review Bot
Comment 15 2009-12-23 23:51:45 PST
style-queue ran check-webkit-style on attachment 45464 [details] without any errors.
Eric Seidel (no email)
Comment 16 2010-01-26 14:30:33 PST
Comment on attachment 45464 [details] Proposed patch (rev.3) Looks good to me.
Kent Tamura
Comment 17 2010-01-26 20:17:33 PST
Note You need to log in before you can comment on or make changes to this bug.