| 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 066b61e898bc065d122296463caa4fd7572edead..b957969d6107824495190770ef13c5b903551953 100644
|
| --- a/sdk/lib/html/dart2js/html_dart2js.dart
|
| +++ b/sdk/lib/html/dart2js/html_dart2js.dart
|
| @@ -8961,6 +8961,47 @@ abstract class Element extends Node implements ElementTraversal native "*Element
|
| @Creates('Null') // Set from Dart code; does not instantiate a native type.
|
| 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({bool alignCenter, bool alignTop, bool alignBottom}) {
|
| + var paramCount = (alignCenter != null ? 1 : 0) +
|
| + (alignTop != null ? 1 : 0) + (alignBottom != null ? 1 : 0);
|
| + if (paramCount > 1) {
|
| + throw new ArgumentError(
|
| + 'Can only specify one of alignCenter, alignTop, alignBottom');
|
| + }
|
| + var scrollIntoViewIfNeeded = false;
|
| + scrollIntoViewIfNeeded = JS('bool', '!!(#.scrollIntoViewIfNeeded)', this);
|
| + if (alignTop != null) {
|
| + this.$dom_scrollIntoView(alignTop);
|
| + } else if (alignBottom != null) {
|
| + this.$dom_scrollIntoView(alignBottom);
|
| + } else if (scrollIntoViewIfNeeded) {
|
| + if (alignCenter != null) {
|
| + this.$dom_scrollIntoViewIfNeeded(alignCenter);
|
| + } else {
|
| + this.$dom_scrollIntoViewIfNeeded();
|
| + }
|
| + } else {
|
| + this.$dom_scrollIntoView();
|
| + }
|
| + }
|
| +
|
| @DomName('Element.mouseWheelEvent')
|
| static const EventStreamProvider<WheelEvent> mouseWheelEvent =
|
| const _CustomEventStreamProvider<WheelEvent>(
|
| @@ -9566,10 +9607,15 @@ abstract class Element extends Node implements ElementTraversal native "*Element
|
| @DocsEditable
|
| void scrollByPages(int pages) native;
|
|
|
| + @JSName('scrollIntoView')
|
| + @DomName('Element.scrollIntoView')
|
| + @DocsEditable
|
| + void $dom_scrollIntoView([bool alignWithTop]) native;
|
| +
|
| @JSName('scrollIntoViewIfNeeded')
|
| @DomName('Element.scrollIntoViewIfNeeded')
|
| @DocsEditable
|
| - void scrollIntoView([bool centerIfNeeded]) native;
|
| + void $dom_scrollIntoViewIfNeeded([bool centerIfNeeded]) native;
|
|
|
| @JSName('setAttribute')
|
| @DomName('Element.setAttribute')
|
|
|