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 5134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5145 if (!image || !image->cachedImage()) { | 5145 if (!image || !image->cachedImage()) { |
5146 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no im
age"); | 5146 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no im
age"); |
5147 return false; | 5147 return false; |
5148 } | 5148 } |
5149 const KURL& url = image->cachedImage()->response().url(); | 5149 const KURL& url = image->cachedImage()->response().url(); |
5150 if (url.isNull() || url.isEmpty() || !url.isValid()) { | 5150 if (url.isNull() || url.isEmpty() || !url.isValid()) { |
5151 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "inval
id image"); | 5151 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "inval
id image"); |
5152 return false; | 5152 return false; |
5153 } | 5153 } |
5154 if (wouldTaintOrigin(image)) { | 5154 if (wouldTaintOrigin(image)) { |
5155 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun
ctionName, "WebGLRenderingContext", "The cross-origin image at " + url.elidedStr
ing() + " may not be loaded.")); | 5155 exceptionState.throwSecurityError("The cross-origin image at " + url.eli
dedString() + " may not be loaded."); |
5156 return false; | 5156 return false; |
5157 } | 5157 } |
5158 return true; | 5158 return true; |
5159 } | 5159 } |
5160 | 5160 |
5161 bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName,
HTMLCanvasElement* canvas, ExceptionState& exceptionState) | 5161 bool WebGLRenderingContext::validateHTMLCanvasElement(const char* functionName,
HTMLCanvasElement* canvas, ExceptionState& exceptionState) |
5162 { | 5162 { |
5163 if (!canvas || !canvas->buffer()) { | 5163 if (!canvas || !canvas->buffer()) { |
5164 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no ca
nvas"); | 5164 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no ca
nvas"); |
5165 return false; | 5165 return false; |
5166 } | 5166 } |
5167 if (wouldTaintOrigin(canvas)) { | 5167 if (wouldTaintOrigin(canvas)) { |
5168 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun
ctionName, "WebGLRenderingContext", "Tainted canvases may not be loaded.")); | 5168 exceptionState.throwSecurityError("Tainted canvases may not be loaded.")
; |
5169 return false; | 5169 return false; |
5170 } | 5170 } |
5171 return true; | 5171 return true; |
5172 } | 5172 } |
5173 | 5173 |
5174 bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, H
TMLVideoElement* video, ExceptionState& exceptionState) | 5174 bool WebGLRenderingContext::validateHTMLVideoElement(const char* functionName, H
TMLVideoElement* video, ExceptionState& exceptionState) |
5175 { | 5175 { |
5176 if (!video || !video->videoWidth() || !video->videoHeight()) { | 5176 if (!video || !video->videoWidth() || !video->videoHeight()) { |
5177 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no vi
deo"); | 5177 synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no vi
deo"); |
5178 return false; | 5178 return false; |
5179 } | 5179 } |
5180 if (wouldTaintOrigin(video)) { | 5180 if (wouldTaintOrigin(video)) { |
5181 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute(fun
ctionName, "WebGLRenderingContext", "The video element contains cross-origin dat
a, and may not be loaded.")); | 5181 exceptionState.throwSecurityError("The video element contains cross-orig
in data, and may not be loaded."); |
5182 return false; | 5182 return false; |
5183 } | 5183 } |
5184 return true; | 5184 return true; |
5185 } | 5185 } |
5186 | 5186 |
5187 bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denu
m mode, GC3Dint first, GC3Dsizei count) | 5187 bool WebGLRenderingContext::validateDrawArrays(const char* functionName, GC3Denu
m mode, GC3Dint first, GC3Dsizei count) |
5188 { | 5188 { |
5189 if (isContextLost() || !validateDrawMode(functionName, mode)) | 5189 if (isContextLost() || !validateDrawMode(functionName, mode)) |
5190 return false; | 5190 return false; |
5191 | 5191 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5619 if (m_textureUnits[i].m_texture2DBinding | 5619 if (m_textureUnits[i].m_texture2DBinding |
5620 || m_textureUnits[i].m_textureCubeMapBinding) { | 5620 || m_textureUnits[i].m_textureCubeMapBinding) { |
5621 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5621 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
5622 return; | 5622 return; |
5623 } | 5623 } |
5624 } | 5624 } |
5625 m_onePlusMaxNonDefaultTextureUnit = 0; | 5625 m_onePlusMaxNonDefaultTextureUnit = 0; |
5626 } | 5626 } |
5627 | 5627 |
5628 } // namespace WebCore | 5628 } // namespace WebCore |
OLD | NEW |