summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/html/canvas
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/canvas')
-rw-r--r--Source/WebCore/html/canvas/ArrayBuffer.cpp5
-rw-r--r--Source/WebCore/html/canvas/ArrayBuffer.idl1
-rw-r--r--Source/WebCore/html/canvas/ArrayBufferView.cpp5
-rw-r--r--Source/WebCore/html/canvas/ArrayBufferView.idl2
-rw-r--r--Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp39
-rw-r--r--Source/WebCore/html/canvas/CanvasStyle.cpp14
-rw-r--r--Source/WebCore/html/canvas/CanvasStyle.h3
-rwxr-xr-xSource/WebCore/html/canvas/DataView.cpp5
-rwxr-xr-xSource/WebCore/html/canvas/DataView.h2
-rwxr-xr-xSource/WebCore/html/canvas/DataView.idl1
-rw-r--r--Source/WebCore/html/canvas/Float32Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Float32Array.h4
-rw-r--r--Source/WebCore/html/canvas/Float32Array.idl3
-rw-r--r--Source/WebCore/html/canvas/Int16Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Int16Array.h4
-rw-r--r--Source/WebCore/html/canvas/Int16Array.idl3
-rw-r--r--Source/WebCore/html/canvas/Int32Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Int32Array.h11
-rw-r--r--Source/WebCore/html/canvas/Int32Array.idl3
-rw-r--r--Source/WebCore/html/canvas/Int8Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Int8Array.h9
-rw-r--r--Source/WebCore/html/canvas/Int8Array.idl3
-rw-r--r--Source/WebCore/html/canvas/OESStandardDerivatives.cpp4
-rw-r--r--Source/WebCore/html/canvas/OESStandardDerivatives.idl2
-rw-r--r--Source/WebCore/html/canvas/OESTextureFloat.cpp4
-rw-r--r--Source/WebCore/html/canvas/OESTextureFloat.idl2
-rw-r--r--Source/WebCore/html/canvas/TypedArrayBase.h2
-rw-r--r--Source/WebCore/html/canvas/Uint16Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Uint16Array.h9
-rw-r--r--Source/WebCore/html/canvas/Uint16Array.idl3
-rw-r--r--Source/WebCore/html/canvas/Uint32Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Uint32Array.h9
-rw-r--r--Source/WebCore/html/canvas/Uint32Array.idl3
-rw-r--r--Source/WebCore/html/canvas/Uint8Array.cpp13
-rw-r--r--Source/WebCore/html/canvas/Uint8Array.h11
-rw-r--r--Source/WebCore/html/canvas/Uint8Array.idl3
-rw-r--r--Source/WebCore/html/canvas/WebGLActiveInfo.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLBuffer.cpp6
-rw-r--r--Source/WebCore/html/canvas/WebGLBuffer.h8
-rw-r--r--Source/WebCore/html/canvas/WebGLBuffer.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLContextAttributes.cpp4
-rw-r--r--Source/WebCore/html/canvas/WebGLContextAttributes.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLContextEvent.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLExtension.cpp4
-rw-r--r--Source/WebCore/html/canvas/WebGLFramebuffer.cpp4
-rw-r--r--Source/WebCore/html/canvas/WebGLFramebuffer.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLGetInfo.cpp28
-rw-r--r--Source/WebCore/html/canvas/WebGLGetInfo.h16
-rw-r--r--Source/WebCore/html/canvas/WebGLObject.cpp6
-rw-r--r--Source/WebCore/html/canvas/WebGLProgram.cpp8
-rw-r--r--Source/WebCore/html/canvas/WebGLProgram.h2
-rw-r--r--Source/WebCore/html/canvas/WebGLProgram.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLRenderbuffer.cpp6
-rw-r--r--Source/WebCore/html/canvas/WebGLRenderbuffer.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLRenderingContext.cpp440
-rw-r--r--Source/WebCore/html/canvas/WebGLRenderingContext.h102
-rw-r--r--Source/WebCore/html/canvas/WebGLRenderingContext.idl10
-rw-r--r--Source/WebCore/html/canvas/WebGLShader.cpp7
-rw-r--r--Source/WebCore/html/canvas/WebGLShader.h4
-rw-r--r--Source/WebCore/html/canvas/WebGLShader.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLTexture.cpp6
-rw-r--r--Source/WebCore/html/canvas/WebGLTexture.h2
-rw-r--r--Source/WebCore/html/canvas/WebGLTexture.idl2
-rw-r--r--Source/WebCore/html/canvas/WebGLUniformLocation.cpp6
-rw-r--r--Source/WebCore/html/canvas/WebGLUniformLocation.h4
-rw-r--r--Source/WebCore/html/canvas/WebGLUniformLocation.idl2
-rw-r--r--Source/WebCore/html/canvas/WebKitLoseContext.cpp4
-rw-r--r--Source/WebCore/html/canvas/WebKitLoseContext.idl2
68 files changed, 509 insertions, 450 deletions
diff --git a/Source/WebCore/html/canvas/ArrayBuffer.cpp b/Source/WebCore/html/canvas/ArrayBuffer.cpp
index 2136f64..4f75cc3 100644
--- a/Source/WebCore/html/canvas/ArrayBuffer.cpp
+++ b/Source/WebCore/html/canvas/ArrayBuffer.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "ArrayBuffer.h"
#include <wtf/RefPtr.h>
@@ -100,5 +97,3 @@ void* ArrayBuffer::tryAllocate(unsigned numElements, unsigned elementByteSize)
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/ArrayBuffer.idl b/Source/WebCore/html/canvas/ArrayBuffer.idl
index 79a4685..6f63e65 100644
--- a/Source/WebCore/html/canvas/ArrayBuffer.idl
+++ b/Source/WebCore/html/canvas/ArrayBuffer.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
NoStaticTables,
diff --git a/Source/WebCore/html/canvas/ArrayBufferView.cpp b/Source/WebCore/html/canvas/ArrayBufferView.cpp
index 7f41bda..a2f61ca 100644
--- a/Source/WebCore/html/canvas/ArrayBufferView.cpp
+++ b/Source/WebCore/html/canvas/ArrayBufferView.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "ArrayBufferView.h"
#include "ArrayBuffer.h"
@@ -105,5 +102,3 @@ void ArrayBufferView::calculateOffsetAndLength(int start, int end, unsigned arra
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/ArrayBufferView.idl b/Source/WebCore/html/canvas/ArrayBufferView.idl
index be217c1..1ea451d 100644
--- a/Source/WebCore/html/canvas/ArrayBufferView.idl
+++ b/Source/WebCore/html/canvas/ArrayBufferView.idl
@@ -24,7 +24,7 @@
*/
module html {
- interface [Conditional=3D_CANVAS|BLOB, CustomToJS, NoStaticTables, OmitConstructor] ArrayBufferView {
+ interface [CustomToJS, NoStaticTables, OmitConstructor] ArrayBufferView {
readonly attribute ArrayBuffer buffer;
readonly attribute unsigned long byteOffset;
readonly attribute unsigned long byteLength;
diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index e029128..9ef2dba 100644
--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -234,7 +234,7 @@ void CanvasRenderingContext2D::setAllAttributesToDefault()
if (!context)
return;
- context->setShadow(FloatSize(), 0, Color::transparent, ColorSpaceDeviceRGB);
+ context->setLegacyShadow(FloatSize(), 0, Color::transparent, ColorSpaceDeviceRGB);
context->setAlpha(1);
context->setCompositeOperation(CompositeSourceOver);
}
@@ -574,7 +574,7 @@ void CanvasRenderingContext2D::setStrokeColor(const String& color)
{
if (color == state().m_unparsedStrokeColor)
return;
- setStrokeStyle(CanvasStyle::createFromString(color));
+ setStrokeStyle(CanvasStyle::createFromString(color, canvas()->document()));
state().m_unparsedStrokeColor = color;
}
@@ -615,7 +615,7 @@ void CanvasRenderingContext2D::setFillColor(const String& color)
{
if (color == state().m_unparsedFillColor)
return;
- setFillStyle(CanvasStyle::createFromString(color));
+ setFillStyle(CanvasStyle::createFromString(color, canvas()->document()));
state().m_unparsedFillColor = color;
}
@@ -1000,7 +1000,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
if (!c)
return;
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
+ c->setLegacyShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, const String& color, float alpha)
@@ -1018,7 +1018,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
if (!c)
return;
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
+ c->setLegacyShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float grayLevel, float alpha)
@@ -1031,7 +1031,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
if (!c)
return;
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
+ c->setLegacyShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float r, float g, float b, float a)
@@ -1044,7 +1044,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
if (!c)
return;
- c->setShadow(IntSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
+ c->setLegacyShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
}
void CanvasRenderingContext2D::setShadow(float width, float height, float blur, float c, float m, float y, float k, float a)
@@ -1064,7 +1064,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor);
CGColorRelease(shadowColor);
#else
- dc->setShadow(IntSize(width, -height), blur, state().m_shadowColor, ColorSpaceDeviceRGB);
+ dc->setLegacyShadow(FloatSize(width, -height), blur, state().m_shadowColor, ColorSpaceDeviceRGB);
#endif
}
@@ -1084,7 +1084,7 @@ void CanvasRenderingContext2D::applyShadow()
float width = state().m_shadowOffset.width();
float height = state().m_shadowOffset.height();
- c->setShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
+ c->setLegacyShadow(FloatSize(width, -height), state().m_shadowBlur, state().m_shadowColor, ColorSpaceDeviceRGB);
}
static IntSize size(HTMLImageElement* image)
@@ -1105,8 +1105,8 @@ static IntSize size(HTMLVideoElement* video)
static inline FloatRect normalizeRect(const FloatRect& rect)
{
- return FloatRect(min(rect.x(), rect.right()),
- min(rect.y(), rect.bottom()),
+ return FloatRect(min(rect.x(), rect.maxX()),
+ min(rect.y(), rect.maxY()),
max(rect.width(), -rect.width()),
max(rect.height(), -rect.height()));
}
@@ -1760,7 +1760,8 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
return;
const Font& font = accessFont();
-
+ const FontMetrics& fontMetrics = font.fontMetrics();
+
// FIXME: Handle maxWidth.
// FIXME: Need to turn off font smoothing.
@@ -1770,21 +1771,21 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
unsigned length = text.length();
const UChar* string = text.characters();
- TextRun textRun(string, length, 0, 0, 0, rtl, override, false, false);
+ TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, rtl, override, false, false);
// Draw the item text at the correct point.
FloatPoint location(x, y);
switch (state().m_textBaseline) {
case TopTextBaseline:
case HangingTextBaseline:
- location.setY(y + font.ascent());
+ location.setY(y + fontMetrics.ascent());
break;
case BottomTextBaseline:
case IdeographicTextBaseline:
- location.setY(y - font.descent());
+ location.setY(y - fontMetrics.descent());
break;
case MiddleTextBaseline:
- location.setY(y - font.descent() + font.height() / 2);
+ location.setY(y - fontMetrics.descent() + fontMetrics.height() / 2);
break;
case AlphabeticTextBaseline:
default:
@@ -1792,7 +1793,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
break;
}
- float width = font.width(TextRun(text, false, 0, 0, rtl, override));
+ float width = font.width(TextRun(text, false, 0, 0, TextRun::AllowTrailingExpansion, rtl, override));
TextAlign align = state().m_textAlign;
if (align == StartTextAlign)
@@ -1812,8 +1813,8 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
}
// The slop built in to this mask rect matches the heuristic used in FontCGWin.cpp for GDI text.
- FloatRect textRect = FloatRect(location.x() - font.height() / 2, location.y() - font.ascent() - font.lineGap(),
- width + font.height(), font.lineSpacing());
+ FloatRect textRect = FloatRect(location.x() - fontMetrics.height() / 2, location.y() - fontMetrics.ascent() - fontMetrics.lineGap(),
+ width + fontMetrics.height(), fontMetrics.lineSpacing());
if (!fill)
textRect.inflate(c->strokeThickness() / 2);
diff --git a/Source/WebCore/html/canvas/CanvasStyle.cpp b/Source/WebCore/html/canvas/CanvasStyle.cpp
index a4e87e3..ee8567c 100644
--- a/Source/WebCore/html/canvas/CanvasStyle.cpp
+++ b/Source/WebCore/html/canvas/CanvasStyle.cpp
@@ -51,14 +51,16 @@
namespace WebCore {
-enum ColorParseResult { ParsedRGBA, ParsedCurrentColor, ParseFailed };
+enum ColorParseResult { ParsedRGBA, ParsedCurrentColor, ParsedSystemColor, ParseFailed };
-static ColorParseResult parseColor(RGBA32& parsedColor, const String& colorString)
+static ColorParseResult parseColor(RGBA32& parsedColor, const String& colorString, Document* document = 0)
{
if (equalIgnoringCase(colorString, "currentcolor"))
return ParsedCurrentColor;
if (CSSParser::parseColor(parsedColor, colorString))
return ParsedRGBA;
+ if (CSSParser::parseSystemColor(parsedColor, colorString, document))
+ return ParsedSystemColor;
return ParseFailed;
}
@@ -73,9 +75,10 @@ RGBA32 currentColor(HTMLCanvasElement* canvas)
bool parseColorOrCurrentColor(RGBA32& parsedColor, const String& colorString, HTMLCanvasElement* canvas)
{
- ColorParseResult parseResult = parseColor(parsedColor, colorString);
+ ColorParseResult parseResult = parseColor(parsedColor, colorString, canvas ? canvas->document() : 0);
switch (parseResult) {
case ParsedRGBA:
+ case ParsedSystemColor:
return true;
case ParsedCurrentColor:
parsedColor = currentColor(canvas);
@@ -131,12 +134,13 @@ CanvasStyle::CanvasStyle(PassRefPtr<CanvasPattern> pattern)
{
}
-PassRefPtr<CanvasStyle> CanvasStyle::createFromString(const String& color)
+PassRefPtr<CanvasStyle> CanvasStyle::createFromString(const String& color, Document* document)
{
RGBA32 rgba;
- ColorParseResult parseResult = parseColor(rgba, color);
+ ColorParseResult parseResult = parseColor(rgba, color, document);
switch (parseResult) {
case ParsedRGBA:
+ case ParsedSystemColor:
return adoptRef(new CanvasStyle(rgba));
case ParsedCurrentColor:
return adoptRef(new CanvasStyle(CurrentColor));
diff --git a/Source/WebCore/html/canvas/CanvasStyle.h b/Source/WebCore/html/canvas/CanvasStyle.h
index 91dc923..1c136d3 100644
--- a/Source/WebCore/html/canvas/CanvasStyle.h
+++ b/Source/WebCore/html/canvas/CanvasStyle.h
@@ -35,13 +35,14 @@ namespace WebCore {
class CanvasGradient;
class CanvasPattern;
+ class Document;
class GraphicsContext;
class HTMLCanvasElement;
class CanvasStyle : public RefCounted<CanvasStyle> {
public:
static PassRefPtr<CanvasStyle> createFromRGBA(RGBA32 rgba) { return adoptRef(new CanvasStyle(rgba)); }
- static PassRefPtr<CanvasStyle> createFromString(const String& color);
+ static PassRefPtr<CanvasStyle> createFromString(const String& color, Document* = 0);
static PassRefPtr<CanvasStyle> createFromStringWithOverrideAlpha(const String& color, float alpha);
static PassRefPtr<CanvasStyle> createFromGrayLevelWithAlpha(float grayLevel, float alpha) { return adoptRef(new CanvasStyle(grayLevel, alpha)); }
static PassRefPtr<CanvasStyle> createFromRGBAChannels(float r, float g, float b, float a) { return adoptRef(new CanvasStyle(r, g, b, a)); }
diff --git a/Source/WebCore/html/canvas/DataView.cpp b/Source/WebCore/html/canvas/DataView.cpp
index 82b10b3..e00443d 100755
--- a/Source/WebCore/html/canvas/DataView.cpp
+++ b/Source/WebCore/html/canvas/DataView.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "DataView.h"
#include "CheckedInt.h"
@@ -231,5 +228,3 @@ void DataView::setFloat64(unsigned byteOffset, double value, bool littleEndian,
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/DataView.h b/Source/WebCore/html/canvas/DataView.h
index 5707aa3..a8aba5c 100755
--- a/Source/WebCore/html/canvas/DataView.h
+++ b/Source/WebCore/html/canvas/DataView.h
@@ -75,7 +75,7 @@ private:
DataView(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned byteLength);
template<typename T>
- inline bool beyondRange(unsigned byteOffset) const { return byteOffset + sizeof(T) > m_byteLength; }
+ inline bool beyondRange(unsigned byteOffset) const { return byteOffset >= m_byteLength || byteOffset + sizeof(T) > m_byteLength; }
template<typename T>
T getData(unsigned byteOffset, bool littleEndian, ExceptionCode&) const;
diff --git a/Source/WebCore/html/canvas/DataView.idl b/Source/WebCore/html/canvas/DataView.idl
index f99a814..2e173d7 100755
--- a/Source/WebCore/html/canvas/DataView.idl
+++ b/Source/WebCore/html/canvas/DataView.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
CustomToJS,
diff --git a/Source/WebCore/html/canvas/Float32Array.cpp b/Source/WebCore/html/canvas/Float32Array.cpp
index 1b26aef..209b20f 100644
--- a/Source/WebCore/html/canvas/Float32Array.cpp
+++ b/Source/WebCore/html/canvas/Float32Array.cpp
@@ -25,9 +25,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Float32Array.h"
namespace WebCore {
@@ -52,16 +49,14 @@ Float32Array::Float32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset,
{
}
-PassRefPtr<Float32Array> Float32Array::slice(int start) const
+PassRefPtr<Float32Array> Float32Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Float32Array> Float32Array::slice(int start, int end) const
+PassRefPtr<Float32Array> Float32Array::subarray(int start, int end) const
{
- return sliceImpl<Float32Array>(start, end);
+ return subarrayImpl<Float32Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Float32Array.h b/Source/WebCore/html/canvas/Float32Array.h
index d00a7c5..ee1ea56 100644
--- a/Source/WebCore/html/canvas/Float32Array.h
+++ b/Source/WebCore/html/canvas/Float32Array.h
@@ -56,8 +56,8 @@ public:
return result;
}
- PassRefPtr<Float32Array> slice(int start) const;
- PassRefPtr<Float32Array> slice(int start, int end) const;
+ PassRefPtr<Float32Array> subarray(int start) const;
+ PassRefPtr<Float32Array> subarray(int start, int end) const;
private:
Float32Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Float32Array.idl b/Source/WebCore/html/canvas/Float32Array.idl
index b979d29..c797f31 100644
--- a/Source/WebCore/html/canvas/Float32Array.idl
+++ b/Source/WebCore/html/canvas/Float32Array.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -40,7 +39,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 4;
readonly attribute unsigned long length;
- Float32Array slice(in long start, in [Optional] long end);
+ Float32Array subarray(in long start, in [Optional] long end);
// void set(in Float32Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/Int16Array.cpp b/Source/WebCore/html/canvas/Int16Array.cpp
index a3d04bc..9aaa1d5 100644
--- a/Source/WebCore/html/canvas/Int16Array.cpp
+++ b/Source/WebCore/html/canvas/Int16Array.cpp
@@ -24,9 +24,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Int16Array.h"
namespace WebCore {
@@ -51,16 +48,14 @@ Int16Array::Int16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
{
}
-PassRefPtr<Int16Array> Int16Array::slice(int start) const
+PassRefPtr<Int16Array> Int16Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Int16Array> Int16Array::slice(int start, int end) const
+PassRefPtr<Int16Array> Int16Array::subarray(int start, int end) const
{
- return sliceImpl<Int16Array>(start, end);
+ return subarrayImpl<Int16Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Int16Array.h b/Source/WebCore/html/canvas/Int16Array.h
index a6286c6..6c4f54b 100644
--- a/Source/WebCore/html/canvas/Int16Array.h
+++ b/Source/WebCore/html/canvas/Int16Array.h
@@ -41,8 +41,8 @@ public:
using TypedArrayBase<short>::set;
using IntegralTypedArrayBase<short>::set;
- PassRefPtr<Int16Array> slice(int start) const;
- PassRefPtr<Int16Array> slice(int start, int end) const;
+ PassRefPtr<Int16Array> subarray(int start) const;
+ PassRefPtr<Int16Array> subarray(int start, int end) const;
private:
Int16Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Int16Array.idl b/Source/WebCore/html/canvas/Int16Array.idl
index f1f5c8b..40123d7 100644
--- a/Source/WebCore/html/canvas/Int16Array.idl
+++ b/Source/WebCore/html/canvas/Int16Array.idl
@@ -25,7 +25,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -39,7 +38,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 2;
readonly attribute unsigned long length;
- Int16Array slice(in long start, in [Optional] long end);
+ Int16Array subarray(in long start, in [Optional] long end);
// void set(in Int16Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/Int32Array.cpp b/Source/WebCore/html/canvas/Int32Array.cpp
index 266c941..6d2793c 100644
--- a/Source/WebCore/html/canvas/Int32Array.cpp
+++ b/Source/WebCore/html/canvas/Int32Array.cpp
@@ -25,9 +25,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Int32Array.h"
namespace WebCore {
@@ -52,16 +49,14 @@ Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
{
}
-PassRefPtr<Int32Array> Int32Array::slice(int start) const
+PassRefPtr<Int32Array> Int32Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Int32Array> Int32Array::slice(int start, int end) const
+PassRefPtr<Int32Array> Int32Array::subarray(int start, int end) const
{
- return sliceImpl<Int32Array>(start, end);
+ return subarrayImpl<Int32Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Int32Array.h b/Source/WebCore/html/canvas/Int32Array.h
index 068a677..c657300 100644
--- a/Source/WebCore/html/canvas/Int32Array.h
+++ b/Source/WebCore/html/canvas/Int32Array.h
@@ -37,13 +37,12 @@ public:
static PassRefPtr<Int32Array> create(int* array, unsigned length);
static PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
-#if !COMPILER(RVCT)
- using TypedArrayBase<int>::set;
- using IntegralTypedArrayBase<int>::set;
-#endif
+ // Can’t use "using" here due to a bug in the RVCT compiler.
+ void set(TypedArrayBase<int>* array, unsigned offset, ExceptionCode& ec) { return TypedArrayBase<int>::set(array, offset, ec); }
+ void set(unsigned index, double value) { return IntegralTypedArrayBase<int>::set(index, value); }
- PassRefPtr<Int32Array> slice(int start) const;
- PassRefPtr<Int32Array> slice(int start, int end) const;
+ PassRefPtr<Int32Array> subarray(int start) const;
+ PassRefPtr<Int32Array> subarray(int start, int end) const;
private:
Int32Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Int32Array.idl b/Source/WebCore/html/canvas/Int32Array.idl
index f96b53c..dd9082a 100644
--- a/Source/WebCore/html/canvas/Int32Array.idl
+++ b/Source/WebCore/html/canvas/Int32Array.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -40,7 +39,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 4;
readonly attribute unsigned long length;
- Int32Array slice(in long start, in [Optional] long end);
+ Int32Array subarray(in long start, in [Optional] long end);
// void set(in Int32Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/Int8Array.cpp b/Source/WebCore/html/canvas/Int8Array.cpp
index 89ed316..ceb7579 100644
--- a/Source/WebCore/html/canvas/Int8Array.cpp
+++ b/Source/WebCore/html/canvas/Int8Array.cpp
@@ -25,9 +25,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Int8Array.h"
namespace WebCore {
@@ -52,16 +49,14 @@ Int8Array::Int8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsign
{
}
-PassRefPtr<Int8Array> Int8Array::slice(int start) const
+PassRefPtr<Int8Array> Int8Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Int8Array> Int8Array::slice(int start, int end) const
+PassRefPtr<Int8Array> Int8Array::subarray(int start, int end) const
{
- return sliceImpl<Int8Array>(start, end);
+ return subarrayImpl<Int8Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Int8Array.h b/Source/WebCore/html/canvas/Int8Array.h
index a5df302..aabdb97 100644
--- a/Source/WebCore/html/canvas/Int8Array.h
+++ b/Source/WebCore/html/canvas/Int8Array.h
@@ -39,11 +39,12 @@ public:
static PassRefPtr<Int8Array> create(signed char* array, unsigned length);
static PassRefPtr<Int8Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
- using TypedArrayBase<signed char>::set;
- using IntegralTypedArrayBase<signed char>::set;
+ // Can’t use "using" here due to a bug in the RVCT compiler.
+ void set(TypedArrayBase<signed char>* array, unsigned offset, ExceptionCode& ec) { return TypedArrayBase<signed char>::set(array, offset, ec); }
+ void set(unsigned index, double value) { return IntegralTypedArrayBase<signed char>::set(index, value); }
- PassRefPtr<Int8Array> slice(int start) const;
- PassRefPtr<Int8Array> slice(int start, int end) const;
+ PassRefPtr<Int8Array> subarray(int start) const;
+ PassRefPtr<Int8Array> subarray(int start, int end) const;
private:
Int8Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Int8Array.idl b/Source/WebCore/html/canvas/Int8Array.idl
index 08a608b..ab000f2 100644
--- a/Source/WebCore/html/canvas/Int8Array.idl
+++ b/Source/WebCore/html/canvas/Int8Array.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -40,7 +39,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 1;
readonly attribute unsigned long length;
- Int8Array slice(in long start, in [Optional] long end);
+ Int8Array subarray(in long start, in [Optional] long end);
// void set(in Int8Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.cpp b/Source/WebCore/html/canvas/OESStandardDerivatives.cpp
index 25aae2f..5bd3163 100644
--- a/Source/WebCore/html/canvas/OESStandardDerivatives.cpp
+++ b/Source/WebCore/html/canvas/OESStandardDerivatives.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "OESStandardDerivatives.h"
@@ -51,4 +51,4 @@ PassRefPtr<OESStandardDerivatives> OESStandardDerivatives::create()
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.idl b/Source/WebCore/html/canvas/OESStandardDerivatives.idl
index a9d1dd6..6c0f788 100644
--- a/Source/WebCore/html/canvas/OESStandardDerivatives.idl
+++ b/Source/WebCore/html/canvas/OESStandardDerivatives.idl
@@ -24,7 +24,7 @@
*/
module html {
- interface [Conditional=3D_CANVAS, OmitConstructor, DontCheckEnums] OESStandardDerivatives {
+ interface [Conditional=WEBGL, OmitConstructor, DontCheckEnums] OESStandardDerivatives {
const unsigned int FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
};
}
diff --git a/Source/WebCore/html/canvas/OESTextureFloat.cpp b/Source/WebCore/html/canvas/OESTextureFloat.cpp
index dab3caf..9518764 100644
--- a/Source/WebCore/html/canvas/OESTextureFloat.cpp
+++ b/Source/WebCore/html/canvas/OESTextureFloat.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "OESTextureFloat.h"
@@ -51,4 +51,4 @@ PassRefPtr<OESTextureFloat> OESTextureFloat::create()
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/OESTextureFloat.idl b/Source/WebCore/html/canvas/OESTextureFloat.idl
index e255875..3319fd9 100644
--- a/Source/WebCore/html/canvas/OESTextureFloat.idl
+++ b/Source/WebCore/html/canvas/OESTextureFloat.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS, OmitConstructor] OESTextureFloat {
+ interface [Conditional=WEBGL, OmitConstructor] OESTextureFloat {
};
}
diff --git a/Source/WebCore/html/canvas/TypedArrayBase.h b/Source/WebCore/html/canvas/TypedArrayBase.h
index a828620..e2a7c63 100644
--- a/Source/WebCore/html/canvas/TypedArrayBase.h
+++ b/Source/WebCore/html/canvas/TypedArrayBase.h
@@ -104,7 +104,7 @@ protected:
}
template <class Subclass>
- PassRefPtr<Subclass> sliceImpl(int start, int end) const
+ PassRefPtr<Subclass> subarrayImpl(int start, int end) const
{
unsigned offset, length;
calculateOffsetAndLength(start, end, m_length, &offset, &length);
diff --git a/Source/WebCore/html/canvas/Uint16Array.cpp b/Source/WebCore/html/canvas/Uint16Array.cpp
index 5312888..92b2361 100644
--- a/Source/WebCore/html/canvas/Uint16Array.cpp
+++ b/Source/WebCore/html/canvas/Uint16Array.cpp
@@ -25,9 +25,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Uint16Array.h"
namespace WebCore {
@@ -52,16 +49,14 @@ Uint16Array::Uint16Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, un
{
}
-PassRefPtr<Uint16Array> Uint16Array::slice(int start) const
+PassRefPtr<Uint16Array> Uint16Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Uint16Array> Uint16Array::slice(int start, int end) const
+PassRefPtr<Uint16Array> Uint16Array::subarray(int start, int end) const
{
- return sliceImpl<Uint16Array>(start, end);
+ return subarrayImpl<Uint16Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Uint16Array.h b/Source/WebCore/html/canvas/Uint16Array.h
index f63b67d..8ef04a4 100644
--- a/Source/WebCore/html/canvas/Uint16Array.h
+++ b/Source/WebCore/html/canvas/Uint16Array.h
@@ -39,11 +39,12 @@ public:
static PassRefPtr<Uint16Array> create(unsigned short* array, unsigned length);
static PassRefPtr<Uint16Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
- using TypedArrayBase<unsigned short>::set;
- using IntegralTypedArrayBase<unsigned short>::set;
+ // Can’t use "using" here due to a bug in the RVCT compiler.
+ void set(TypedArrayBase<unsigned short>* array, unsigned offset, ExceptionCode& ec) { return TypedArrayBase<unsigned short>::set(array, offset, ec); }
+ void set(unsigned index, double value) { return IntegralTypedArrayBase<unsigned short>::set(index, value); }
- PassRefPtr<Uint16Array> slice(int start) const;
- PassRefPtr<Uint16Array> slice(int start, int end) const;
+ PassRefPtr<Uint16Array> subarray(int start) const;
+ PassRefPtr<Uint16Array> subarray(int start, int end) const;
private:
Uint16Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Uint16Array.idl b/Source/WebCore/html/canvas/Uint16Array.idl
index 8e778b4..fc8775d 100644
--- a/Source/WebCore/html/canvas/Uint16Array.idl
+++ b/Source/WebCore/html/canvas/Uint16Array.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -40,7 +39,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 2;
readonly attribute unsigned long length;
- Uint16Array slice(in long start, in [Optional] long end);
+ Uint16Array subarray(in long start, in [Optional] long end);
// void set(in Uint16Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/Uint32Array.cpp b/Source/WebCore/html/canvas/Uint32Array.cpp
index f5bd959..621b53c 100644
--- a/Source/WebCore/html/canvas/Uint32Array.cpp
+++ b/Source/WebCore/html/canvas/Uint32Array.cpp
@@ -25,9 +25,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Uint32Array.h"
namespace WebCore {
@@ -52,16 +49,14 @@ Uint32Array::Uint32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, un
{
}
-PassRefPtr<Uint32Array> Uint32Array::slice(int start) const
+PassRefPtr<Uint32Array> Uint32Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Uint32Array> Uint32Array::slice(int start, int end) const
+PassRefPtr<Uint32Array> Uint32Array::subarray(int start, int end) const
{
- return sliceImpl<Uint32Array>(start, end);
+ return subarrayImpl<Uint32Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Uint32Array.h b/Source/WebCore/html/canvas/Uint32Array.h
index 9c0f137..196a67f 100644
--- a/Source/WebCore/html/canvas/Uint32Array.h
+++ b/Source/WebCore/html/canvas/Uint32Array.h
@@ -39,11 +39,12 @@ public:
static PassRefPtr<Uint32Array> create(unsigned int* array, unsigned length);
static PassRefPtr<Uint32Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
- using TypedArrayBase<unsigned int>::set;
- using IntegralTypedArrayBase<unsigned int>::set;
+ // Can’t use "using" here due to a bug in the RVCT compiler.
+ void set(TypedArrayBase<unsigned int>* array, unsigned offset, ExceptionCode& ec) { return TypedArrayBase<unsigned int>::set(array, offset, ec); }
+ void set(unsigned index, double value) { return IntegralTypedArrayBase<unsigned int>::set(index, value); }
- PassRefPtr<Uint32Array> slice(int start) const;
- PassRefPtr<Uint32Array> slice(int start, int end) const;
+ PassRefPtr<Uint32Array> subarray(int start) const;
+ PassRefPtr<Uint32Array> subarray(int start, int end) const;
private:
Uint32Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Uint32Array.idl b/Source/WebCore/html/canvas/Uint32Array.idl
index 9fbf30c..4d95eab 100644
--- a/Source/WebCore/html/canvas/Uint32Array.idl
+++ b/Source/WebCore/html/canvas/Uint32Array.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -40,7 +39,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 4;
readonly attribute unsigned long length;
- Uint32Array slice(in long start, in [Optional] long end);
+ Uint32Array subarray(in long start, in [Optional] long end);
// void set(in Uint32Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/Uint8Array.cpp b/Source/WebCore/html/canvas/Uint8Array.cpp
index 99b8a09..572e7ec 100644
--- a/Source/WebCore/html/canvas/Uint8Array.cpp
+++ b/Source/WebCore/html/canvas/Uint8Array.cpp
@@ -25,9 +25,6 @@
*/
#include "config.h"
-
-#if ENABLE(3D_CANVAS) || ENABLE(BLOB)
-
#include "Uint8Array.h"
namespace WebCore {
@@ -52,16 +49,14 @@ Uint8Array::Uint8Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsi
{
}
-PassRefPtr<Uint8Array> Uint8Array::slice(int start) const
+PassRefPtr<Uint8Array> Uint8Array::subarray(int start) const
{
- return slice(start, length());
+ return subarray(start, length());
}
-PassRefPtr<Uint8Array> Uint8Array::slice(int start, int end) const
+PassRefPtr<Uint8Array> Uint8Array::subarray(int start, int end) const
{
- return sliceImpl<Uint8Array>(start, end);
+ return subarrayImpl<Uint8Array>(start, end);
}
}
-
-#endif // ENABLE(3D_CANVAS) || ENABLE(BLOB)
diff --git a/Source/WebCore/html/canvas/Uint8Array.h b/Source/WebCore/html/canvas/Uint8Array.h
index 66154b5..a3a42dc 100644
--- a/Source/WebCore/html/canvas/Uint8Array.h
+++ b/Source/WebCore/html/canvas/Uint8Array.h
@@ -39,13 +39,12 @@ public:
static PassRefPtr<Uint8Array> create(unsigned char* array, unsigned length);
static PassRefPtr<Uint8Array> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length);
-#if !COMPILER(RVCT)
- using TypedArrayBase<unsigned char>::set;
- using IntegralTypedArrayBase<unsigned char>::set;
-#endif
+ // Can’t use "using" here due to a bug in the RVCT compiler.
+ void set(TypedArrayBase<unsigned char>* array, unsigned offset, ExceptionCode& ec) { return TypedArrayBase<unsigned char>::set(array, offset, ec); }
+ void set(unsigned index, double value) { return IntegralTypedArrayBase<unsigned char>::set(index, value); }
- PassRefPtr<Uint8Array> slice(int start) const;
- PassRefPtr<Uint8Array> slice(int start, int end) const;
+ PassRefPtr<Uint8Array> subarray(int start) const;
+ PassRefPtr<Uint8Array> subarray(int start, int end) const;
private:
Uint8Array(PassRefPtr<ArrayBuffer> buffer,
diff --git a/Source/WebCore/html/canvas/Uint8Array.idl b/Source/WebCore/html/canvas/Uint8Array.idl
index 7fe7e21..1bdd299 100644
--- a/Source/WebCore/html/canvas/Uint8Array.idl
+++ b/Source/WebCore/html/canvas/Uint8Array.idl
@@ -26,7 +26,6 @@
module html {
interface [
- Conditional=3D_CANVAS|BLOB,
CanBeConstructed,
CustomConstructFunction,
V8CustomConstructor,
@@ -40,7 +39,7 @@ module html {
const unsigned int BYTES_PER_ELEMENT = 1;
readonly attribute unsigned long length;
- Uint8Array slice(in long start, in [Optional] long end);
+ Uint8Array subarray(in long start, in [Optional] long end);
// void set(in Uint8Array array, [Optional] in unsigned long offset);
// void set(in sequence<long> array, [Optional] in unsigned long offset);
diff --git a/Source/WebCore/html/canvas/WebGLActiveInfo.idl b/Source/WebCore/html/canvas/WebGLActiveInfo.idl
index 28f7136..d544970 100644
--- a/Source/WebCore/html/canvas/WebGLActiveInfo.idl
+++ b/Source/WebCore/html/canvas/WebGLActiveInfo.idl
@@ -26,7 +26,7 @@
module html {
interface [
- Conditional=3D_CANVAS
+ Conditional=WEBGL
] WebGLActiveInfo {
readonly attribute int size;
readonly attribute unsigned int type;
diff --git a/Source/WebCore/html/canvas/WebGLBuffer.cpp b/Source/WebCore/html/canvas/WebGLBuffer.cpp
index 849472b..ee0ebe6 100644
--- a/Source/WebCore/html/canvas/WebGLBuffer.cpp
+++ b/Source/WebCore/html/canvas/WebGLBuffer.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLBuffer.h"
@@ -34,7 +34,7 @@
#include "WebGLRenderingContext.h"
namespace WebCore {
-
+
PassRefPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContext* ctx)
{
return adoptRef(new WebGLBuffer(ctx));
@@ -207,4 +207,4 @@ void WebGLBuffer::clearCachedMaxIndices()
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLBuffer.h b/Source/WebCore/html/canvas/WebGLBuffer.h
index ec79a2d..6153cf1 100644
--- a/Source/WebCore/html/canvas/WebGLBuffer.h
+++ b/Source/WebCore/html/canvas/WebGLBuffer.h
@@ -42,10 +42,10 @@ public:
static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*);
bool associateBufferData(GC3Dsizeiptr size);
- bool associateBufferData(ArrayBuffer* array);
- bool associateBufferData(ArrayBufferView* array);
- bool associateBufferSubData(GC3Dintptr offset, ArrayBuffer* array);
- bool associateBufferSubData(GC3Dintptr offset, ArrayBufferView* array);
+ bool associateBufferData(ArrayBuffer*);
+ bool associateBufferData(ArrayBufferView*);
+ bool associateBufferSubData(GC3Dintptr offset, ArrayBuffer*);
+ bool associateBufferSubData(GC3Dintptr offset, ArrayBufferView*);
GC3Dsizeiptr byteLength() const;
const ArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); }
diff --git a/Source/WebCore/html/canvas/WebGLBuffer.idl b/Source/WebCore/html/canvas/WebGLBuffer.idl
index 30b7606..2b6daec 100644
--- a/Source/WebCore/html/canvas/WebGLBuffer.idl
+++ b/Source/WebCore/html/canvas/WebGLBuffer.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLBuffer {
+ interface [Conditional=WEBGL] WebGLBuffer {
};
}
diff --git a/Source/WebCore/html/canvas/WebGLContextAttributes.cpp b/Source/WebCore/html/canvas/WebGLContextAttributes.cpp
index a0725ca..6a47ea9 100644
--- a/Source/WebCore/html/canvas/WebGLContextAttributes.cpp
+++ b/Source/WebCore/html/canvas/WebGLContextAttributes.cpp
@@ -26,7 +26,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLContextAttributes.h"
@@ -114,4 +114,4 @@ GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLContextAttributes.idl b/Source/WebCore/html/canvas/WebGLContextAttributes.idl
index be2b20c..0fa0c2c 100644
--- a/Source/WebCore/html/canvas/WebGLContextAttributes.idl
+++ b/Source/WebCore/html/canvas/WebGLContextAttributes.idl
@@ -26,7 +26,7 @@
module html {
interface [
- Conditional=3D_CANVAS,
+ Conditional=WEBGL,
OmitConstructor
] WebGLContextAttributes {
attribute boolean alpha;
diff --git a/Source/WebCore/html/canvas/WebGLContextEvent.idl b/Source/WebCore/html/canvas/WebGLContextEvent.idl
index 30973a9..9ee4769 100644
--- a/Source/WebCore/html/canvas/WebGLContextEvent.idl
+++ b/Source/WebCore/html/canvas/WebGLContextEvent.idl
@@ -25,7 +25,7 @@
module html {
interface [
- Conditional=3D_CANVAS,
+ Conditional=WEBGL,
] WebGLContextEvent : Event {
readonly attribute DOMString statusMessage;
[StrictTypeChecking] void initEvent(in DOMString eventTypeArg,
diff --git a/Source/WebCore/html/canvas/WebGLExtension.cpp b/Source/WebCore/html/canvas/WebGLExtension.cpp
index 580e635..64b0bf5 100644
--- a/Source/WebCore/html/canvas/WebGLExtension.cpp
+++ b/Source/WebCore/html/canvas/WebGLExtension.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLExtension.h"
@@ -41,4 +41,4 @@ WebGLExtension::~WebGLExtension()
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
index dbc714b..4b721eb 100644
--- a/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
+++ b/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLFramebuffer.h"
@@ -354,4 +354,4 @@ bool WebGLFramebuffer::initializeRenderbuffers()
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLFramebuffer.idl b/Source/WebCore/html/canvas/WebGLFramebuffer.idl
index 8c1d9fd..7211d15 100644
--- a/Source/WebCore/html/canvas/WebGLFramebuffer.idl
+++ b/Source/WebCore/html/canvas/WebGLFramebuffer.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLFramebuffer {
+ interface [Conditional=WEBGL] WebGLFramebuffer {
};
}
diff --git a/Source/WebCore/html/canvas/WebGLGetInfo.cpp b/Source/WebCore/html/canvas/WebGLGetInfo.cpp
index 6aff82f..d0c8c65 100644
--- a/Source/WebCore/html/canvas/WebGLGetInfo.cpp
+++ b/Source/WebCore/html/canvas/WebGLGetInfo.cpp
@@ -26,7 +26,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLGetInfo.h"
@@ -63,9 +63,9 @@ WebGLGetInfo::WebGLGetInfo(float value)
{
}
-WebGLGetInfo::WebGLGetInfo(long value)
- : m_type(kTypeLong)
- , m_long(value)
+WebGLGetInfo::WebGLGetInfo(int value)
+ : m_type(kTypeInt)
+ , m_int(value)
{
}
@@ -80,9 +80,9 @@ WebGLGetInfo::WebGLGetInfo(const String& value)
{
}
-WebGLGetInfo::WebGLGetInfo(unsigned long value)
- : m_type(kTypeUnsignedLong)
- , m_unsignedLong(value)
+WebGLGetInfo::WebGLGetInfo(unsigned int value)
+ : m_type(kTypeUnsignedInt)
+ , m_unsignedInt(value)
{
}
@@ -161,10 +161,10 @@ float WebGLGetInfo::getFloat() const
return m_float;
}
-long WebGLGetInfo::getLong() const
+int WebGLGetInfo::getInt() const
{
- ASSERT(getType() == kTypeLong);
- return m_long;
+ ASSERT(getType() == kTypeInt);
+ return m_int;
}
const String& WebGLGetInfo::getString() const
@@ -173,10 +173,10 @@ const String& WebGLGetInfo::getString() const
return m_string;
}
-unsigned long WebGLGetInfo::getUnsignedLong() const
+unsigned int WebGLGetInfo::getUnsignedInt() const
{
- ASSERT(getType() == kTypeUnsignedLong);
- return m_unsignedLong;
+ ASSERT(getType() == kTypeUnsignedInt);
+ return m_unsignedInt;
}
PassRefPtr<WebGLBuffer> WebGLGetInfo::getWebGLBuffer() const
@@ -229,4 +229,4 @@ PassRefPtr<Uint8Array> WebGLGetInfo::getWebGLUnsignedByteArray() const
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLGetInfo.h b/Source/WebCore/html/canvas/WebGLGetInfo.h
index caee520..91f9233 100644
--- a/Source/WebCore/html/canvas/WebGLGetInfo.h
+++ b/Source/WebCore/html/canvas/WebGLGetInfo.h
@@ -53,10 +53,10 @@ public:
kTypeBool,
kTypeBoolArray,
kTypeFloat,
- kTypeLong,
+ kTypeInt,
kTypeNull,
kTypeString,
- kTypeUnsignedLong,
+ kTypeUnsignedInt,
kTypeWebGLBuffer,
kTypeWebGLFloatArray,
kTypeWebGLFramebuffer,
@@ -71,11 +71,11 @@ public:
WebGLGetInfo(bool value);
WebGLGetInfo(const bool* value, int size);
WebGLGetInfo(float value);
- WebGLGetInfo(long value);
+ WebGLGetInfo(int value);
// Represents the null value and type.
WebGLGetInfo();
WebGLGetInfo(const String& value);
- WebGLGetInfo(unsigned long value);
+ WebGLGetInfo(unsigned int value);
WebGLGetInfo(PassRefPtr<WebGLBuffer> value);
WebGLGetInfo(PassRefPtr<Float32Array> value);
WebGLGetInfo(PassRefPtr<WebGLFramebuffer> value);
@@ -94,9 +94,9 @@ public:
bool getBool() const;
const Vector<bool>& getBoolArray() const;
float getFloat() const;
- long getLong() const;
+ int getInt() const;
const String& getString() const;
- unsigned long getUnsignedLong() const;
+ unsigned int getUnsignedInt() const;
PassRefPtr<WebGLBuffer> getWebGLBuffer() const;
PassRefPtr<Float32Array> getWebGLFloatArray() const;
PassRefPtr<WebGLFramebuffer> getWebGLFramebuffer() const;
@@ -113,9 +113,9 @@ private:
bool m_bool;
Vector<bool> m_boolArray;
float m_float;
- long m_long;
+ int m_int;
String m_string;
- unsigned long m_unsignedLong;
+ unsigned int m_unsignedInt;
RefPtr<WebGLBuffer> m_webglBuffer;
RefPtr<Float32Array> m_webglFloatArray;
RefPtr<WebGLFramebuffer> m_webglFramebuffer;
diff --git a/Source/WebCore/html/canvas/WebGLObject.cpp b/Source/WebCore/html/canvas/WebGLObject.cpp
index 41ad0f1..d47013e 100644
--- a/Source/WebCore/html/canvas/WebGLObject.cpp
+++ b/Source/WebCore/html/canvas/WebGLObject.cpp
@@ -25,14 +25,14 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLObject.h"
#include "WebGLRenderingContext.h"
namespace WebCore {
-
+
WebGLObject::WebGLObject(WebGLRenderingContext* context)
: m_object(0)
, m_context(context)
@@ -68,4 +68,4 @@ void WebGLObject::deleteObject()
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLProgram.cpp b/Source/WebCore/html/canvas/WebGLProgram.cpp
index b3fa363..d3efda4 100644
--- a/Source/WebCore/html/canvas/WebGLProgram.cpp
+++ b/Source/WebCore/html/canvas/WebGLProgram.cpp
@@ -25,14 +25,14 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLProgram.h"
#include "WebGLRenderingContext.h"
namespace WebCore {
-
+
PassRefPtr<WebGLProgram> WebGLProgram::create(WebGLRenderingContext* ctx)
{
return adoptRef(new WebGLProgram(ctx));
@@ -103,7 +103,7 @@ bool WebGLProgram::isUsingVertexAttrib0() const
return false;
}
-WebGLShader* WebGLProgram::getAttachedShader(GraphicsContext3D::WebGLEnumType type)
+WebGLShader* WebGLProgram::getAttachedShader(GC3Denum type)
{
switch (type) {
case GraphicsContext3D::VERTEX_SHADER:
@@ -157,4 +157,4 @@ bool WebGLProgram::detachShader(WebGLShader* shader)
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLProgram.h b/Source/WebCore/html/canvas/WebGLProgram.h
index f2acef8..0dd3ba0 100644
--- a/Source/WebCore/html/canvas/WebGLProgram.h
+++ b/Source/WebCore/html/canvas/WebGLProgram.h
@@ -60,7 +60,7 @@ public:
// will never be linked so many times.
void increaseLinkCount() { ++m_linkCount; }
- WebGLShader* getAttachedShader(GraphicsContext3D::WebGLEnumType);
+ WebGLShader* getAttachedShader(GC3Denum);
bool attachShader(WebGLShader*);
bool detachShader(WebGLShader*);
diff --git a/Source/WebCore/html/canvas/WebGLProgram.idl b/Source/WebCore/html/canvas/WebGLProgram.idl
index 562fa3a..480dfce 100644
--- a/Source/WebCore/html/canvas/WebGLProgram.idl
+++ b/Source/WebCore/html/canvas/WebGLProgram.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLProgram {
+ interface [Conditional=WEBGL] WebGLProgram {
};
}
diff --git a/Source/WebCore/html/canvas/WebGLRenderbuffer.cpp b/Source/WebCore/html/canvas/WebGLRenderbuffer.cpp
index 03a419a..93b9165 100644
--- a/Source/WebCore/html/canvas/WebGLRenderbuffer.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderbuffer.cpp
@@ -25,14 +25,14 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLRenderbuffer.h"
#include "WebGLRenderingContext.h"
namespace WebCore {
-
+
PassRefPtr<WebGLRenderbuffer> WebGLRenderbuffer::create(WebGLRenderingContext* ctx)
{
return adoptRef(new WebGLRenderbuffer(ctx));
@@ -57,4 +57,4 @@ void WebGLRenderbuffer::deleteObjectImpl(Platform3DObject object)
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLRenderbuffer.idl b/Source/WebCore/html/canvas/WebGLRenderbuffer.idl
index 2524433..5aa7db8 100644
--- a/Source/WebCore/html/canvas/WebGLRenderbuffer.idl
+++ b/Source/WebCore/html/canvas/WebGLRenderbuffer.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLRenderbuffer {
+ interface [Conditional=WEBGL] WebGLRenderbuffer {
};
}
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
index a3b9699..bd155c9 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLRenderingContext.h"
@@ -48,6 +48,7 @@
#include "OESTextureFloat.h"
#include "RenderBox.h"
#include "RenderLayer.h"
+#include "Settings.h"
#include "Uint16Array.h"
#include "WebGLActiveInfo.h"
#include "WebGLBuffer.h"
@@ -341,17 +342,33 @@ void WebGLRenderingContext::WebGLRenderingContextRestoreTimer::fired()
}
}
+class WebGLRenderingContextLostCallback : public GraphicsContext3D::ContextLostCallback {
+public:
+ WebGLRenderingContextLostCallback(WebGLRenderingContext* cb) : m_contextLostCallback(cb) {}
+ virtual void onContextLost() { m_contextLostCallback->forceLostContext(); }
+ virtual ~WebGLRenderingContextLostCallback() {}
+private:
+ WebGLRenderingContext* m_contextLostCallback;
+};
+
PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
{
HostWindow* hostWindow = canvas->document()->view()->root()->hostWindow();
GraphicsContext3D::Attributes attributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
+
+ if (attributes.antialias) {
+ Page* p = canvas->document()->page();
+ if (p && !p->settings()->openGLMultisamplingEnabled())
+ attributes.antialias = false;
+ }
+
RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes, hostWindow));
if (!context) {
canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
return 0;
}
-
+
return new WebGLRenderingContext(canvas, context, attributes);
}
@@ -416,6 +433,8 @@ void WebGLRenderingContext::initializeNewContext()
m_context->reshape(canvas()->width(), canvas()->height());
m_context->viewport(0, 0, canvas()->width(), canvas()->height());
+
+ m_context->setContextLostCallback(adoptPtr(new WebGLRenderingContextLostCallback(this)));
}
void WebGLRenderingContext::setupFlags()
@@ -437,6 +456,7 @@ void WebGLRenderingContext::setupFlags()
WebGLRenderingContext::~WebGLRenderingContext()
{
detachAndRemoveAllObjects();
+ m_context->setContextLostCallback(0);
}
void WebGLRenderingContext::markContextChanged()
@@ -487,7 +507,24 @@ void WebGLRenderingContext::reshape(int width, int height)
unsigned int WebGLRenderingContext::sizeInBytes(GC3Denum type)
{
- return m_context->sizeInBytes(type);
+ switch (type) {
+ case GraphicsContext3D::BYTE:
+ return sizeof(GC3Dbyte);
+ case GraphicsContext3D::UNSIGNED_BYTE:
+ return sizeof(GC3Dubyte);
+ case GraphicsContext3D::SHORT:
+ return sizeof(GC3Dshort);
+ case GraphicsContext3D::UNSIGNED_SHORT:
+ return sizeof(GC3Dushort);
+ case GraphicsContext3D::INT:
+ return sizeof(GC3Dint);
+ case GraphicsContext3D::UNSIGNED_INT:
+ return sizeof(GC3Duint);
+ case GraphicsContext3D::FLOAT:
+ return sizeof(GC3Dfloat);
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
}
void WebGLRenderingContext::activeTexture(GC3Denum texture, ExceptionCode& ec)
@@ -529,20 +566,33 @@ void WebGLRenderingContext::bindAttribLocation(WebGLProgram* program, GC3Duint i
cleanupAfterGraphicsCall(false);
}
+bool WebGLRenderingContext::checkObjectToBeBound(WebGLObject* object, bool& deleted)
+{
+ deleted = false;
+ if (isContextLost())
+ return false;
+ if (object) {
+ if (object->context() != this) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return false;
+ }
+ deleted = !object->object();
+ }
+ return true;
+}
+
void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer, ExceptionCode& ec)
{
UNUSED_PARAM(ec);
- if (isContextLost())
+ bool deleted;
+ if (!checkObjectToBeBound(buffer, deleted))
return;
- if (buffer && buffer->context() != this) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
- return;
- }
+ if (deleted)
+ buffer = 0;
if (buffer && buffer->getTarget() && buffer->getTarget() != target) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
return;
}
-
if (target == GraphicsContext3D::ARRAY_BUFFER)
m_boundArrayBuffer = buffer;
else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER)
@@ -558,16 +608,14 @@ void WebGLRenderingContext::bindBuffer(GC3Denum target, WebGLBuffer* buffer, Exc
cleanupAfterGraphicsCall(false);
}
-
void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* buffer, ExceptionCode& ec)
{
UNUSED_PARAM(ec);
- if (isContextLost())
- return;
- if (buffer && buffer->context() != this) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ bool deleted;
+ if (!checkObjectToBeBound(buffer, deleted))
return;
- }
+ if (deleted)
+ buffer = 0;
if (target != GraphicsContext3D::FRAMEBUFFER) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return;
@@ -582,12 +630,11 @@ void WebGLRenderingContext::bindFramebuffer(GC3Denum target, WebGLFramebuffer* b
void WebGLRenderingContext::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer* renderBuffer, ExceptionCode& ec)
{
UNUSED_PARAM(ec);
- if (isContextLost())
+ bool deleted;
+ if (!checkObjectToBeBound(renderBuffer, deleted))
return;
- if (renderBuffer && renderBuffer->context() != this) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
- return;
- }
+ if (deleted)
+ renderBuffer = 0;
if (target != GraphicsContext3D::RENDERBUFFER) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return;
@@ -599,13 +646,15 @@ void WebGLRenderingContext::bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*
cleanupAfterGraphicsCall(false);
}
-
void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture, ExceptionCode& ec)
{
UNUSED_PARAM(ec);
- if (isContextLost())
+ bool deleted;
+ if (!checkObjectToBeBound(texture, deleted))
return;
- if (texture && texture->context() != this) {
+ if (deleted)
+ texture = 0;
+ if (texture && texture->getTarget() && texture->getTarget() != target) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
return;
}
@@ -667,7 +716,7 @@ void WebGLRenderingContext::blendFunc(GC3Denum sfactor, GC3Denum dfactor)
return;
m_context->blendFunc(sfactor, dfactor);
cleanupAfterGraphicsCall(false);
-}
+}
void WebGLRenderingContext::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha)
{
@@ -685,6 +734,10 @@ void WebGLRenderingContext::bufferData(GC3Denum target, GC3Dsizeiptr size, GC3De
WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
if (!buffer)
return;
+ if (size < 0) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
+ return;
+ }
if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
if (!buffer->associateBufferData(size)) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
@@ -750,6 +803,10 @@ void WebGLRenderingContext::bufferSubData(GC3Denum target, GC3Dintptr offset, Ar
WebGLBuffer* buffer = validateBufferDataParameters(target, GraphicsContext3D::STATIC_DRAW);
if (!buffer)
return;
+ if (offset < 0) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
+ return;
+ }
if (!data)
return;
if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
@@ -771,6 +828,10 @@ void WebGLRenderingContext::bufferSubData(GC3Denum target, GC3Dintptr offset, Ar
WebGLBuffer* buffer = validateBufferDataParameters(target, GraphicsContext3D::STATIC_DRAW);
if (!buffer)
return;
+ if (offset < 0) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
+ return;
+ }
if (!data)
return;
if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
@@ -972,7 +1033,7 @@ PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer()
addObject(o.get());
return o;
}
-
+
PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer()
{
if (isContextLost())
@@ -1018,7 +1079,7 @@ PassRefPtr<WebGLShader> WebGLRenderingContext::createShader(GC3Denum type, Excep
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return 0;
}
-
+
RefPtr<WebGLShader> o = WebGLShader::create(this, type);
addObject(o.get());
return o;
@@ -1032,13 +1093,27 @@ void WebGLRenderingContext::cullFace(GC3Denum mode)
cleanupAfterGraphicsCall(false);
}
+bool WebGLRenderingContext::deleteObject(WebGLObject* object)
+{
+ if (isContextLost() || !object)
+ return false;
+ if (object->context() != this) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return false;
+ }
+ if (object->object())
+ object->deleteObject();
+ return true;
+}
+
void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer)
{
- if (isContextLost() || !buffer)
+ if (!deleteObject(buffer))
return;
-
- buffer->deleteObject();
-
+ if (m_boundArrayBuffer == buffer)
+ m_boundArrayBuffer = 0;
+ if (m_boundElementArrayBuffer == buffer)
+ m_boundElementArrayBuffer = 0;
if (!isGLES2Compliant()) {
VertexAttribState& state = m_vertexAttribState[0];
if (buffer == state.bufferBinding) {
@@ -1056,54 +1131,47 @@ void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer)
void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer)
{
- if (isContextLost() || !framebuffer)
+ if (!deleteObject(framebuffer))
return;
if (framebuffer == m_framebufferBinding) {
m_framebufferBinding = 0;
// Have to call bindFramebuffer here to bind back to internal fbo.
m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0);
}
- framebuffer->deleteObject();
}
void WebGLRenderingContext::deleteProgram(WebGLProgram* program)
{
- if (isContextLost() || !program)
- return;
- if (program->context() != this) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
- return;
- }
- if (!program->object())
- return;
- program->deleteObject();
+ deleteObject(program);
+ // We don't reset m_currentProgram to 0 here because the deletion of the
+ // current program is delayed.
}
void WebGLRenderingContext::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer)
{
- if (isContextLost() || !renderbuffer)
+ if (!deleteObject(renderbuffer))
return;
if (renderbuffer == m_renderbufferBinding)
m_renderbufferBinding = 0;
- renderbuffer->deleteObject();
if (m_framebufferBinding)
m_framebufferBinding->removeAttachment(renderbuffer);
}
void WebGLRenderingContext::deleteShader(WebGLShader* shader)
{
- if (isContextLost() || !shader)
- return;
-
- shader->deleteObject();
+ deleteObject(shader);
}
void WebGLRenderingContext::deleteTexture(WebGLTexture* texture)
{
- if (isContextLost() || !texture)
+ if (!deleteObject(texture))
return;
-
- texture->deleteObject();
+ for (size_t i = 0; i < m_textureUnits.size(); ++i) {
+ if (texture == m_textureUnits[i].m_texture2DBinding)
+ m_textureUnits[i].m_texture2DBinding = 0;
+ if (texture == m_textureUnits[i].m_textureCubeMapBinding)
+ m_textureUnits[i].m_textureCubeMapBinding = 0;
+ }
if (m_framebufferBinding)
m_framebufferBinding->removeAttachment(texture);
}
@@ -1150,7 +1218,6 @@ void WebGLRenderingContext::detachShader(WebGLProgram* program, WebGLShader* sha
cleanupAfterGraphicsCall(false);
}
-
void WebGLRenderingContext::disable(GC3Denum cap)
{
if (isContextLost() || !validateCapability(cap))
@@ -1168,7 +1235,7 @@ void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index, ExceptionCo
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
return;
}
-
+
if (index < m_vertexAttribState.size())
m_vertexAttribState[index].enabled = false;
@@ -1291,8 +1358,8 @@ bool WebGLRenderingContext::validateIndexArrayPrecise(GC3Dsizei count, GC3Denum
lastIndex = *p;
++p;
}
- }
-
+ }
+
// Then set the last index in the index array and make sure it is valid.
numElementsRequired = lastIndex + 1;
return numElementsRequired > 0;
@@ -1336,10 +1403,10 @@ bool WebGLRenderingContext::validateRenderingState(int numElementsRequired)
}
}
}
-
+
if (smallestNumElements == INT_MAX)
smallestNumElements = 0;
-
+
return numElementsRequired <= smallestNumElements;
}
@@ -1435,6 +1502,11 @@ void WebGLRenderingContext::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denu
if (!count)
return;
+ if (!m_boundElementArrayBuffer) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return;
+ }
+
int numElements = 0;
if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
// Ensure we have a valid rendering state
@@ -1495,12 +1567,12 @@ void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index, ExceptionCod
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
return;
}
-
+
if (index >= m_vertexAttribState.size())
m_vertexAttribState.resize(index + 1);
-
+
m_vertexAttribState[index].enabled = true;
-
+
m_context->enableVertexAttribArray(index);
cleanupAfterGraphicsCall(false);
}
@@ -1513,7 +1585,6 @@ void WebGLRenderingContext::finish()
cleanupAfterGraphicsCall(true);
}
-
void WebGLRenderingContext::flush()
{
if (isContextLost())
@@ -1689,7 +1760,7 @@ bool WebGLRenderingContext::getAttachedShaders(WebGLProgram* program, Vector<Web
GC3Dint numShaders = 0;
m_context->getProgramiv(objectOrZero(program), GraphicsContext3D::ATTACHED_SHADERS, &numShaders);
if (numShaders) {
- OwnArrayPtr<Platform3DObject> shaders(new Platform3DObject[numShaders]);
+ OwnArrayPtr<Platform3DObject> shaders = adoptArrayPtr(new Platform3DObject[numShaders]);
GC3Dsizei count = 0;
m_context->getAttachedShaders(objectOrZero(program), numShaders, &count, shaders.get());
if (count != numShaders)
@@ -1735,8 +1806,8 @@ WebGLGetInfo WebGLRenderingContext::getBufferParameter(GC3Denum target, GC3Denum
GC3Dint value = 0;
m_context->getBufferParameteriv(target, pname, &value);
if (pname == GraphicsContext3D::BUFFER_SIZE)
- return WebGLGetInfo(static_cast<long>(value));
- return WebGLGetInfo(static_cast<unsigned long>(value));
+ return WebGLGetInfo(value);
+ return WebGLGetInfo(static_cast<unsigned int>(value));
}
PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
@@ -1809,8 +1880,8 @@ WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(GC3Denum t
GC3Dint value = 0;
m_context->getFramebufferAttachmentParameteriv(target, attachment, pname, &value);
if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
- return WebGLGetInfo(static_cast<unsigned long>(value));
- return WebGLGetInfo(static_cast<long>(value));
+ return WebGLGetInfo(static_cast<unsigned int>(value));
+ return WebGLGetInfo(value);
}
WebGLStateRestorer(this, false);
@@ -1839,13 +1910,13 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
WebGLStateRestorer(this, false);
switch (pname) {
case GraphicsContext3D::ACTIVE_TEXTURE:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::ALIASED_LINE_WIDTH_RANGE:
return getWebGLFloatArrayParameter(pname);
case GraphicsContext3D::ALIASED_POINT_SIZE_RANGE:
return getWebGLFloatArrayParameter(pname);
case GraphicsContext3D::ALPHA_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::ARRAY_BUFFER_BINDING:
return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundArrayBuffer));
case GraphicsContext3D::BLEND:
@@ -1853,19 +1924,19 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
case GraphicsContext3D::BLEND_COLOR:
return getWebGLFloatArrayParameter(pname);
case GraphicsContext3D::BLEND_DST_ALPHA:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::BLEND_DST_RGB:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::BLEND_EQUATION_ALPHA:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::BLEND_EQUATION_RGB:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::BLEND_SRC_ALPHA:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::BLEND_SRC_RGB:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::BLUE_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::COLOR_CLEAR_VALUE:
return getWebGLFloatArrayParameter(pname);
case GraphicsContext3D::COLOR_WRITEMASK:
@@ -1876,15 +1947,15 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
case GraphicsContext3D::CULL_FACE:
return getBooleanParameter(pname);
case GraphicsContext3D::CULL_FACE_MODE:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::CURRENT_PROGRAM:
return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram));
case GraphicsContext3D::DEPTH_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::DEPTH_CLEAR_VALUE:
return getFloatParameter(pname);
case GraphicsContext3D::DEPTH_FUNC:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::DEPTH_RANGE:
return getWebGLFloatArrayParameter(pname);
case GraphicsContext3D::DEPTH_TEST:
@@ -1898,43 +1969,43 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
case GraphicsContext3D::FRAMEBUFFER_BINDING:
return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding));
case GraphicsContext3D::FRONT_FACE:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::GENERATE_MIPMAP_HINT:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::GREEN_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::LINE_WIDTH:
return getFloatParameter(pname);
case GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_RENDERBUFFER_SIZE:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_TEXTURE_SIZE:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_VARYING_VECTORS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_VERTEX_ATTRIBS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::MAX_VIEWPORT_DIMS:
return getWebGLIntArrayParameter(pname);
case GraphicsContext3D::NUM_COMPRESSED_TEXTURE_FORMATS:
// WebGL 1.0 specifies that there are no compressed texture formats.
- return WebGLGetInfo(static_cast<long>(0));
+ return WebGLGetInfo(static_cast<int>(0));
case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS:
// FIXME: should we always return 0 for this?
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::PACK_ALIGNMENT:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::POLYGON_OFFSET_FACTOR:
return getFloatParameter(pname);
case GraphicsContext3D::POLYGON_OFFSET_FILL:
@@ -1942,19 +2013,19 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
case GraphicsContext3D::POLYGON_OFFSET_UNITS:
return getFloatParameter(pname);
case GraphicsContext3D::RED_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::RENDERBUFFER_BINDING:
return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding));
case GraphicsContext3D::RENDERER:
return WebGLGetInfo(m_context->getString(GraphicsContext3D::RENDERER));
case GraphicsContext3D::SAMPLE_BUFFERS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::SAMPLE_COVERAGE_INVERT:
return getBooleanParameter(pname);
case GraphicsContext3D::SAMPLE_COVERAGE_VALUE:
return getFloatParameter(pname);
case GraphicsContext3D::SAMPLES:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::SCISSOR_BOX:
return getWebGLIntArrayParameter(pname);
case GraphicsContext3D::SCISSOR_TEST:
@@ -1962,54 +2033,53 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
case GraphicsContext3D::SHADING_LANGUAGE_VERSION:
return WebGLGetInfo("WebGL GLSL ES 1.0 (" + m_context->getString(GraphicsContext3D::SHADING_LANGUAGE_VERSION) + ")");
case GraphicsContext3D::STENCIL_BACK_FAIL:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_BACK_FUNC:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_FAIL:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_BACK_PASS_DEPTH_PASS:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_BACK_REF:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::STENCIL_BACK_VALUE_MASK:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_BACK_WRITEMASK:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::STENCIL_CLEAR_VALUE:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::STENCIL_FAIL:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_FUNC:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_PASS_DEPTH_FAIL:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_PASS_DEPTH_PASS:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_REF:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::STENCIL_TEST:
return getBooleanParameter(pname);
case GraphicsContext3D::STENCIL_VALUE_MASK:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::STENCIL_WRITEMASK:
- return getUnsignedLongParameter(pname);
+ return getUnsignedIntParameter(pname);
case GraphicsContext3D::SUBPIXEL_BITS:
- return getLongParameter(pname);
+ return getIntParameter(pname);
case GraphicsContext3D::TEXTURE_BINDING_2D:
return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_texture2DBinding));
case GraphicsContext3D::TEXTURE_BINDING_CUBE_MAP:
return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding));
case GraphicsContext3D::UNPACK_ALIGNMENT:
- // FIXME: should this be "long" in the spec?
return getIntParameter(pname);
case GraphicsContext3D::UNPACK_FLIP_Y_WEBGL:
return WebGLGetInfo(m_unpackFlipY);
case GraphicsContext3D::UNPACK_PREMULTIPLY_ALPHA_WEBGL:
return WebGLGetInfo(m_unpackPremultiplyAlpha);
case GraphicsContext3D::UNPACK_COLORSPACE_CONVERSION_WEBGL:
- return WebGLGetInfo(static_cast<unsigned long>(m_unpackColorspaceConversion));
+ return WebGLGetInfo(m_unpackColorspaceConversion);
case GraphicsContext3D::VENDOR:
return WebGLGetInfo("Webkit (" + m_context->getString(GraphicsContext3D::VENDOR) + ")");
case GraphicsContext3D::VERSION:
@@ -2018,7 +2088,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode&
return getWebGLIntArrayParameter(pname);
case Extensions3D::FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives
if (m_oesStandardDerivatives)
- return getUnsignedLongParameter(Extensions3D::FRAGMENT_SHADER_DERIVATIVE_HINT_OES);
+ return getUnsignedIntParameter(Extensions3D::FRAGMENT_SHADER_DERIVATIVE_HINT_OES);
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
default:
@@ -2043,14 +2113,11 @@ WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, G
return WebGLGetInfo(static_cast<bool>(value));
case GraphicsContext3D::LINK_STATUS:
return WebGLGetInfo(program->getLinkStatus());
- case GraphicsContext3D::INFO_LOG_LENGTH:
case GraphicsContext3D::ATTACHED_SHADERS:
case GraphicsContext3D::ACTIVE_ATTRIBUTES:
- case GraphicsContext3D::ACTIVE_ATTRIBUTE_MAX_LENGTH:
case GraphicsContext3D::ACTIVE_UNIFORMS:
- case GraphicsContext3D::ACTIVE_UNIFORM_MAX_LENGTH:
m_context->getProgramiv(objectOrZero(program), pname, &value);
- return WebGLGetInfo(static_cast<long>(value));
+ return WebGLGetInfo(value);
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
@@ -2085,13 +2152,13 @@ WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC
if (m_renderbufferBinding->getInternalFormat() == GraphicsContext3D::DEPTH_STENCIL
&& !m_renderbufferBinding->isValid()) {
ASSERT(!isDepthStencilSupported());
- long value = 0;
+ int value = 0;
switch (pname) {
case GraphicsContext3D::RENDERBUFFER_WIDTH:
- value = static_cast<long>(m_renderbufferBinding->getWidth());
+ value = m_renderbufferBinding->getWidth();
break;
case GraphicsContext3D::RENDERBUFFER_HEIGHT:
- value = static_cast<long>(m_renderbufferBinding->getHeight());
+ value = m_renderbufferBinding->getHeight();
break;
case GraphicsContext3D::RENDERBUFFER_RED_SIZE:
case GraphicsContext3D::RENDERBUFFER_GREEN_SIZE:
@@ -2106,7 +2173,7 @@ WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC
value = 8;
break;
case GraphicsContext3D::RENDERBUFFER_INTERNAL_FORMAT:
- return WebGLGetInfo(static_cast<unsigned long>(m_renderbufferBinding->getInternalFormat()));
+ return WebGLGetInfo(m_renderbufferBinding->getInternalFormat());
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
@@ -2126,9 +2193,9 @@ WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC
case GraphicsContext3D::RENDERBUFFER_DEPTH_SIZE:
case GraphicsContext3D::RENDERBUFFER_STENCIL_SIZE:
m_context->getRenderbufferParameteriv(target, pname, &value);
- return WebGLGetInfo(static_cast<long>(value));
+ return WebGLGetInfo(value);
case GraphicsContext3D::RENDERBUFFER_INTERNAL_FORMAT:
- return WebGLGetInfo(static_cast<unsigned long>(m_renderbufferBinding->getInternalFormat()));
+ return WebGLGetInfo(m_renderbufferBinding->getInternalFormat());
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
@@ -2150,11 +2217,7 @@ WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3D
return WebGLGetInfo(static_cast<bool>(value));
case GraphicsContext3D::SHADER_TYPE:
m_context->getShaderiv(objectOrZero(shader), pname, &value);
- return WebGLGetInfo(static_cast<unsigned long>(value));
- case GraphicsContext3D::INFO_LOG_LENGTH:
- case GraphicsContext3D::SHADER_SOURCE_LENGTH:
- m_context->getShaderiv(objectOrZero(shader), pname, &value);
- return WebGLGetInfo(static_cast<long>(value));
+ return WebGLGetInfo(static_cast<unsigned int>(value));
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
@@ -2179,8 +2242,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode
return String();
if (!validateWebGLObject(shader))
return "";
- WebGLStateRestorer(this, false);
- return m_context->getShaderSource(objectOrZero(shader));
+ return shader->getSource();
}
Vector<String> WebGLRenderingContext::getSupportedExtensions()
@@ -2210,7 +2272,7 @@ WebGLGetInfo WebGLRenderingContext::getTexParameter(GC3Denum target, GC3Denum pn
case GraphicsContext3D::TEXTURE_WRAP_S:
case GraphicsContext3D::TEXTURE_WRAP_T:
m_context->getTexParameteriv(target, pname, &value);
- return WebGLGetInfo(static_cast<unsigned long>(value));
+ return WebGLGetInfo(static_cast<unsigned int>(value));
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
@@ -2227,7 +2289,7 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
return WebGLGetInfo();
}
GC3Dint location = uniformLocation->location();
-
+
WebGLStateRestorer(this, false);
// FIXME: make this more efficient using WebGLUniformLocation and caching types in it
GC3Dint activeUniforms = 0;
@@ -2314,9 +2376,13 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
baseType = GraphicsContext3D::FLOAT;
length = 16;
break;
+ case GraphicsContext3D::SAMPLER_2D:
+ case GraphicsContext3D::SAMPLER_CUBE:
+ baseType = GraphicsContext3D::INT;
+ length = 1;
+ break;
default:
// Can't handle this type
- // FIXME: what to do about samplers?
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
return WebGLGetInfo();
}
@@ -2332,7 +2398,7 @@ WebGLGetInfo WebGLRenderingContext::getUniform(WebGLProgram* program, const WebG
GC3Dint value[4] = {0};
m_context->getUniformiv(objectOrZero(program), location, value);
if (length == 1)
- return WebGLGetInfo(static_cast<long>(value[0]));
+ return WebGLGetInfo(value[0]);
return WebGLGetInfo(Int32Array::create(value, length));
}
case GraphicsContext3D::BOOL: {
@@ -2399,16 +2465,16 @@ WebGLGetInfo WebGLRenderingContext::getVertexAttrib(GC3Duint index, GC3Denum pna
return WebGLGetInfo(m_vertexAttribState[index].normalized);
case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_SIZE:
if (index >= m_vertexAttribState.size())
- return WebGLGetInfo(static_cast<long>(4));
- return WebGLGetInfo(static_cast<long>(m_vertexAttribState[index].size));
+ return WebGLGetInfo(static_cast<int>(4));
+ return WebGLGetInfo(m_vertexAttribState[index].size);
case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_STRIDE:
if (index >= m_vertexAttribState.size())
- return WebGLGetInfo(static_cast<long>(0));
- return WebGLGetInfo(static_cast<long>(m_vertexAttribState[index].originalStride));
+ return WebGLGetInfo(static_cast<int>(0));
+ return WebGLGetInfo(m_vertexAttribState[index].originalStride);
case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_TYPE:
if (index >= m_vertexAttribState.size())
- return WebGLGetInfo(static_cast<unsigned long>(GraphicsContext3D::FLOAT));
- return WebGLGetInfo(static_cast<unsigned long>(m_vertexAttribState[index].type));
+ return WebGLGetInfo(static_cast<unsigned int>(GraphicsContext3D::FLOAT));
+ return WebGLGetInfo(m_vertexAttribState[index].type);
case GraphicsContext3D::CURRENT_VERTEX_ATTRIB:
if (index >= m_vertexAttribState.size()) {
float value[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
@@ -2760,6 +2826,7 @@ void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& stri
String stringWithoutComments = StripComments(string).result();
if (!validateString(stringWithoutComments))
return;
+ shader->setSource(string);
m_context->shaderSource(objectOrZero(shader), stringWithoutComments);
cleanupAfterGraphicsCall(false);
}
@@ -2980,6 +3047,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
}
+#if ENABLE(VIDEO)
PassRefPtr<Image> WebGLRenderingContext::videoFrameToImage(HTMLVideoElement* video)
{
if (!video || !video->videoWidth() || !video->videoHeight()) {
@@ -3010,6 +3078,7 @@ void WebGLRenderingContext::texImage2D(GC3Denum target, GC3Dint level, GC3Denum
return;
texImage2DImpl(target, level, internalformat, format, type, image.get(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
}
+#endif
void WebGLRenderingContext::texParameter(GC3Denum target, GC3Denum pname, GC3Dfloat paramf, GC3Dint parami, bool isFloat)
{
@@ -3062,12 +3131,21 @@ void WebGLRenderingContext::texSubImage2DBase(GC3Denum target, GC3Dint level, GC
ec = 0;
if (isContextLost())
return;
- if (!validateTexFuncFormatAndType(format, type))
+ if (!validateTexFuncParameters(target, level, format, width, height, 0, format, type))
return;
- if (!validateTextureBinding(target, true))
+ if (!validateSize(xoffset, yoffset))
return;
- if (!validateSize(xoffset, yoffset) || !validateSize(width, height))
+ WebGLTexture* tex = validateTextureBinding(target, true);
+ if (!tex)
return;
+ if (xoffset + width > tex->getWidth(target, level) || yoffset + height > tex->getHeight(target, level)) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
+ return;
+ }
+ if (tex->getInternalFormat(target, level) != format || tex->getType(target, level) != type) {
+ m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+ return;
+ }
m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
cleanupAfterGraphicsCall(false);
}
@@ -3159,6 +3237,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
}
+#if ENABLE(VIDEO)
void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode& ec)
{
@@ -3170,6 +3249,7 @@ void WebGLRenderingContext::texSubImage2D(GC3Denum target, GC3Dint level, GC3Din
return;
texSubImage2DImpl(target, level, xoffset, yoffset, format, type, image.get(), m_unpackFlipY, m_unpackPremultiplyAlpha, ec);
}
+#endif
void WebGLRenderingContext::uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionCode& ec)
{
@@ -3508,13 +3588,12 @@ void WebGLRenderingContext::uniformMatrix4fv(const WebGLUniformLocation* locatio
void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec)
{
UNUSED_PARAM(ec);
- if (isContextLost())
+ bool deleted;
+ if (!checkObjectToBeBound(program, deleted))
return;
- if (program && program->context() != this) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
- return;
- }
- if (program && program->object() && !program->getLinkStatus()) {
+ if (deleted)
+ program = 0;
+ if (program && !program->getLinkStatus()) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
cleanupAfterGraphicsCall(false);
return;
@@ -3524,7 +3603,7 @@ void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec)
m_currentProgram->onDetached();
m_currentProgram = program;
m_context->useProgram(objectOrZero(program));
- if (program && program->object())
+ if (program)
program->onAttached();
}
cleanupAfterGraphicsCall(false);
@@ -3732,7 +3811,7 @@ void WebGLRenderingContext::detachAndRemoveAllObjects()
HashSet<RefPtr<WebGLObject> >::iterator pend = m_canvasObjects.end();
for (HashSet<RefPtr<WebGLObject> >::iterator it = m_canvasObjects.begin(); it != pend; ++it)
(*it)->detachContext();
-
+
m_canvasObjects.clear();
}
@@ -3814,22 +3893,16 @@ WebGLGetInfo WebGLRenderingContext::getFloatParameter(GC3Denum pname)
WebGLGetInfo WebGLRenderingContext::getIntParameter(GC3Denum pname)
{
- return getLongParameter(pname);
-}
-
-WebGLGetInfo WebGLRenderingContext::getLongParameter(GC3Denum pname)
-{
GC3Dint value = 0;
m_context->getIntegerv(pname, &value);
- return WebGLGetInfo(static_cast<long>(value));
+ return WebGLGetInfo(value);
}
-WebGLGetInfo WebGLRenderingContext::getUnsignedLongParameter(GC3Denum pname)
+WebGLGetInfo WebGLRenderingContext::getUnsignedIntParameter(GC3Denum pname)
{
GC3Dint value = 0;
m_context->getIntegerv(pname, &value);
- GC3Duint uValue = static_cast<GC3Duint>(value);
- return WebGLGetInfo(static_cast<unsigned long>(uValue));
+ return WebGLGetInfo(static_cast<unsigned int>(value));
}
WebGLGetInfo WebGLRenderingContext::getWebGLFloatArrayParameter(GC3Denum pname)
@@ -4382,7 +4455,7 @@ bool WebGLRenderingContext::validateUniformMatrixParameters(const WebGLUniformLo
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
return false;
}
- if (size < requiredMinSize) {
+ if (size < requiredMinSize || (size % requiredMinSize)) {
m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
return false;
}
@@ -4518,34 +4591,49 @@ void WebGLRenderingContext::initVertexAttrib0()
m_vertexAttrib0BufferValue[1] = 0.0f;
m_vertexAttrib0BufferValue[2] = 0.0f;
m_vertexAttrib0BufferValue[3] = 1.0f;
+ m_forceAttrib0BufferRefill = false;
+ m_vertexAttrib0UsedBefore = false;
}
bool WebGLRenderingContext::simulateVertexAttrib0(GC3Dsizei numVertex)
{
const VertexAttribState& state = m_vertexAttribState[0];
- if (state.enabled || !m_currentProgram || !m_currentProgram->object()
- || !m_currentProgram->isUsingVertexAttrib0())
+ if (!m_currentProgram)
return false;
+ bool usingVertexAttrib0 = m_currentProgram->isUsingVertexAttrib0();
+ if (usingVertexAttrib0)
+ m_vertexAttrib0UsedBefore = true;
+ if (state.enabled && usingVertexAttrib0)
+ return false;
+ if (!usingVertexAttrib0 && !m_vertexAttrib0UsedBefore)
+ return false;
+ m_vertexAttrib0UsedBefore = true;
m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer->object());
GC3Dsizeiptr bufferDataSize = (numVertex + 1) * 4 * sizeof(GC3Dfloat);
- if (bufferDataSize > m_vertexAttrib0BufferSize
- || state.value[0] != m_vertexAttrib0BufferValue[0]
- || state.value[1] != m_vertexAttrib0BufferValue[1]
- || state.value[2] != m_vertexAttrib0BufferValue[2]
- || state.value[3] != m_vertexAttrib0BufferValue[3]) {
- OwnArrayPtr<GC3Dfloat> bufferData(new GC3Dfloat[(numVertex + 1) * 4]);
+ if (bufferDataSize > m_vertexAttrib0BufferSize) {
+ m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, bufferDataSize, 0, GraphicsContext3D::DYNAMIC_DRAW);
+ m_vertexAttrib0BufferSize = bufferDataSize;
+ m_forceAttrib0BufferRefill = true;
+ }
+ if (usingVertexAttrib0
+ && (m_forceAttrib0BufferRefill
+ || state.value[0] != m_vertexAttrib0BufferValue[0]
+ || state.value[1] != m_vertexAttrib0BufferValue[1]
+ || state.value[2] != m_vertexAttrib0BufferValue[2]
+ || state.value[3] != m_vertexAttrib0BufferValue[3])) {
+ OwnArrayPtr<GC3Dfloat> bufferData = adoptArrayPtr(new GC3Dfloat[(numVertex + 1) * 4]);
for (GC3Dsizei ii = 0; ii < numVertex + 1; ++ii) {
bufferData[ii * 4] = state.value[0];
bufferData[ii * 4 + 1] = state.value[1];
bufferData[ii * 4 + 2] = state.value[2];
bufferData[ii * 4 + 3] = state.value[3];
}
- m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, bufferDataSize, bufferData.get(), GraphicsContext3D::DYNAMIC_DRAW);
- m_vertexAttrib0BufferSize = bufferDataSize;
m_vertexAttrib0BufferValue[0] = state.value[0];
m_vertexAttrib0BufferValue[1] = state.value[1];
m_vertexAttrib0BufferValue[2] = state.value[2];
m_vertexAttrib0BufferValue[3] = state.value[3];
+ m_forceAttrib0BufferRefill = false;
+ m_context->bufferSubData(GraphicsContext3D::ARRAY_BUFFER, 0, bufferDataSize, bufferData.get());
}
m_context->vertexAttribPointer(0, 4, GraphicsContext3D::FLOAT, 0, 0, 0);
return true;
@@ -4588,7 +4676,7 @@ WebGLExtension* WebGLRenderingContext::getExtensionNumber(int i)
}
WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity)
- : m_buffers(new OwnPtr<ImageBuffer>[capacity])
+ : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity]))
, m_capacity(capacity)
{
}
@@ -4625,4 +4713,4 @@ void WebGLRenderingContext::LRUImageBufferCache::bubbleToFront(int idx)
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h
index 01b5438..dd71620 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h
@@ -69,13 +69,13 @@ public:
virtual bool isAccelerated() const { return true; }
virtual bool paintsIntoCanvasBuffer() const;
- void activeTexture(GC3Denum texture, ExceptionCode& ec);
- void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode& ec);
- void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionCode& ec);
- void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode& ec);
- void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode& ec);
- void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode& ec);
- void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode& ec);
+ void activeTexture(GC3Denum texture, ExceptionCode&);
+ void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
+ void bindAttribLocation(WebGLProgram*, GC3Duint index, const String& name, ExceptionCode&);
+ void bindBuffer(GC3Denum target, WebGLBuffer*, ExceptionCode&);
+ void bindFramebuffer(GC3Denum target, WebGLFramebuffer*, ExceptionCode&);
+ void bindRenderbuffer(GC3Denum target, WebGLRenderbuffer*, ExceptionCode&);
+ void bindTexture(GC3Denum target, WebGLTexture*, ExceptionCode&);
void blendColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha);
void blendEquation(GC3Denum mode);
void blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha);
@@ -94,7 +94,7 @@ public:
void clearDepth(GC3Dfloat);
void clearStencil(GC3Dint);
void colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha);
- void compileShader(WebGLShader*, ExceptionCode& ec);
+ void compileShader(WebGLShader*, ExceptionCode&);
// void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Dsizei imageSize, const void* data);
// void compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei GC3Dsizei height, GC3Denum format, GC3Dsizei imageSize, const void* data);
@@ -131,8 +131,8 @@ public:
void enableVertexAttribArray(GC3Duint index, ExceptionCode&);
void finish();
void flush();
- void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer*, ExceptionCode& ec);
- void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture*, GC3Dint level, ExceptionCode& ec);
+ void framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbuffertarget, WebGLRenderbuffer*, ExceptionCode&);
+ void framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum textarget, WebGLTexture*, GC3Dint level, ExceptionCode&);
void frontFace(GC3Denum mode);
void generateMipmap(GC3Denum target);
@@ -147,10 +147,10 @@ public:
WebGLGetInfo getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname, ExceptionCode&);
WebGLGetInfo getParameter(GC3Denum pname, ExceptionCode&);
WebGLGetInfo getProgramParameter(WebGLProgram*, GC3Denum pname, ExceptionCode&);
- String getProgramInfoLog(WebGLProgram*, ExceptionCode& ec);
+ String getProgramInfoLog(WebGLProgram*, ExceptionCode&);
WebGLGetInfo getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode&);
- WebGLGetInfo getShaderParameter(WebGLShader*, GC3Denum pname, ExceptionCode& ec);
- String getShaderInfoLog(WebGLShader*, ExceptionCode& ec);
+ WebGLGetInfo getShaderParameter(WebGLShader*, GC3Denum pname, ExceptionCode&);
+ String getShaderInfoLog(WebGLShader*, ExceptionCode&);
// TBD
// void glGetShaderPrecisionFormat (GC3Denum shadertype, GC3Denum precisiontype, GC3Dint* range, GC3Dint* precision);
@@ -192,30 +192,34 @@ public:
void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Dsizei width, GC3Dsizei height, GC3Dint border,
- GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&);
+ GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionCode&);
void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
- GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode&);
+ GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&);
void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
- GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode&);
+ GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&);
void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
- GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode&);
+ GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&);
+#if ENABLE(VIDEO)
void texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat,
- GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode&);
+ GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&);
+#endif
void texParameterf(GC3Denum target, GC3Denum pname, GC3Dfloat param);
void texParameteri(GC3Denum target, GC3Denum pname, GC3Dint param);
void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Dsizei width, GC3Dsizei height,
- GC3Denum format, GC3Denum type, ArrayBufferView* pixels, ExceptionCode&);
+ GC3Denum format, GC3Denum type, ArrayBufferView*, ExceptionCode&);
void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Denum format, GC3Denum type, ImageData* pixels, ExceptionCode&);
+ GC3Denum format, GC3Denum type, ImageData*, ExceptionCode&);
void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Denum format, GC3Denum type, HTMLImageElement* image, ExceptionCode&);
+ GC3Denum format, GC3Denum type, HTMLImageElement*, ExceptionCode&);
void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Denum format, GC3Denum type, HTMLCanvasElement* canvas, ExceptionCode&);
+ GC3Denum format, GC3Denum type, HTMLCanvasElement*, ExceptionCode&);
+#if ENABLE(VIDEO)
void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Denum format, GC3Denum type, HTMLVideoElement* video, ExceptionCode&);
+ GC3Denum format, GC3Denum type, HTMLVideoElement*, ExceptionCode&);
+#endif
void uniform1f(const WebGLUniformLocation* location, GC3Dfloat x, ExceptionCode&);
void uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
@@ -334,9 +338,11 @@ public:
// If numElements <= 0, we only check if each enabled vertex attribute is bound to a buffer.
bool validateRenderingState(int numElements);
- bool validateWebGLObject(WebGLObject* object);
+ bool validateWebGLObject(WebGLObject*);
- PassRefPtr<Image> videoFrameToImage(HTMLVideoElement* video);
+#if ENABLE(VIDEO)
+ PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*);
+#endif
RefPtr<GraphicsContext3D> m_context;
@@ -399,6 +405,8 @@ public:
RefPtr<WebGLBuffer> m_vertexAttrib0Buffer;
long m_vertexAttrib0BufferSize;
GC3Dfloat m_vertexAttrib0BufferValue[4];
+ bool m_forceAttrib0BufferRefill;
+ bool m_vertexAttrib0UsedBefore;
RefPtr<WebGLProgram> m_currentProgram;
RefPtr<WebGLFramebuffer> m_framebufferBinding;
@@ -457,20 +465,19 @@ public:
RefPtr<WebKitLoseContext> m_webkitLoseContext;
// Helpers for getParameter and others
- WebGLGetInfo getBooleanParameter(GC3Denum pname);
- WebGLGetInfo getBooleanArrayParameter(GC3Denum pname);
- WebGLGetInfo getFloatParameter(GC3Denum pname);
- WebGLGetInfo getIntParameter(GC3Denum pname);
- WebGLGetInfo getLongParameter(GC3Denum pname);
- WebGLGetInfo getUnsignedLongParameter(GC3Denum pname);
- WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum pname);
- WebGLGetInfo getWebGLIntArrayParameter(GC3Denum pname);
+ WebGLGetInfo getBooleanParameter(GC3Denum);
+ WebGLGetInfo getBooleanArrayParameter(GC3Denum);
+ WebGLGetInfo getFloatParameter(GC3Denum);
+ WebGLGetInfo getIntParameter(GC3Denum);
+ WebGLGetInfo getUnsignedIntParameter(GC3Denum);
+ WebGLGetInfo getWebGLFloatArrayParameter(GC3Denum);
+ WebGLGetInfo getWebGLIntArrayParameter(GC3Denum);
void texImage2DBase(GC3Denum target, GC3Dint level, GC3Denum internalformat,
GC3Dsizei width, GC3Dsizei height, GC3Dint border,
GC3Denum format, GC3Denum type, void* pixels, ExceptionCode&);
void texImage2DImpl(GC3Denum target, GC3Dint level, GC3Denum internalformat,
- GC3Denum format, GC3Denum type, Image* image,
+ GC3Denum format, GC3Denum type, Image*,
bool flipY, bool premultiplyAlpha, ExceptionCode&);
void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
GC3Dsizei width, GC3Dsizei height,
@@ -547,7 +554,7 @@ public:
// Helper function to print warnings to console. Currently
// used only to warn about use of obsolete functions.
- void printWarningToConsole(const String& message);
+ void printWarningToConsole(const String&);
// Helper function to validate input parameters for framebuffer functions.
// Generate GL error if parameters are illegal.
@@ -563,20 +570,29 @@ public:
bool validateCapability(GC3Denum);
// Helper function to validate input parameters for uniform functions.
- bool validateUniformParameters(const WebGLUniformLocation* location, Float32Array* v, GC3Dsizei mod);
- bool validateUniformParameters(const WebGLUniformLocation* location, Int32Array* v, GC3Dsizei mod);
- bool validateUniformParameters(const WebGLUniformLocation* location, void* v, GC3Dsizei size, GC3Dsizei mod);
- bool validateUniformMatrixParameters(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array* v, GC3Dsizei mod);
- bool validateUniformMatrixParameters(const WebGLUniformLocation* location, GC3Dboolean transpose, void* v, GC3Dsizei size, GC3Dsizei mod);
+ bool validateUniformParameters(const WebGLUniformLocation*, Float32Array*, GC3Dsizei mod);
+ bool validateUniformParameters(const WebGLUniformLocation*, Int32Array*, GC3Dsizei mod);
+ bool validateUniformParameters(const WebGLUniformLocation*, void*, GC3Dsizei size, GC3Dsizei mod);
+ bool validateUniformMatrixParameters(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array*, GC3Dsizei mod);
+ bool validateUniformMatrixParameters(const WebGLUniformLocation*, GC3Dboolean transpose, void*, GC3Dsizei size, GC3Dsizei mod);
// Helper function to validate parameters for bufferData.
// Return the current bound buffer to target, or 0 if parameters are invalid.
WebGLBuffer* validateBufferDataParameters(GC3Denum target, GC3Denum usage);
// Helper functions for vertexAttribNf{v}.
- void vertexAttribfImpl(GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3);
- void vertexAttribfvImpl(GC3Duint index, Float32Array* v, GC3Dsizei expectedSize);
- void vertexAttribfvImpl(GC3Duint index, GC3Dfloat* v, GC3Dsizei size, GC3Dsizei expectedSize);
+ void vertexAttribfImpl(GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat);
+ void vertexAttribfvImpl(GC3Duint index, Float32Array*, GC3Dsizei expectedSize);
+ void vertexAttribfvImpl(GC3Duint index, GC3Dfloat*, GC3Dsizei size, GC3Dsizei expectedSize);
+
+ // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions.
+ // Return false if caller should return without further processing.
+ bool deleteObject(WebGLObject*);
+
+ // Helper function for bind* (bindBuffer, bindTexture, etc) and useProgram.
+ // If the object has already been deleted, set deleted to true upon return.
+ // Return false if caller should return without further processing.
+ bool checkObjectToBeBound(WebGLObject*, bool& deleted);
// Helpers for simulating vertexAttrib0
void initVertexAttrib0();
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.idl b/Source/WebCore/html/canvas/WebGLRenderingContext.idl
index 40b9bb0..7a19814 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContext.idl
+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.idl
@@ -26,7 +26,7 @@
module html {
interface [
- Conditional=3D_CANVAS,
+ Conditional=WEBGL,
InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443,
ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54,
CustomMarkFunction,
@@ -258,9 +258,7 @@ module html {
const unsigned int VALIDATE_STATUS = 0x8B83;
const unsigned int ATTACHED_SHADERS = 0x8B85;
const unsigned int ACTIVE_UNIFORMS = 0x8B86;
- const unsigned int ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87;
const unsigned int ACTIVE_ATTRIBUTES = 0x8B89;
- const unsigned int ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A;
const unsigned int SHADING_LANGUAGE_VERSION = 0x8B8C;
const unsigned int CURRENT_PROGRAM = 0x8B8D;
@@ -389,8 +387,6 @@ module html {
/* Shader Source */
const unsigned int COMPILE_STATUS = 0x8B81;
- const unsigned int INFO_LOG_LENGTH = 0x8B84;
- const unsigned int SHADER_SOURCE_LENGTH = 0x8B88;
const unsigned int SHADER_COMPILER = 0x8DFA;
/* Shader Precision-Specified Types */
@@ -613,8 +609,10 @@ module html {
in unsigned long format, in unsigned long type, in HTMLImageElement image) raises (DOMException);
[StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat,
in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException);
+#if defined(ENABLE_VIDEO) && ENABLE_VIDEO
[StrictTypeChecking] void texImage2D(in unsigned long target, in long level, in unsigned long internalformat,
in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException);
+#endif
[StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset,
in long width, in long height,
@@ -625,8 +623,10 @@ module html {
in unsigned long format, in unsigned long type, in HTMLImageElement image) raises (DOMException);
[StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset,
in unsigned long format, in unsigned long type, in HTMLCanvasElement canvas) raises (DOMException);
+#if defined(ENABLE_VIDEO) && ENABLE_VIDEO
[StrictTypeChecking] void texSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset,
in unsigned long format, in unsigned long type, in HTMLVideoElement video) raises (DOMException);
+#endif
[StrictTypeChecking] void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException);
[StrictTypeChecking, Custom] void uniform1fv(in WebGLUniformLocation location, in Float32Array v) raises(DOMException);
diff --git a/Source/WebCore/html/canvas/WebGLShader.cpp b/Source/WebCore/html/canvas/WebGLShader.cpp
index a07023f..59695e4 100644
--- a/Source/WebCore/html/canvas/WebGLShader.cpp
+++ b/Source/WebCore/html/canvas/WebGLShader.cpp
@@ -25,14 +25,14 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLShader.h"
#include "WebGLRenderingContext.h"
namespace WebCore {
-
+
PassRefPtr<WebGLShader> WebGLShader::create(WebGLRenderingContext* ctx, GC3Denum type)
{
return adoptRef(new WebGLShader(ctx, type));
@@ -41,6 +41,7 @@ PassRefPtr<WebGLShader> WebGLShader::create(WebGLRenderingContext* ctx, GC3Denum
WebGLShader::WebGLShader(WebGLRenderingContext* ctx, GC3Denum type)
: WebGLObject(ctx)
, m_type(type)
+ , m_source("")
{
setObject(context()->graphicsContext3D()->createShader(type));
}
@@ -52,4 +53,4 @@ void WebGLShader::deleteObjectImpl(Platform3DObject object)
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLShader.h b/Source/WebCore/html/canvas/WebGLShader.h
index 5deaf20..1d7a10c 100644
--- a/Source/WebCore/html/canvas/WebGLShader.h
+++ b/Source/WebCore/html/canvas/WebGLShader.h
@@ -40,6 +40,9 @@ public:
static PassRefPtr<WebGLShader> create(WebGLRenderingContext*, GC3Denum);
GC3Denum getType() const { return m_type; }
+ const String& getSource() const { return m_source; }
+
+ void setSource(const String& source) { m_source = source; }
private:
WebGLShader(WebGLRenderingContext*, GC3Denum);
@@ -49,6 +52,7 @@ private:
virtual bool isShader() const { return true; }
GC3Denum m_type;
+ String m_source;
};
} // namespace WebCore
diff --git a/Source/WebCore/html/canvas/WebGLShader.idl b/Source/WebCore/html/canvas/WebGLShader.idl
index 45e7f54..21bba65 100644
--- a/Source/WebCore/html/canvas/WebGLShader.idl
+++ b/Source/WebCore/html/canvas/WebGLShader.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLShader {
+ interface [Conditional=WEBGL] WebGLShader {
};
}
diff --git a/Source/WebCore/html/canvas/WebGLTexture.cpp b/Source/WebCore/html/canvas/WebGLTexture.cpp
index a57500f..e8e8bf8 100644
--- a/Source/WebCore/html/canvas/WebGLTexture.cpp
+++ b/Source/WebCore/html/canvas/WebGLTexture.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLTexture.h"
@@ -33,7 +33,7 @@
#include "WebGLRenderingContext.h"
namespace WebCore {
-
+
PassRefPtr<WebGLTexture> WebGLTexture::create(WebGLRenderingContext* ctx)
{
return adoptRef(new WebGLTexture(ctx));
@@ -353,4 +353,4 @@ const WebGLTexture::LevelInfo* WebGLTexture::getLevelInfo(GC3Denum target, GC3Di
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLTexture.h b/Source/WebCore/html/canvas/WebGLTexture.h
index 27eb8ee..6bd1272 100644
--- a/Source/WebCore/html/canvas/WebGLTexture.h
+++ b/Source/WebCore/html/canvas/WebGLTexture.h
@@ -44,6 +44,8 @@ public:
void setParameteri(GC3Denum pname, GC3Dint param);
void setParameterf(GC3Denum pname, GC3Dfloat param);
+ GC3Denum getTarget() const { return m_target; }
+
int getMinFilter() const { return m_minFilter; }
void setLevelInfo(GC3Denum target, GC3Dint level, GC3Denum internalFormat, GC3Dsizei width, GC3Dsizei height, GC3Denum type);
diff --git a/Source/WebCore/html/canvas/WebGLTexture.idl b/Source/WebCore/html/canvas/WebGLTexture.idl
index da7e066..d287f35 100644
--- a/Source/WebCore/html/canvas/WebGLTexture.idl
+++ b/Source/WebCore/html/canvas/WebGLTexture.idl
@@ -24,6 +24,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLTexture {
+ interface [Conditional=WEBGL] WebGLTexture {
};
}
diff --git a/Source/WebCore/html/canvas/WebGLUniformLocation.cpp b/Source/WebCore/html/canvas/WebGLUniformLocation.cpp
index a8220b0..1aeddb5 100644
--- a/Source/WebCore/html/canvas/WebGLUniformLocation.cpp
+++ b/Source/WebCore/html/canvas/WebGLUniformLocation.cpp
@@ -26,12 +26,12 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebGLUniformLocation.h"
namespace WebCore {
-
+
PassRefPtr<WebGLUniformLocation> WebGLUniformLocation::create(WebGLProgram* program, GC3Dint location)
{
return adoptRef(new WebGLUniformLocation(program, location));
@@ -64,4 +64,4 @@ GC3Dint WebGLUniformLocation::location() const
}
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebGLUniformLocation.h b/Source/WebCore/html/canvas/WebGLUniformLocation.h
index 3ef9fa8..6e05c7a 100644
--- a/Source/WebCore/html/canvas/WebGLUniformLocation.h
+++ b/Source/WebCore/html/canvas/WebGLUniformLocation.h
@@ -39,14 +39,14 @@ class WebGLUniformLocation : public RefCounted<WebGLUniformLocation> {
public:
virtual ~WebGLUniformLocation() { }
- static PassRefPtr<WebGLUniformLocation> create(WebGLProgram* program, GC3Dint location);
+ static PassRefPtr<WebGLUniformLocation> create(WebGLProgram*, GC3Dint location);
WebGLProgram* program() const;
GC3Dint location() const;
protected:
- WebGLUniformLocation(WebGLProgram* program, GC3Dint location);
+ WebGLUniformLocation(WebGLProgram*, GC3Dint location);
private:
RefPtr<WebGLProgram> m_program;
diff --git a/Source/WebCore/html/canvas/WebGLUniformLocation.idl b/Source/WebCore/html/canvas/WebGLUniformLocation.idl
index b080241..5cd6404 100644
--- a/Source/WebCore/html/canvas/WebGLUniformLocation.idl
+++ b/Source/WebCore/html/canvas/WebGLUniformLocation.idl
@@ -25,6 +25,6 @@
*/
module html {
- interface [Conditional=3D_CANVAS] WebGLUniformLocation {
+ interface [Conditional=WEBGL] WebGLUniformLocation {
};
}
diff --git a/Source/WebCore/html/canvas/WebKitLoseContext.cpp b/Source/WebCore/html/canvas/WebKitLoseContext.cpp
index c7dd078..05e82f4 100644
--- a/Source/WebCore/html/canvas/WebKitLoseContext.cpp
+++ b/Source/WebCore/html/canvas/WebKitLoseContext.cpp
@@ -25,7 +25,7 @@
#include "config.h"
-#if ENABLE(3D_CANVAS)
+#if ENABLE(WEBGL)
#include "WebKitLoseContext.h"
@@ -60,4 +60,4 @@ void WebKitLoseContext::loseContext()
} // namespace WebCore
-#endif // ENABLE(3D_CANVAS)
+#endif // ENABLE(WEBGL)
diff --git a/Source/WebCore/html/canvas/WebKitLoseContext.idl b/Source/WebCore/html/canvas/WebKitLoseContext.idl
index 741aa4a..83fc909 100644
--- a/Source/WebCore/html/canvas/WebKitLoseContext.idl
+++ b/Source/WebCore/html/canvas/WebKitLoseContext.idl
@@ -24,7 +24,7 @@
*/
module html {
- interface [Conditional=3D_CANVAS, OmitConstructor] WebKitLoseContext {
+ interface [Conditional=WEBGL, OmitConstructor] WebKitLoseContext {
[StrictTypeChecking] void loseContext();
};
}