| Index: tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
|
| diff --git a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
|
| index 6887091dacdf3c07dd1f361bc3d69e8aa8a648cd..e4aaa299ee5ef524046ce8adca1f751137468ea7 100644
|
| --- a/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
|
| +++ b/tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate
|
| @@ -160,11 +160,18 @@ $endif
|
| Element get pointerLockElement =>
|
| _webkitPointerLockElement;
|
|
|
| - @DomName('Document.webkitVisibilityState')
|
| + @DomName('Document.visibilityState')
|
| @SupportedBrowser(SupportedBrowser.CHROME)
|
| - @SupportedBrowser(SupportedBrowser.SAFARI)
|
| + @SupportedBrowser(SupportedBrowser.FIREFOX)
|
| + @SupportedBrowser(SupportedBrowser.IE, '10')
|
| @Experimental()
|
| +$if DART2JS
|
| + String get visibilityState => JS('String',
|
| + '(#.visibilityState || #.mozVisibilityState || #.msVisibilityState ||'
|
| + '#.webkitVisibilityState)', this, this, this, this);
|
| +$else
|
| String get visibilityState => _webkitVisibilityState;
|
| +$endif
|
|
|
| @Experimental
|
| $if DART2JS
|
| @@ -182,4 +189,38 @@ $if DART2JS
|
| $endif
|
| // Note: used to polyfill <template>
|
| Document _templateContentsOwner;
|
| +
|
| + @DomName('Document.visibilityChange')
|
| + @SupportedBrowser(SupportedBrowser.CHROME)
|
| + @SupportedBrowser(SupportedBrowser.FIREFOX)
|
| + @SupportedBrowser(SupportedBrowser.IE, '10')
|
| + @Experimental()
|
| + static const EventStreamProvider<Event> visibilityChangeEvent =
|
| + const _CustomEventStreamProvider<Event>(
|
| + _determineVisibilityChangeEventType);
|
| +
|
| + static String _determineVisibilityChangeEventType(EventTarget e) {
|
| +$if DART2JS
|
| + if (JS('bool', '(typeof #.hidden !== "undefined")', e)) {
|
| + // Opera 12.10 and Firefox 18 and later support
|
| + return 'visibilitychange';
|
| + } else if (JS('bool', '(typeof #.mozHidden !== "undefined")', e)) {
|
| + return 'mozvisibilitychange';
|
| + } else if (JS('bool', '(typeof #.msHidden !== "undefined")', e)) {
|
| + return 'msvisibilitychange';
|
| + } else if (JS('bool', '(typeof #.webkitHidden !== "undefined")', e)) {
|
| + return 'webkitvisibilitychange';
|
| + }
|
| + return 'visibilitychange';
|
| +$else
|
| + return 'webkitvisibilitychange';
|
| +$endif
|
| + }
|
| +
|
| + @SupportedBrowser(SupportedBrowser.CHROME)
|
| + @SupportedBrowser(SupportedBrowser.FIREFOX)
|
| + @SupportedBrowser(SupportedBrowser.IE, '10')
|
| + @Experimental()
|
| + Stream<Event> get onVisibilityChange =>
|
| + visibilityChangeEvent.forTarget(this);
|
| }
|
|
|