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

Unified Diff: tools/dom/templates/html/dart2js/impl_MouseEvent.darttemplate

Issue 12493003: Exposing Point & Rect types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sync to ToT 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:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/src/dartium_KeyEvent.dart ('k') | tools/dom/templates/html/dartium/impl_MouseEvent.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/dart2js/impl_MouseEvent.darttemplate
diff --git a/tools/dom/templates/html/dart2js/impl_MouseEvent.darttemplate b/tools/dom/templates/html/dart2js/impl_MouseEvent.darttemplate
index d39c3c9d6b994b20fbeafd81c0da7674c1c062cc..c6affdcd34d7849ab1c8e1ef7c0ea1d42f4eb16e 100644
--- a/tools/dom/templates/html/dart2js/impl_MouseEvent.darttemplate
+++ b/tools/dom/templates/html/dart2js/impl_MouseEvent.darttemplate
@@ -22,18 +22,46 @@ $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
}
$!MEMBERS
- // TODO(amouravski): Move this documentation out of thise template files and
- // put it into docs.json. Remember to add @DomName here.
+ @deprecated
+ int get clientX => client.x;
+ @deprecated
+ int get clientY => client.y;
+ @deprecated
+ int get offsetX => offset.x;
+ @deprecated
+ int get offsetY => offset.y;
+ @deprecated
+ int get movementX => movement.x;
+ @deprecated
+ int get movementY => movement.y;
+ @deprecated
+ int get screenX => screen.x;
+ @deprecated
+ int get screenY => screen.y;
+
+ @DomName('MouseEvent.clientX')
+ @DomName('MouseEvent.clientY')
+ Point get client => new Point($dom_clientX, $dom_clientY);
+
+ @DomName('MouseEvent.movementX')
+ @DomName('MouseEvent.movementY')
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.SAFARI)
+ @Experimental
+ Point get movement => new Point($dom_webkitMovementX, $dom_webkitMovementY);
+
/**
- * The X coordinate of the mouse pointer in target node coordinates.
+ * The coordinates of the mouse pointer in target node coordinates.
*
* This value may vary between platforms if the target node moves
* after the event has fired or if the element has CSS transforms affecting
* it.
*/
- int get offsetX {
- if (JS('bool', '!!#.offsetX', this)) {
- return JS('int', '#.offsetX', this);
+ Point get offset {
+ if (JS('bool', '!!#.offsetX', this)) {
+ var x = JS('int', '#.offsetX', this);
+ var y = JS('int', '#.offsetX', this);
+ return new Point(x, y);
} else {
// Firefox does not support offsetX.
var target = this.target;
@@ -41,28 +69,12 @@ $!MEMBERS
throw new UnsupportedError(
'offsetX is only supported on elements');
}
- return this.clientX - this.target.getBoundingClientRect().left;
+ return (this.client -
+ this.target.getBoundingClientRect().topLeft).toInt();
}
}
- /**
- * The Y coordinate of the mouse pointer in target node coordinates.
- *
- * This value may vary between platforms if the target node moves
- * after the event has fired or if the element has CSS transforms affecting
- * it.
- */
- int get offsetY {
- if (JS('bool', '!!#.offsetY', this)) {
- return JS('int', '#.offsetY', this);
- } else {
- // Firefox does not support offsetY.
- var target = this.target;
- if (!(target is Element)) {
- throw new UnsupportedError(
- 'offsetY is only supported on elements');
- }
- return this.clientY - this.target.getBoundingClientRect().top;
- }
- }
+ @DomName('MouseEvent.screenX')
+ @DomName('MouseEvent.screenY')
+ Point get screen => new Point($dom_screenX, $dom_screenY);
}
« no previous file with comments | « tools/dom/src/dartium_KeyEvent.dart ('k') | tools/dom/templates/html/dartium/impl_MouseEvent.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698