| 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 47f53c1499bb9d69bbeef8a90b6b01a4730e170c..6eaee82e28648711977bdda3f7c4155931a2f858 100644
|
| --- a/tools/dom/templates/html/impl/impl_Element.darttemplate
|
| +++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
|
| @@ -775,6 +775,44 @@ $if DART2JS
|
| $endif
|
| var xtag;
|
|
|
| + /**
|
| + * Scrolls this element into view.
|
| + *
|
| + * Only one of of the alignment options may be specified at a time.
|
| + *
|
| + * If no options are specified then this will attempt to scroll the minimum
|
| + * amount needed to bring the element into view.
|
| + *
|
| + * Note that alignCenter is currently only supported on WebKit platforms. If
|
| + * alignCenter is specified but not supported then this will fall back to
|
| + * alignTop.
|
| + *
|
| + * See also:
|
| + *
|
| + * * [scrollIntoView](http://docs.webplatform.org/wiki/dom/methods/scrollIntoView)
|
| + * * [scrollIntoViewIfNeeded](http://docs.webplatform.org/wiki/dom/methods/scrollIntoViewIfNeeded)
|
| + */
|
| + void scrollIntoView([ScrollIntoViewAlignment alignment]) {
|
| + var hasScrollIntoViewIfNeeded = false;
|
| +$if DART2JS
|
| + hasScrollIntoViewIfNeeded =
|
| + JS('bool', '!!(#.scrollIntoViewIfNeeded)', this);
|
| +$endif
|
| + if (alignment == ScrollIntoViewAlignment.TOP) {
|
| + this.$dom_scrollIntoView(true);
|
| + } else if (alignment == ScrollIntoViewAlignment.BOTTOM) {
|
| + this.$dom_scrollIntoView(false);
|
| + } else if (hasScrollIntoViewIfNeeded) {
|
| + if (alignment == ScrollIntoViewAlignment.CENTER) {
|
| + this.$dom_scrollIntoViewIfNeeded(true);
|
| + } else {
|
| + this.$dom_scrollIntoViewIfNeeded();
|
| + }
|
| + } else {
|
| + this.$dom_scrollIntoView();
|
| + }
|
| + }
|
| +
|
| $if DART2JS
|
| @DomName('Element.mouseWheelEvent')
|
| static const EventStreamProvider<WheelEvent> mouseWheelEvent =
|
| @@ -1064,3 +1102,20 @@ $else
|
| document.$dom_createElement(tag);
|
| $endif
|
| }
|
| +
|
| +
|
| +/**
|
| + * Options for Element.scrollIntoView.
|
| + */
|
| +class ScrollIntoViewAlignment {
|
| + final _value;
|
| + const ScrollIntoViewAlignment._internal(this._value);
|
| + toString() => 'ScrollIntoViewAlignment.$_value';
|
| +
|
| + /// Attempt to align the element to the top of the scrollable area.
|
| + static const TOP = const ScrollIntoViewAlignment._internal('TOP');
|
| + /// Attempt to center the element in the scrollable area.
|
| + static const CENTER = const ScrollIntoViewAlignment._internal('CENTER');
|
| + /// Attempt to align the element to the bottom of the scrollable area.
|
| + static const BOTTOM = const ScrollIntoViewAlignment._internal('BOTTOM');
|
| +}
|
|
|