| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 EventTypeNames::webglcontextcreationerror, false, true, | 671 EventTypeNames::webglcontextcreationerror, false, true, |
| 672 "Web page was not allowed to create a WebGL context.")); | 672 "Web page was not allowed to create a WebGL context.")); |
| 673 return nullptr; | 673 return nullptr; |
| 674 } | 674 } |
| 675 Settings* settings = frame->settings(); | 675 Settings* settings = frame->settings(); |
| 676 | 676 |
| 677 // The FrameLoaderClient might block creation of a new WebGL context despite | 677 // The FrameLoaderClient might block creation of a new WebGL context despite |
| 678 // the page settings; in particular, if WebGL contexts were lost one or more | 678 // the page settings; in particular, if WebGL contexts were lost one or more |
| 679 // times via the GL_ARB_robustness extension. | 679 // times via the GL_ARB_robustness extension. |
| 680 if (!frame->loader().client()->allowWebGL(settings && | 680 if (!frame->loader().client()->allowWebGL(settings && |
| 681 settings->webGLEnabled())) { | 681 settings->getWebGLEnabled())) { |
| 682 canvas->dispatchEvent(WebGLContextEvent::create( | 682 canvas->dispatchEvent(WebGLContextEvent::create( |
| 683 EventTypeNames::webglcontextcreationerror, false, true, | 683 EventTypeNames::webglcontextcreationerror, false, true, |
| 684 "Web page was not allowed to create a WebGL context.")); | 684 "Web page was not allowed to create a WebGL context.")); |
| 685 return nullptr; | 685 return nullptr; |
| 686 } | 686 } |
| 687 | 687 |
| 688 return createContextProviderInternal(canvas, nullptr, attributes, | 688 return createContextProviderInternal(canvas, nullptr, attributes, |
| 689 webGLVersion); | 689 webGLVersion); |
| 690 } | 690 } |
| 691 | 691 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 // initialized. Restore it now. | 1265 // initialized. Restore it now. |
| 1266 drawingBuffer()->restoreAllState(); | 1266 drawingBuffer()->restoreAllState(); |
| 1267 activateContext(this); | 1267 activateContext(this); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 void WebGLRenderingContextBase::setupFlags() { | 1270 void WebGLRenderingContextBase::setupFlags() { |
| 1271 ASSERT(drawingBuffer()); | 1271 ASSERT(drawingBuffer()); |
| 1272 if (canvas()) { | 1272 if (canvas()) { |
| 1273 if (Page* p = canvas()->document().page()) { | 1273 if (Page* p = canvas()->document().page()) { |
| 1274 m_synthesizedErrorsToConsole = | 1274 m_synthesizedErrorsToConsole = |
| 1275 p->settings().webGLErrorsToConsoleEnabled(); | 1275 p->settings().getWebGLErrorsToConsoleEnabled(); |
| 1276 } | 1276 } |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 m_isDepthStencilSupported = | 1279 m_isDepthStencilSupported = |
| 1280 extensionsUtil()->isExtensionEnabled("GL_OES_packed_depth_stencil"); | 1280 extensionsUtil()->isExtensionEnabled("GL_OES_packed_depth_stencil"); |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 void WebGLRenderingContextBase::addCompressedTextureFormat(GLenum format) { | 1283 void WebGLRenderingContextBase::addCompressedTextureFormat(GLenum format) { |
| 1284 if (!m_compressedTextureFormats.contains(format)) | 1284 if (!m_compressedTextureFormats.contains(format)) |
| 1285 m_compressedTextureFormats.append(format); | 1285 m_compressedTextureFormats.append(format); |
| (...skipping 6122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7408 return; | 7408 return; |
| 7409 | 7409 |
| 7410 if (canvas()) { | 7410 if (canvas()) { |
| 7411 LocalFrame* frame = canvas()->document().frame(); | 7411 LocalFrame* frame = canvas()->document().frame(); |
| 7412 if (!frame) | 7412 if (!frame) |
| 7413 return; | 7413 return; |
| 7414 | 7414 |
| 7415 Settings* settings = frame->settings(); | 7415 Settings* settings = frame->settings(); |
| 7416 | 7416 |
| 7417 if (!frame->loader().client()->allowWebGL(settings && | 7417 if (!frame->loader().client()->allowWebGL(settings && |
| 7418 settings->webGLEnabled())) | 7418 settings->getWebGLEnabled())) |
| 7419 return; | 7419 return; |
| 7420 } | 7420 } |
| 7421 | 7421 |
| 7422 // If the context was lost due to RealLostContext, we need to destroy the old | 7422 // If the context was lost due to RealLostContext, we need to destroy the old |
| 7423 // DrawingBuffer before creating new DrawingBuffer to ensure resource budget | 7423 // DrawingBuffer before creating new DrawingBuffer to ensure resource budget |
| 7424 // enough. | 7424 // enough. |
| 7425 if (drawingBuffer()) { | 7425 if (drawingBuffer()) { |
| 7426 m_drawingBuffer->beginDestruction(); | 7426 m_drawingBuffer->beginDestruction(); |
| 7427 m_drawingBuffer.clear(); | 7427 m_drawingBuffer.clear(); |
| 7428 } | 7428 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7774 | 7774 |
| 7775 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7775 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7776 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7776 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7777 if (canvas()) | 7777 if (canvas()) |
| 7778 result.setHTMLCanvasElement(canvas()); | 7778 result.setHTMLCanvasElement(canvas()); |
| 7779 else | 7779 else |
| 7780 result.setOffscreenCanvas(getOffscreenCanvas()); | 7780 result.setOffscreenCanvas(getOffscreenCanvas()); |
| 7781 } | 7781 } |
| 7782 | 7782 |
| 7783 } // namespace blink | 7783 } // namespace blink |
| OLD | NEW |