|
206 | 206 | }
|
207 | 207 | };
|
208 | 208 |
|
209 |
| - /** |
210 |
| - * Get's the iframe in the parent document |
211 |
| - * that is displaying the specified window . |
212 |
| - * @param {Window} window window to check. |
213 |
| - * @return {HTMLIFrameElement?) the iframe element if window is in an iframe |
214 |
| - */ |
215 |
| - function getIFrameForWindow(window) { |
216 |
| - if (!isInIFrame(window)) { |
217 |
| - return; |
218 |
| - } |
219 |
| - const iframes = window.parent.document.getElementsByTagName("iframe"); |
220 |
| - for (let ii = 0; ii < iframes.length; ++ii) { |
221 |
| - const iframe = iframes[ii]; |
222 |
| - if (iframe.contentDocument === window.document) { |
223 |
| - return iframe; // eslint-disable-line |
224 |
| - } |
225 |
| - } |
226 |
| - } |
227 |
| - |
228 |
| - /** |
229 |
| - * Returns true if window is on screen. The main window is |
230 |
| - * always on screen windows in iframes might not be. |
231 |
| - * @param {Window} window the window to check. |
232 |
| - * @return {boolean} true if window is on screen. |
233 |
| - */ |
234 |
| - function isFrameVisible(window) { |
235 |
| - try { |
236 |
| - const iframe = getIFrameForWindow(window); |
237 |
| - if (!iframe) { |
238 |
| - return true; |
239 |
| - } |
240 |
| - |
241 |
| - const bounds = iframe.getBoundingClientRect(); |
242 |
| - const isVisible = bounds.top < window.parent.innerHeight && bounds.bottom >= 0 && |
243 |
| - bounds.left < window.parent.innerWidth && bounds.right >= 0; |
244 |
| - |
245 |
| - return isVisible && isFrameVisible(window.parent); |
246 |
| - } catch (e) { |
247 |
| - return true; // We got a security error? |
248 |
| - } |
249 |
| - } |
250 |
| - |
251 |
| - /** |
252 |
| - * Returns true if element is on screen. |
253 |
| - * @param {HTMLElement} element the element to check. |
254 |
| - * @return {boolean} true if element is on screen. |
255 |
| - */ |
256 |
| - function isOnScreen(element) { |
257 |
| - let isVisible = true; |
258 |
| - |
259 |
| - if (element) { |
260 |
| - const bounds = element.getBoundingClientRect(); |
261 |
| - isVisible = bounds.top < topWindow.innerHeight && bounds.bottom >= 0; |
262 |
| - } |
263 |
| - |
264 |
| - return isVisible && isFrameVisible(topWindow); |
265 |
| - } |
266 |
| - |
267 |
| - // Replace requestAnimationFrame. |
268 |
| - if (topWindow.requestAnimationFrame) { |
269 |
| - topWindow.requestAnimationFrame = (function(oldRAF) { |
270 |
| - |
271 |
| - return function(callback, element) { |
272 |
| - const handler = function() { |
273 |
| - return oldRAF(isOnScreen(element) ? callback : handler, element); |
274 |
| - }; |
275 |
| - return handler(); |
276 |
| - }; |
277 |
| - |
278 |
| - }(topWindow.requestAnimationFrame)); |
279 |
| - } |
280 |
| - |
281 | 209 | updateCSSIfInIFrame();
|
282 | 210 |
|
283 | 211 | //------------ [ from https://github.com/KhronosGroup/WebGLDeveloperTools ]
|
|
781 | 709 | if (wrapper.getError) {
|
782 | 710 | wrapper.getError = function() {
|
783 | 711 | for (const err in glErrorShadow) {
|
784 |
| - if (glErrorShadow.hasOwnProperty(err)) { |
| 712 | + if (Object.prototype.hasOwnProperty.call(glErrorShadow, err)) { |
785 | 713 | if (glErrorShadow[err]) {
|
786 | 714 | glErrorShadow[err] = false;
|
787 | 715 | return err;
|
|
0 commit comments