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

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

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
« sdk/lib/html/dart2js/html_dart2js.dart ('K') | « tests/html/element_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 305d5f2af341c748ea9f57842856cecff93c9be6..baaaf25d3763c6b6f463b93593a687cd095f90b2 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -924,6 +924,13 @@ $endif
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);
+ }
$!MEMBERS
}
« sdk/lib/html/dart2js/html_dart2js.dart ('K') | « tests/html/element_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698