| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen
t* canvas, WebGLContextAttributes* attrs) | 63 PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen
t* canvas, WebGLContextAttributes* attrs) |
| 64 { | 64 { |
| 65 Document& document = canvas->document(); | 65 Document& document = canvas->document(); |
| 66 LocalFrame* frame = document.frame(); | 66 LocalFrame* frame = document.frame(); |
| 67 if (!frame) { | 67 if (!frame) { |
| 68 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 68 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
| 69 return nullptr; | 69 return nullptr; |
| 70 } | 70 } |
| 71 Settings* settings = frame->settings(); | 71 Settings* settings = frame->settings(); |
| 72 | 72 |
| 73 // The only situation that attrs is null is through Document::getCSSCanvasCo
ntext(). | 73 // TODO(esprehn): This should never be null. |
| 74 RefPtr<WebGLContextAttributes> defaultAttrs = nullptr; | 74 RefPtr<WebGLContextAttributes> defaultAttrs = nullptr; |
| 75 if (!attrs) { | 75 if (!attrs) { |
| 76 defaultAttrs = WebGLContextAttributes::create(); | 76 defaultAttrs = WebGLContextAttributes::create(); |
| 77 attrs = defaultAttrs.get(); | 77 attrs = defaultAttrs.get(); |
| 78 } | 78 } |
| 79 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum
ent.topDocument().url().string(), settings, 1); | 79 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum
ent.topDocument().url().string(), settings, 1); |
| 80 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); | 80 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); |
| 81 if (!context) { | 81 if (!context) { |
| 82 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 82 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
| 83 return nullptr; | 83 return nullptr; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC
, ApprovedExtension, bothPrefixes); | 132 registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC
, ApprovedExtension, bothPrefixes); |
| 133 registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC,
ApprovedExtension, bothPrefixes); | 133 registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC,
ApprovedExtension, bothPrefixes); |
| 134 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo); | 134 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo); |
| 135 registerExtension<WebGLDebugShaders>(m_webglDebugShaders); | 135 registerExtension<WebGLDebugShaders>(m_webglDebugShaders); |
| 136 registerExtension<WebGLDepthTexture>(m_webglDepthTexture, ApprovedExtension,
bothPrefixes); | 136 registerExtension<WebGLDepthTexture>(m_webglDepthTexture, ApprovedExtension,
bothPrefixes); |
| 137 registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers); | 137 registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers); |
| 138 registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, b
othPrefixes); | 138 registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, b
othPrefixes); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |