Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 17574008: Fixing DateTime values in dart2js serialized script values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/html/html_common/conversions.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// The Dart HTML library. 1 /// The Dart HTML library.
2 library dart.dom.html; 2 library dart.dom.html;
3 3
4 import 'dart:async'; 4 import 'dart:async';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:_collection-dev' hide Symbol; 6 import 'dart:_collection-dev' hide Symbol;
7 import 'dart:html_common'; 7 import 'dart:html_common';
8 import 'dart:indexed_db'; 8 import 'dart:indexed_db';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:json' as json; 10 import 'dart:json' as json;
(...skipping 10207 matching lines...) Expand 10 before | Expand all | Expand 10 after
10218 } 10218 }
10219 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10219 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
10220 // for details. All rights reserved. Use of this source code is governed by a 10220 // for details. All rights reserved. Use of this source code is governed by a
10221 // BSD-style license that can be found in the LICENSE file. 10221 // BSD-style license that can be found in the LICENSE file.
10222 10222
10223 10223
10224 @DocsEditable 10224 @DocsEditable
10225 @DomName('File') 10225 @DomName('File')
10226 class File extends Blob native "File" { 10226 class File extends Blob native "File" {
10227 10227
10228 DateTime get lastModifiedDate => _convertNativeToDart_DateTime(this._get_lastM odifiedDate); 10228 DateTime get lastModifiedDate => convertNativeToDart_DateTime(this._get_lastMo difiedDate);
10229 @JSName('lastModifiedDate') 10229 @JSName('lastModifiedDate')
10230 @DomName('File.lastModifiedDate') 10230 @DomName('File.lastModifiedDate')
10231 @DocsEditable 10231 @DocsEditable
10232 @Creates('Null') 10232 @Creates('Null')
10233 final dynamic _get_lastModifiedDate; 10233 final dynamic _get_lastModifiedDate;
10234 10234
10235 @DomName('File.name') 10235 @DomName('File.name')
10236 @DocsEditable 10236 @DocsEditable
10237 final String name; 10237 final String name;
10238 10238
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
12741 final String validationMessage; 12741 final String validationMessage;
12742 12742
12743 @DomName('HTMLInputElement.validity') 12743 @DomName('HTMLInputElement.validity')
12744 @DocsEditable 12744 @DocsEditable
12745 final ValidityState validity; 12745 final ValidityState validity;
12746 12746
12747 @DomName('HTMLInputElement.value') 12747 @DomName('HTMLInputElement.value')
12748 @DocsEditable 12748 @DocsEditable
12749 String value; 12749 String value;
12750 12750
12751 DateTime get valueAsDate => _convertNativeToDart_DateTime(this._get_valueAsDat e); 12751 DateTime get valueAsDate => convertNativeToDart_DateTime(this._get_valueAsDate );
12752 @JSName('valueAsDate') 12752 @JSName('valueAsDate')
12753 @DomName('HTMLInputElement.valueAsDate') 12753 @DomName('HTMLInputElement.valueAsDate')
12754 @DocsEditable 12754 @DocsEditable
12755 @Creates('Null') 12755 @Creates('Null')
12756 final dynamic _get_valueAsDate; 12756 final dynamic _get_valueAsDate;
12757 12757
12758 void set valueAsDate(DateTime value) { 12758 void set valueAsDate(DateTime value) {
12759 this._set_valueAsDate = _convertDartToNative_DateTime(value); 12759 this._set_valueAsDate = convertDartToNative_DateTime(value);
12760 } 12760 }
12761 void set _set_valueAsDate(/*dynamic*/ value) { 12761 void set _set_valueAsDate(/*dynamic*/ value) {
12762 JS("void", "#.valueAsDate = #", this, value); 12762 JS("void", "#.valueAsDate = #", this, value);
12763 } 12763 }
12764 12764
12765 @DomName('HTMLInputElement.valueAsNumber') 12765 @DomName('HTMLInputElement.valueAsNumber')
12766 @DocsEditable 12766 @DocsEditable
12767 num valueAsNumber; 12767 num valueAsNumber;
12768 12768
12769 @JSName('webkitEntries') 12769 @JSName('webkitEntries')
(...skipping 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after
15236 // for details. All rights reserved. Use of this source code is governed by a 15236 // for details. All rights reserved. Use of this source code is governed by a
15237 // BSD-style license that can be found in the LICENSE file. 15237 // BSD-style license that can be found in the LICENSE file.
15238 15238
15239 15239
15240 @DocsEditable 15240 @DocsEditable
15241 @DomName('Metadata') 15241 @DomName('Metadata')
15242 // http://www.w3.org/TR/file-system-api/#the-metadata-interface 15242 // http://www.w3.org/TR/file-system-api/#the-metadata-interface
15243 @Experimental 15243 @Experimental
15244 class Metadata native "Metadata" { 15244 class Metadata native "Metadata" {
15245 15245
15246 DateTime get modificationTime => _convertNativeToDart_DateTime(this._get_modif icationTime); 15246 DateTime get modificationTime => convertNativeToDart_DateTime(this._get_modifi cationTime);
15247 @JSName('modificationTime') 15247 @JSName('modificationTime')
15248 @DomName('Metadata.modificationTime') 15248 @DomName('Metadata.modificationTime')
15249 @DocsEditable 15249 @DocsEditable
15250 @Creates('Null') 15250 @Creates('Null')
15251 final dynamic _get_modificationTime; 15251 final dynamic _get_modificationTime;
15252 15252
15253 @DomName('Metadata.size') 15253 @DomName('Metadata.size')
15254 @DocsEditable 15254 @DocsEditable
15255 final int size; 15255 final int size;
15256 } 15256 }
(...skipping 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after
19034 final String id; 19034 final String id;
19035 19035
19036 @DomName('RTCStatsReport.local') 19036 @DomName('RTCStatsReport.local')
19037 @DocsEditable 19037 @DocsEditable
19038 final RtcStatsReport local; 19038 final RtcStatsReport local;
19039 19039
19040 @DomName('RTCStatsReport.remote') 19040 @DomName('RTCStatsReport.remote')
19041 @DocsEditable 19041 @DocsEditable
19042 final RtcStatsReport remote; 19042 final RtcStatsReport remote;
19043 19043
19044 DateTime get timestamp => _convertNativeToDart_DateTime(this._get_timestamp); 19044 DateTime get timestamp => convertNativeToDart_DateTime(this._get_timestamp);
19045 @JSName('timestamp') 19045 @JSName('timestamp')
19046 @DomName('RTCStatsReport.timestamp') 19046 @DomName('RTCStatsReport.timestamp')
19047 @DocsEditable 19047 @DocsEditable
19048 @Creates('Null') 19048 @Creates('Null')
19049 final dynamic _get_timestamp; 19049 final dynamic _get_timestamp;
19050 19050
19051 @DomName('RTCStatsReport.type') 19051 @DomName('RTCStatsReport.type')
19052 @DocsEditable 19052 @DocsEditable
19053 final String type; 19053 final String type;
19054 19054
(...skipping 10133 matching lines...) Expand 10 before | Expand all | Expand 10 after
29188 // BSD-style license that can be found in the LICENSE file. 29188 // BSD-style license that can be found in the LICENSE file.
29189 29189
29190 29190
29191 // Conversions for Window. These check if the window is the local 29191 // Conversions for Window. These check if the window is the local
29192 // window, and if it's not, wraps or unwraps it with a secure wrapper. 29192 // window, and if it's not, wraps or unwraps it with a secure wrapper.
29193 // We need to test for EventTarget here as well as it's a base type. 29193 // We need to test for EventTarget here as well as it's a base type.
29194 // We omit an unwrapper for Window as no methods take a non-local 29194 // We omit an unwrapper for Window as no methods take a non-local
29195 // window as a parameter. 29195 // window as a parameter.
29196 29196
29197 29197
29198 DateTime _convertNativeToDart_DateTime(date) {
29199 var millisSinceEpoch = JS('int', '#.getTime()', date);
29200 return new DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, isUtc: true);
29201 }
29202
29203 _convertDartToNative_DateTime(DateTime date) {
29204 return JS('', 'new Date(#)', date.millisecondsSinceEpoch);
29205 }
29206
29207 WindowBase _convertNativeToDart_Window(win) { 29198 WindowBase _convertNativeToDart_Window(win) {
29208 if (win == null) return null; 29199 if (win == null) return null;
29209 return _DOMWindowCrossFrame._createSafe(win); 29200 return _DOMWindowCrossFrame._createSafe(win);
29210 } 29201 }
29211 29202
29212 EventTarget _convertNativeToDart_EventTarget(e) { 29203 EventTarget _convertNativeToDart_EventTarget(e) {
29213 if (e == null) { 29204 if (e == null) {
29214 return null; 29205 return null;
29215 } 29206 }
29216 // Assume it's a Window if it contains the setInterval property. It may be 29207 // Assume it's a Window if it contains the setInterval property. It may be
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
29597 _position = nextPosition; 29588 _position = nextPosition;
29598 return true; 29589 return true;
29599 } 29590 }
29600 _current = null; 29591 _current = null;
29601 _position = _array.length; 29592 _position = _array.length;
29602 return false; 29593 return false;
29603 } 29594 }
29604 29595
29605 T get current => _current; 29596 T get current => _current;
29606 } 29597 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/html_common/conversions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698