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 Monday, December 21, 2009 5:19:58 AM UTC
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 Tuesday, December 22, 2009 5:43:01 AM UTC
Created attachment 45365 [details] Proposed patch This patch is similar to patches in Bug#32698 and Bug#32699.
WebKit Review Bot
Comment 2 Tuesday, December 22, 2009 5:43:53 AM UTC
style-queue ran check-webkit-style on attachment 45365 [details] without any errors.
Kent Tamura
Comment 3 Tuesday, December 22, 2009 6:04:21 AM UTC
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 Tuesday, December 22, 2009 8:31:09 AM UTC
Created attachment 45369 [details] Proposed patch (rev.2) - Remove #ifdef !LANGUAGE_COM. COM binding support was removed.
WebKit Review Bot
Comment 5 Tuesday, December 22, 2009 8:31:42 AM UTC
style-queue ran check-webkit-style on attachment 45369 [details] without any errors.
Darin Adler
Comment 6 Tuesday, December 22, 2009 6:33:25 PM UTC
Comment on attachment 45369 [details] Proposed patch (rev.2) The type should be NSAbsoluteTime, not double.
Timothy Hatcher
Comment 7 Tuesday, December 22, 2009 6:35:17 PM UTC
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 Tuesday, December 22, 2009 6:36:18 PM UTC
Comment on attachment 45369 [details] Proposed patch (rev.2) Darin is right, this should be NSAbsoluteTime.
Darin Adler
Comment 9 Tuesday, December 22, 2009 6:37:14 PM UTC
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 Tuesday, December 22, 2009 7:27:18 PM UTC
(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 Tuesday, December 22, 2009 7:40:43 PM UTC
(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 Tuesday, December 22, 2009 7:43:01 PM UTC
(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 Tuesday, December 22, 2009 9:00:14 PM UTC
(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 Thursday, December 24, 2009 7:46:26 AM UTC
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 Thursday, December 24, 2009 7:51:45 AM UTC
style-queue ran check-webkit-style on attachment 45464 [details] without any errors.
Eric Seidel (no email)
Comment 16 Tuesday, January 26, 2010 10:30:33 PM UTC
Comment on attachment 45464 [details] Proposed patch (rev.3) Looks good to me.
Kent Tamura
Comment 17 Wednesday, January 27, 2010 4:17:33 AM UTC
Note You need to log in before you can comment on or make changes to this bug.