b=586938; missing VIEWPORT property on WebGL context; r=mrbkap,a=b

This commit is contained in:
Vladimir Vukicevic 2010-12-20 20:08:03 -08:00
parent b410989e7f
commit ea8b4ccfc1
3 changed files with 39 additions and 2 deletions

View File

@ -1403,7 +1403,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeWorker, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLRenderingContext, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(WebGLRenderingContext, nsWebGLViewportHandlerSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(WebGLBuffer, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)

View File

@ -1801,4 +1801,34 @@ public:
}
};
class nsWebGLViewportHandlerSH : public nsDOMGenericSH
{
protected:
nsWebGLViewportHandlerSH(nsDOMClassInfoData *aData) : nsDOMGenericSH(aData)
{
}
virtual ~nsWebGLViewportHandlerSH()
{
}
public:
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto) {
nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto);
if (NS_SUCCEEDED(rv)) {
if (!::JS_DefineProperty(cx, proto, "VIEWPORT", INT_TO_JSVAL(0x0BA2),
nsnull, nsnull, JSPROP_ENUMERATE))
{
return NS_ERROR_UNEXPECTED;
}
}
return rv;
}
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
{
return new nsWebGLViewportHandlerSH(aData);
}
};
#endif /* nsDOMClassInfo_h___ */

View File

@ -274,7 +274,14 @@ interface nsIDOMWebGLRenderingContext : nsISupports
const unsigned long STENCIL_BACK_REF = 0x8CA3;
const unsigned long STENCIL_BACK_VALUE_MASK = 0x8CA4;
const unsigned long STENCIL_BACK_WRITEMASK = 0x8CA5;
const unsigned long VIEWPORT_RECT = 0x0BA2;
// This is defined using a scriptable helper in nsDOMClassInfo.h,
// because otherwise the case conflicts with the viewport()
// method. WebIDL is case-sensitive, but our current IDL parser
// is not. Once this is fixed, the WebGL context can go back to
// using nsDOMGenericSH instead of nsWebGLViewportHandlerSH.
// It is not visible to non-JS languages, but the constant value
// can just be used.
//const unsigned long VIEWPORT = 0x0BA2;
const unsigned long SCISSOR_BOX = 0x0C10;
/* GL_SCISSOR_TEST */
const unsigned long COLOR_CLEAR_VALUE = 0x0C22;