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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 class _ChildrenElementList extends ListBase<Element> { 7 class _ChildrenElementList extends ListBase<Element> {
8 // Raw Element. 8 // Raw Element.
9 final Element _element; 9 final Element _element;
10 final HtmlCollection _childElements; 10 final HtmlCollection _childElements;
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 @Experimental() 917 @Experimental()
918 bool get isTemplate => tagName == 'TEMPLATE' || _isAttributeTemplate; 918 bool get isTemplate => tagName == 'TEMPLATE' || _isAttributeTemplate;
919 919
920 void _ensureTemplate() { 920 void _ensureTemplate() {
921 if (!isTemplate) { 921 if (!isTemplate) {
922 throw new UnsupportedError('$this is not a template.'); 922 throw new UnsupportedError('$this is not a template.');
923 } 923 }
924 TemplateElement.decorate(this); 924 TemplateElement.decorate(this);
925 } 925 }
926 926
927 /** Provides the coordinates of the element relative to the document. */
928 Point get documentOffset() {
929 final docElem = document.documentElement;
930 final box = getBoundingClientRect();
931 return new Point(box.left + window.pageXOffset - docElem.clientLeft,
932 box.top + window.pageYOffset - docElem.clientTop);
933 }
927 $!MEMBERS 934 $!MEMBERS
928 } 935 }
929 936
930 937
931 final _START_TAG_REGEXP = new RegExp('<(\\w+)'); 938 final _START_TAG_REGEXP = new RegExp('<(\\w+)');
932 class _ElementFactoryProvider { 939 class _ElementFactoryProvider {
933 static const _CUSTOM_PARENT_TAG_MAP = const { 940 static const _CUSTOM_PARENT_TAG_MAP = const {
934 'body' : 'html', 941 'body' : 'html',
935 'head' : 'html', 942 'head' : 'html',
936 'caption' : 'table', 943 'caption' : 'table',
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 const ScrollAlignment._internal(this._value); 1071 const ScrollAlignment._internal(this._value);
1065 toString() => 'ScrollAlignment.$_value'; 1072 toString() => 'ScrollAlignment.$_value';
1066 1073
1067 /// Attempt to align the element to the top of the scrollable area. 1074 /// Attempt to align the element to the top of the scrollable area.
1068 static const TOP = const ScrollAlignment._internal('TOP'); 1075 static const TOP = const ScrollAlignment._internal('TOP');
1069 /// Attempt to center the element in the scrollable area. 1076 /// Attempt to center the element in the scrollable area.
1070 static const CENTER = const ScrollAlignment._internal('CENTER'); 1077 static const CENTER = const ScrollAlignment._internal('CENTER');
1071 /// Attempt to align the element to the bottom of the scrollable area. 1078 /// Attempt to align the element to the bottom of the scrollable area.
1072 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1079 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1073 } 1080 }
OLDNEW
« 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