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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 12316139: Converting dart:html to use DateTime rather than Date. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 6440d5a336fceb85ea59944668ff7666c2232fcf..a57db6f3dfd8e21d5b40cdc931a0a02e2dccbd35 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -6337,7 +6337,7 @@ class Document extends Node native "*Document"
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _window;
+ dynamic get _window => JS("", "#.defaultView", this);
@DomName('Document.documentElement')
@DocsEditable
@@ -10070,7 +10070,7 @@ class Event native "*Event" {
@DocsEditable
@Creates('Null')
@Returns('EventTarget|=Object')
- final dynamic _currentTarget;
+ dynamic get _currentTarget => JS("", "#.currentTarget", this);
@DomName('Event.defaultPrevented')
@DocsEditable
@@ -10090,7 +10090,7 @@ class Event native "*Event" {
@DocsEditable
@Creates('Node')
@Returns('EventTarget|=Object')
- final dynamic _target;
+ dynamic get _target => JS("", "#.target", this);
@DomName('Event.timeStamp')
@DocsEditable
@@ -10397,9 +10397,11 @@ class FieldSetElement extends Element native "*HTMLFieldSetElement" {
@DomName('File')
class File extends Blob native "*File" {
+ DateTime get lastModifiedDate => _convertNativeToDart_DateTime(this._lastModifiedDate);
+ @JSName('lastModifiedDate')
@DomName('File.lastModifiedDate')
@DocsEditable
- final Date lastModifiedDate;
+ dynamic get _lastModifiedDate => JS("", "#.lastModifiedDate", this);
@DomName('File.name')
@DocsEditable
@@ -11529,7 +11531,7 @@ class FocusEvent extends UIEvent native "*FocusEvent" {
@JSName('relatedTarget')
@DomName('FocusEvent.relatedTarget')
@DocsEditable
- final dynamic _relatedTarget;
+ dynamic get _relatedTarget => JS("", "#.relatedTarget", this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -11919,7 +11921,7 @@ class History implements HistoryBase native "*History" {
@DocsEditable
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _state;
+ dynamic get _state => JS("", "#.state", this);
@DomName('History.back')
@DocsEditable
@@ -13156,7 +13158,7 @@ class IFrameElement extends Element native "*HTMLIFrameElement" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _contentWindow;
+ dynamic get _contentWindow => JS("", "#.contentWindow", this);
@DomName('HTMLIFrameElement.height')
@DocsEditable
@@ -13495,9 +13497,18 @@ class InputElement extends Element implements
@DocsEditable
String value;
+ DateTime get valueAsDate => _convertNativeToDart_DateTime(this._valueAsDate);
+ @JSName('valueAsDate')
@DomName('HTMLInputElement.valueAsDate')
@DocsEditable
- Date valueAsDate;
+ dynamic get _valueAsDate => JS("", "#.valueAsDate", this);
+
+ void set valueAsDate(DateTime value) {
+ this._valueAsDate = _convertDartToNative_DateTime(value);
+ }
+ void set _valueAsDate(/*dynamic*/ value) {
+ JS("void", "#.valueAsDate = #", this, value);
+ }
@DomName('HTMLInputElement.valueAsNumber')
@DocsEditable
@@ -16251,7 +16262,7 @@ class MessageEvent extends Event native "*MessageEvent" {
@DocsEditable
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _data;
+ dynamic get _data => JS("", "#.data", this);
@DomName('MessageEvent.lastEventId')
@DocsEditable
@@ -16272,7 +16283,7 @@ class MessageEvent extends Event native "*MessageEvent" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _source;
+ dynamic get _source => JS("", "#.source", this);
@JSName('initMessageEvent')
@DomName('MessageEvent.initMessageEvent')
@@ -16370,9 +16381,11 @@ class MetaElement extends Element native "*HTMLMetaElement" {
@DomName('Metadata')
class Metadata native "*Metadata" {
+ DateTime get modificationTime => _convertNativeToDart_DateTime(this._modificationTime);
+ @JSName('modificationTime')
@DomName('Metadata.modificationTime')
@DocsEditable
- final Date modificationTime;
+ dynamic get _modificationTime => JS("", "#.modificationTime", this);
@DomName('Metadata.size')
@DocsEditable
@@ -16513,7 +16526,7 @@ class MouseEvent extends UIEvent native "*MouseEvent" {
@DocsEditable
@Creates('Node')
@Returns('EventTarget|=Object')
- final dynamic _relatedTarget;
+ dynamic get _relatedTarget => JS("", "#.relatedTarget", this);
@DomName('MouseEvent.screenX')
@DocsEditable
@@ -18409,7 +18422,7 @@ class PopStateEvent extends Event native "*PopStateEvent" {
@DocsEditable
@annotation_Creates_SerializedScriptValue
@annotation_Returns_SerializedScriptValue
- final dynamic _state;
+ dynamic get _state => JS("", "#.state", this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -19291,9 +19304,11 @@ class RtcSessionDescription native "*RTCSessionDescription" {
@DomName('RTCStatsElement')
class RtcStatsElement native "*RTCStatsElement" {
+ DateTime get timestamp => _convertNativeToDart_DateTime(this._timestamp);
+ @JSName('timestamp')
@DomName('RTCStatsElement.timestamp')
@DocsEditable
- final Date timestamp;
+ dynamic get _timestamp => JS("", "#.timestamp", this);
@DomName('RTCStatsElement.names')
@DocsEditable
@@ -21928,7 +21943,7 @@ class Touch native "*Touch" {
@DocsEditable
@Creates('Element|Document')
@Returns('Element|Document')
- final dynamic _target;
+ dynamic get _target => JS("", "#.target", this);
@JSName('webkitForce')
@DomName('Touch.webkitForce')
@@ -22447,7 +22462,7 @@ class UIEvent extends Event native "*UIEvent" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _view;
+ dynamic get _view => JS("", "#.view", this);
@DomName('UIEvent.which')
@DocsEditable
@@ -25834,7 +25849,7 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _opener;
+ dynamic get _opener => JS("", "#.opener", this);
@DomName('DOMWindow.outerHeight')
@DocsEditable
@@ -25862,7 +25877,7 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _parent;
+ dynamic get _parent => JS("", "#.parent", this);
@DomName('DOMWindow.performance')
@DocsEditable
@@ -25913,7 +25928,7 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _self;
+ dynamic get _self => JS("", "#.self", this);
@DomName('DOMWindow.sessionStorage')
@DocsEditable
@@ -25941,7 +25956,7 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _top;
+ dynamic get _top => JS("", "#.top", this);
@JSName('webkitNotifications')
@DomName('DOMWindow.webkitNotifications')
@@ -25965,7 +25980,7 @@ class Window extends EventTarget implements WindowBase native "@*DOMWindow" {
@DocsEditable
@Creates('Window|=Object')
@Returns('Window|=Object')
- final dynamic _window;
+ dynamic get _window => JS("", "#.window", this);
@JSName('addEventListener')
@DomName('DOMWindow.addEventListener')
@@ -31537,6 +31552,15 @@ class _DocumentFragmentFactoryProvider {
// window as a parameter.
+DateTime _convertNativeToDart_DateTime(date) {
+ var millisSinceEpoch = JS('int', '#.getTime()', date);
+ return new DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, isUtc: true);
+}
+
+_convertDartToNative_DateTime(DateTime date) {
+ return JS('', 'new Date(#)', date.millisecondsSinceEpoch);
+}
+
WindowBase _convertNativeToDart_Window(win) {
return _DOMWindowCrossFrame._createSafe(win);
}
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698