* @param {!Node=} opt_contextNode * @return {boolean} * @private
(opt_contextNode)
| 270 | * @private |
| 271 | */ |
| 272 | canAnimate_(opt_contextNode) { |
| 273 | // Window level: animations allowed only when global window is visible. |
| 274 | if (isDocumentHidden(this.win.document)) { |
| 275 | return false; |
| 276 | } |
| 277 | |
| 278 | // Single doc: animations allowed when single doc is visible. |
| 279 | if (this.ampdocService_.isSingleDoc()) { |
| 280 | return this.ampdocService_.getSingleDoc().isVisible(); |
| 281 | } |
| 282 | |
| 283 | // Multi-doc: animations depend on the state of the relevant doc. |
| 284 | if (opt_contextNode) { |
| 285 | const ampdoc = this.ampdocService_.getAmpDocIfAvailable(opt_contextNode); |
| 286 | return !ampdoc || ampdoc.isVisible(); |
| 287 | } |
| 288 | |
| 289 | return true; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Runs the animation vsync task. This operation can only run when animations |
no test coverage detected