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

Unified Diff: sdk/lib/html/dartium/html_dartium.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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index fbe12b7ebf314a721ad55c8fcbc70f4d5087a426..fac0395e5f3d11aad293fc21f4278318fa419696 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -8990,6 +8990,13 @@ abstract class Element extends Node implements ElementTraversal {
TemplateElement.decorate(this);
}
+ /** Provides the coordinates of the element relative to the document. */
+ Point get documentOffset() {
+ 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"); }

Powered by Google App Engine
This is Rietveld 408576698