diff options
Diffstat (limited to 'Source/WebCore/bindings/v8/custom')
20 files changed, 77 insertions, 76 deletions
diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp index 99edc8b..9d8907b 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "ExceptionCode.h" @@ -77,5 +74,3 @@ v8::Handle<v8::Value> V8ArrayBuffer::constructorCallback(const v8::Arguments& ar } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h index 6881a01..f842b6d 100644 --- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h +++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h @@ -31,8 +31,6 @@ #ifndef V8ArrayBufferViewCustom_h #define V8ArrayBufferViewCustom_h -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "V8ArrayBuffer.h" @@ -87,7 +85,7 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType int argLen = args.Length(); if (!argLen) { // This happens when we return a previously constructed - // ArrayBufferView, e.g. from the call to <Type>Array.slice(). + // ArrayBufferView, e.g. from the call to <Type>Array.subset(). // The V8DOMWrapper will set the internal pointer in the // created object. Unfortunately it doesn't look like it's // possible to distinguish between this case and that where @@ -99,7 +97,7 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get()); // Do not call SetIndexedPropertiesToExternalArrayData on this // object. Not only is there no point from a performance - // perspective, but doing so causes errors in the slice() case. + // perspective, but doing so causes errors in the subset() case. return toV8(array.release(), args.Holder()); } @@ -209,6 +207,4 @@ v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args) } -#endif // ENABLE(3D_CANVAS) - #endif // V8ArrayBufferViewCustom_h diff --git a/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp index e1a1ba4..419cd60 100644 --- a/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp @@ -28,8 +28,13 @@ #include "V8AudioContext.h" +#include "ArrayBuffer.h" +#include "AudioBuffer.h" #include "AudioContext.h" #include "Frame.h" +#include "V8ArrayBuffer.h" +#include "V8AudioBuffer.h" +#include "V8Binding.h" #include "V8Proxy.h" namespace WebCore { @@ -55,6 +60,58 @@ v8::Handle<v8::Value> V8AudioContext::constructorCallback(const v8::Arguments& a return args.Holder(); } +v8::Handle<v8::Value> V8AudioContext::createBufferCallback(const v8::Arguments& args) +{ + if (args.Length() < 2) + return throwError("Not enough arguments", V8Proxy::SyntaxError); + + AudioContext* audioContext = toNative(args.Holder()); + ASSERT(audioContext); + + v8::Handle<v8::Value> arg = args[0]; + + // AudioBuffer createBuffer(in ArrayBuffer buffer, in boolean mixToMono); + if (V8ArrayBuffer::HasInstance(arg)) { + v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); + ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); + ASSERT(arrayBuffer); + + if (arrayBuffer) { + bool mixToMono = args[1]->ToBoolean()->Value(); + + RefPtr<AudioBuffer> audioBuffer = audioContext->createBuffer(arrayBuffer, mixToMono); + if (!audioBuffer.get()) + return throwError("Error decoding audio file data", V8Proxy::SyntaxError); + + return toV8(audioBuffer.get()); + } + + return v8::Undefined(); + } + + // AudioBuffer createBuffer(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate); + if (args.Length() < 3) + return throwError("Not enough arguments", V8Proxy::SyntaxError); + + bool ok = false; + + unsigned numberOfChannels = toInt32(args[0], ok); + if (!ok) + return throwError("Invalid number of channels", V8Proxy::SyntaxError); + + unsigned numberOfFrames = toInt32(args[1], ok); + if (!ok) + return throwError("Invalid number of frames", V8Proxy::SyntaxError); + + float sampleRate = toFloat(args[2]); + + RefPtr<AudioBuffer> audioBuffer = audioContext->createBuffer(numberOfChannels, numberOfFrames, sampleRate); + if (!audioBuffer.get()) + return throwError("Error creating AudioBuffer", V8Proxy::SyntaxError); + + return toV8(audioBuffer.get()); +} + } // namespace WebCore #endif // ENABLE(WEB_AUDIO) diff --git a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 328a9c1..85ae322 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -183,12 +183,6 @@ void V8DOMWindow::eventAccessorSetter(v8::Local<v8::String> name, v8::Local<v8:: context->Global()->SetHiddenValue(eventSymbol, value); } -v8::Handle<v8::Value> V8DOMWindow::cryptoAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) -{ - // FIXME: Implement me. - return v8::Undefined(); -} - void V8DOMWindow::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { DOMWindow* imp = V8DOMWindow::toNative(info.Holder()); diff --git a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp index 60ce7ce..14f13cb 100755 --- a/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp @@ -24,9 +24,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "DataView.h" #include "V8ArrayBufferViewCustom.h" @@ -120,5 +117,3 @@ v8::Handle<v8::Value> V8DataView::setUint8Callback(const v8::Arguments& args) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp index cda0737..c435863 100644 --- a/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DocumentCustom.cpp @@ -49,7 +49,7 @@ #include "V8Proxy.h" #include "V8Touch.h" #include "V8TouchList.h" -#if ENABLE(3D_CANVAS) +#if ENABLE(WEBGL) #include "V8WebGLRenderingContext.h" #endif #include "V8XPathNSResolver.h" @@ -110,10 +110,10 @@ v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Argument return v8::Undefined(); if (result->is2d()) return toV8(static_cast<CanvasRenderingContext2D*>(result)); -#if ENABLE(3D_CANVAS) +#if ENABLE(WEBGL) else if (result->is3d()) return toV8(static_cast<WebGLRenderingContext*>(result)); -#endif // ENABLE(3D_CANVAS) +#endif // ENABLE(WEBGL) ASSERT_NOT_REACHED(); return v8::Undefined(); } diff --git a/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp index 02fc457..e9b9336 100644 --- a/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8ElementCustom.cpp @@ -58,7 +58,7 @@ v8::Handle<v8::Value> toV8(Element* impl, bool forceNewObject) if (!impl) return v8::Null(); if (impl->isHTMLElement()) - return toV8(static_cast<HTMLElement*>(impl), forceNewObject); + return toV8(toHTMLElement(impl), forceNewObject); #if ENABLE(SVG) if (impl->isSVGElement()) return toV8(static_cast<SVGElement*>(impl), forceNewObject); diff --git a/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp index c3dbe3b..178307e 100644 --- a/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Float32ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Float32Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Float32Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index e154f7f..8fd2d62 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -41,7 +41,7 @@ #include "V8CanvasRenderingContext2D.h" #include "V8Node.h" #include "V8Proxy.h" -#if ENABLE(3D_CANVAS) +#if ENABLE(WEBGL) #include "V8WebGLRenderingContext.h" #endif #include <wtf/MathExtras.h> @@ -55,7 +55,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder); String contextId = toWebCoreString(args[0]); RefPtr<CanvasContextAttributes> attrs; -#if ENABLE(3D_CANVAS) +#if ENABLE(WEBGL) if (contextId == "experimental-webgl" || contextId == "webkit-3d") { attrs = WebGLContextAttributes::create(); WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get()); @@ -84,7 +84,7 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument return v8::Null(); if (result->is2d()) return toV8(static_cast<CanvasRenderingContext2D*>(result)); -#if ENABLE(3D_CANVAS) +#if ENABLE(WEBGL) else if (result->is3d()) return toV8(static_cast<WebGLRenderingContext*>(result)); #endif diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 6bd5abb..ce1732b 100644 --- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -36,7 +36,6 @@ #include "Frame.h" #include "InjectedScript.h" #include "InjectedScriptHost.h" -#include "InspectorController.h" #include "InspectorValues.h" #include "Node.h" #include "Page.h" @@ -147,8 +146,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument if (!node) return v8::Undefined(); - InspectorController* ic = host->inspectorController(); - if (!ic) + if (!host->inspectorAgent()) return v8::Undefined(); return toV8(node); diff --git a/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp index 94fa86e..a8d8d0b 100644 --- a/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp @@ -32,6 +32,7 @@ #include "V8InspectorFrontendHost.h" #include "InspectorController.h" +#include "InspectorFrontendClient.h" #include "InspectorFrontendHost.h" #include "PlatformString.h" diff --git a/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp index 244a231..90a3c71 100644 --- a/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Int16ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Int16Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Int16Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp index a5001ed..8fa38a7 100644 --- a/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Int32ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Int32Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Int32Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp index 526d83e..33458dc 100644 --- a/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Int8ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Int8Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Int8Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp index f1357bd..c94afd9 100644 --- a/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp @@ -81,7 +81,7 @@ v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8:: { INC_STATS(L"DOM.NotificationCenter.RequestPermission()"); NotificationCenter* notificationCenter = V8NotificationCenter::toNative(args.Holder()); - ScriptExecutionContext* context = notificationCenter->context(); + ScriptExecutionContext* context = notificationCenter->scriptExecutionContext(); // Make sure that script execution context is valid. if (!context) diff --git a/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp index e3ae263..aebe310 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint16ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Uint16Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Uint16Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp index 6c60283..563df8e 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint32ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Uint32Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Uint32Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp b/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp index ea9f421..aa46863 100644 --- a/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8Uint8ArrayCustom.cpp @@ -29,9 +29,6 @@ */ #include "config.h" - -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) - #include "ArrayBuffer.h" #include "Uint8Array.h" @@ -67,5 +64,3 @@ v8::Handle<v8::Value> toV8(Uint8Array* impl) } } // namespace WebCore - -#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB) diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 7fdfc55..5a3f873 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -30,7 +30,7 @@ #include "config.h" -#if ENABLE(3D_CANVAS) +#if ENABLE(WEBGL) #include "V8WebGLRenderingContext.h" @@ -120,14 +120,14 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info) } case WebGLGetInfo::kTypeFloat: return v8::Number::New(info.getFloat()); - case WebGLGetInfo::kTypeLong: - return v8::Integer::New(info.getLong()); + case WebGLGetInfo::kTypeInt: + return v8::Integer::New(info.getInt()); case WebGLGetInfo::kTypeNull: return v8::Null(); case WebGLGetInfo::kTypeString: return v8::String::New(fromWebCoreString(info.getString()), info.getString().length()); - case WebGLGetInfo::kTypeUnsignedLong: - return v8::Integer::NewFromUnsigned(info.getUnsignedLong()); + case WebGLGetInfo::kTypeUnsignedInt: + return v8::Integer::NewFromUnsigned(info.getUnsignedInt()); case WebGLGetInfo::kTypeWebGLBuffer: return toV8(info.getWebGLBuffer()); case WebGLGetInfo::kTypeWebGLFloatArray: @@ -773,4 +773,4 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::vertexAttrib4fvCallback(const v8: } // namespace WebCore -#endif // ENABLE(3D_CANVAS) +#endif // ENABLE(WEBGL) diff --git a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 6a571ae..0548a4d 100644 --- a/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -95,7 +95,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::responseAccessorGetter(v8::Local<v8::Str return v8::Undefined(); #endif -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) +#if ENABLE(WEBGL) || ENABLE(BLOB) case XMLHttpRequest::ResponseTypeArrayBuffer: { ExceptionCode ec = 0; @@ -193,7 +193,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::sendCallback(const v8::Arguments& args) DOMFormData* domFormData = V8DOMFormData::toNative(object); ASSERT(domFormData); xmlHttpRequest->send(domFormData, ec); -#if ENABLE(3D_CANVAS) || ENABLE(BLOB) +#if ENABLE(WEBGL) || ENABLE(BLOB) } else if (V8ArrayBuffer::HasInstance(arg)) { v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(arg); ArrayBuffer* arrayBuffer = V8ArrayBuffer::toNative(object); |