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

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

Issue 18060010: Added offset document measurement to Element. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « 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 5f54dcc4b2fd96cc0decd7ae404558a5b713f686..56ce509dd63b2312e9e0f47092b28dfe4d6c66a2 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -8675,6 +8675,13 @@ abstract class Element extends Node implements ElementTraversal native "Element"
TemplateElement.decorate(this);
}
+ /** Provides the coordinates of the element relative to the document. */
+ Point get documentOffset() {
blois 2013/07/12 23:10:08 Seems like it would be more useful to expose somet
+ final docElem = document.documentElement;
+ final box = getBoundingClientRect();
+ return new Point(box.left + window.pageXOffset - docElem.clientLeft,
+ box.top + window.pageYOffset - docElem.clientTop);
+ }
// To suppress missing implicit constructor warnings.
factory Element._() { throw new UnsupportedError("Not supported"); }
« 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