summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp')
-rw-r--r--WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
index 5da4b3e..e1a9c0e 100644
--- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
@@ -110,6 +110,13 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)
switch (info.getType()) {
case WebGLGetInfo::kTypeBool:
return v8::Boolean::New(info.getBool());
+ case WebGLGetInfo::kTypeBoolArray: {
+ const Vector<bool>& value = info.getBoolArray();
+ v8::Local<v8::Array> array = v8::Array::New(value.size());
+ for (size_t ii = 0; ii < value.size(); ++ii)
+ array->Set(v8::Integer::New(ii), v8::Boolean::New(value[ii]));
+ return array;
+ }
case WebGLGetInfo::kTypeFloat:
return v8::Number::New(info.getFloat());
case WebGLGetInfo::kTypeLong:
@@ -209,6 +216,32 @@ enum WhichProgramCall {
kProgramParameter, kUniform
};
+v8::Handle<v8::Value> V8WebGLRenderingContext::getAttachedShadersCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.WebGLRenderingContext.getAttachedShaders()");
+
+ if (args.Length() < 1) {
+ V8Proxy::setDOMException(SYNTAX_ERR);
+ return notHandledByInterceptor();
+ }
+
+ ExceptionCode ec = 0;
+ WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
+ WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
+ Vector<WebGLShader*> shaders;
+ bool succeed = context->getAttachedShaders(program, shaders, ec);
+ if (ec) {
+ V8Proxy::setDOMException(ec);
+ return v8::Undefined();
+ }
+ if (!succeed)
+ return v8::Undefined();
+ v8::Local<v8::Array> array = v8::Array::New(shaders.size());
+ for (size_t ii = 0; ii < shaders.size(); ++ii)
+ array->Set(v8::Integer::New(ii), toV8(shaders[ii]));
+ return array;
+}
+
v8::Handle<v8::Value> V8WebGLRenderingContext::getBufferParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getBufferParameter()");