* Start observing changes to the hidden attribute, if we haven't already * started.
()
| 244 | * started. |
| 245 | */ |
| 246 | initHiddenObserver_() { |
| 247 | if (this.hiddenObserverUnlistener_) { |
| 248 | return; |
| 249 | } |
| 250 | |
| 251 | const root = this.ampdoc.getRootNode(); |
| 252 | const element = root.documentElement || root; |
| 253 | const hiddenObserver = Services.hiddenObserverForDoc(element); |
| 254 | this.hiddenObserverUnlistener_ = hiddenObserver.add(() => { |
| 255 | if (!this.updatePass_.isPending()) { |
| 256 | // Wait one animation frame so that other mutations may arrive. |
| 257 | this.updatePass_.schedule(16); |
| 258 | } |
| 259 | }); |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * Updates the viewer's padding-top position and recalculates offsets of |
no test coverage detected