mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #20518 - servo:webgl, r=emilio
Some minor WebGL improvements <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20518) <!-- Reviewable:end -->
This commit is contained in:
commit
122bfa03e1
22 changed files with 341 additions and 615 deletions
|
@ -4800,7 +4800,7 @@ class CGProxySpecialOperation(CGPerSignatureCall):
|
|||
False, descriptor, operation,
|
||||
len(arguments))
|
||||
|
||||
if operation.isSetter() or operation.isCreator():
|
||||
if operation.isSetter():
|
||||
# arguments[0] is the index or name of the item that we're setting.
|
||||
argument = arguments[1]
|
||||
info = getJSToNativeConversionInfo(
|
||||
|
|
|
@ -279,8 +279,6 @@ class Descriptor(DescriptorProvider):
|
|||
addIndexedOrNamedOperation('Getter', m)
|
||||
if m.isSetter():
|
||||
addIndexedOrNamedOperation('Setter', m)
|
||||
if m.isCreator():
|
||||
addIndexedOrNamedOperation('Creator', m)
|
||||
if m.isDeleter():
|
||||
addIndexedOrNamedOperation('Deleter', m)
|
||||
|
||||
|
|
|
@ -1095,12 +1095,12 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
testInterface = testInterface.parent
|
||||
|
||||
# Ensure that there's at most one of each {named,indexed}
|
||||
# {getter,setter,creator,deleter}, at most one stringifier,
|
||||
# {getter,setter,deleter}, at most one stringifier,
|
||||
# and at most one legacycaller. Note that this last is not
|
||||
# quite per spec, but in practice no one overloads
|
||||
# legacycallers. Also note that in practice we disallow
|
||||
# indexed deleters, but it simplifies some other code to
|
||||
# treat deleter analogously to getter/setter/creator by
|
||||
# treat deleter analogously to getter/setter by
|
||||
# prefixing it with "named".
|
||||
specialMembersSeen = {}
|
||||
for member in self.members:
|
||||
|
@ -1111,8 +1111,6 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
memberType = "getters"
|
||||
elif member.isSetter():
|
||||
memberType = "setters"
|
||||
elif member.isCreator():
|
||||
memberType = "creators"
|
||||
elif member.isDeleter():
|
||||
memberType = "deleters"
|
||||
elif member.isStringifier():
|
||||
|
@ -1158,8 +1156,8 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
ancestor = ancestor.parent
|
||||
|
||||
if self._isOnGlobalProtoChain:
|
||||
# Make sure we have no named setters, creators, or deleters
|
||||
for memberType in ["setter", "creator", "deleter"]:
|
||||
# Make sure we have no named setters or deleters
|
||||
for memberType in ["setter", "deleter"]:
|
||||
memberId = "named " + memberType + "s"
|
||||
if memberId in specialMembersSeen:
|
||||
raise WebIDLError("Interface with [Global] has a named %s" %
|
||||
|
@ -1183,6 +1181,22 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
parent = parent.parent
|
||||
|
||||
def validate(self):
|
||||
|
||||
def checkDuplicateNames(member, name, attributeName):
|
||||
for m in self.members:
|
||||
if m.identifier.name == name:
|
||||
raise WebIDLError("[%s=%s] has same name as interface member" %
|
||||
(attributeName, name),
|
||||
[member.location, m.location])
|
||||
if m.isMethod() and m != member and name in m.aliases:
|
||||
raise WebIDLError("conflicting [%s=%s] definitions" %
|
||||
(attributeName, name),
|
||||
[member.location, m.location])
|
||||
if m.isAttr() and m != member and name in m.bindingAliases:
|
||||
raise WebIDLError("conflicting [%s=%s] definitions" %
|
||||
(attributeName, name),
|
||||
[member.location, m.location])
|
||||
|
||||
# We don't support consequential unforgeable interfaces. Need to check
|
||||
# this here, because in finish() an interface might not know yet that
|
||||
# it's consequential.
|
||||
|
@ -1295,15 +1309,15 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins):
|
|||
raise WebIDLError("[Alias] must not be used on an "
|
||||
"[Unforgeable] operation",
|
||||
[member.location])
|
||||
for m in self.members:
|
||||
if m.identifier.name == alias:
|
||||
raise WebIDLError("[Alias=%s] has same name as "
|
||||
"interface member" % alias,
|
||||
[member.location, m.location])
|
||||
if m.isMethod() and m != member and alias in m.aliases:
|
||||
raise WebIDLError("duplicate [Alias=%s] definitions" %
|
||||
alias,
|
||||
[member.location, m.location])
|
||||
|
||||
checkDuplicateNames(member, alias, "Alias")
|
||||
|
||||
# Check that the name of a [BindingAlias] doesn't conflict with an
|
||||
# interface member.
|
||||
if member.isAttr():
|
||||
for bindingAlias in member.bindingAliases:
|
||||
checkDuplicateNames(member, bindingAlias, "BindingAlias")
|
||||
|
||||
|
||||
# Conditional exposure makes no sense for interfaces with no
|
||||
# interface object, unless they're navigator properties.
|
||||
|
@ -1720,10 +1734,10 @@ class IDLInterface(IDLInterfaceOrNamespace):
|
|||
identifier == "OverrideBuiltins" or
|
||||
identifier == "ChromeOnly" or
|
||||
identifier == "Unforgeable" or
|
||||
identifier == "UnsafeInPrerendering" or
|
||||
identifier == "LegacyEventInit" or
|
||||
identifier == "ProbablyShortLivingWrapper" or
|
||||
identifier == "LegacyUnenumerableNamedProperties" or
|
||||
identifier == "RunConstructorInCallerCompartment" or
|
||||
identifier == "NonOrdinaryGetPrototypeOf" or
|
||||
identifier == "Abstract" or
|
||||
identifier == "Inline"):
|
||||
|
@ -1780,10 +1794,16 @@ class IDLNamespace(IDLInterfaceOrNamespace):
|
|||
if not attr.hasValue():
|
||||
raise WebIDLError("[%s] must have a value" % identifier,
|
||||
[attr.location])
|
||||
elif identifier == "ProtoObjectHack":
|
||||
elif (identifier == "ProtoObjectHack" or
|
||||
identifier == "ChromeOnly"):
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[%s] must not have arguments" % identifier,
|
||||
[attr.location])
|
||||
elif identifier == "Pref":
|
||||
# Known extended attributes that take a string value
|
||||
if not attr.hasValue():
|
||||
raise WebIDLError("[%s] must have a value" % identifier,
|
||||
[attr.location])
|
||||
else:
|
||||
raise WebIDLError("Unknown extended attribute %s on namespace" %
|
||||
identifier,
|
||||
|
@ -3581,6 +3601,11 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
|
|||
[self.location])
|
||||
self.aliases.append(alias)
|
||||
|
||||
def _addBindingAlias(self, bindingAlias):
|
||||
if bindingAlias in self.bindingAliases:
|
||||
raise WebIDLError("Duplicate [BindingAlias=%s] on attribute" % bindingAlias,
|
||||
[self.location])
|
||||
self.bindingAliases.append(bindingAlias)
|
||||
|
||||
class IDLMaplikeOrSetlikeOrIterableBase(IDLInterfaceMember):
|
||||
|
||||
|
@ -3701,6 +3726,11 @@ class IDLMaplikeOrSetlikeOrIterableBase(IDLInterfaceMember):
|
|||
if isIteratorAlias:
|
||||
method.addExtendedAttributes(
|
||||
[IDLExtendedAttribute(self.location, ("Alias", "@@iterator"))])
|
||||
# Methods generated for iterables should be enumerable, but the ones for
|
||||
# maplike/setlike should not be.
|
||||
if not self.isIterable():
|
||||
method.addExtendedAttributes(
|
||||
[IDLExtendedAttribute(self.location, ("NonEnumerable",))])
|
||||
members.append(method)
|
||||
|
||||
def resolve(self, parentScope):
|
||||
|
@ -3824,11 +3854,15 @@ class IDLMaplikeOrSetlike(IDLMaplikeOrSetlikeOrIterableBase):
|
|||
specification during parsing.
|
||||
"""
|
||||
# Both maplike and setlike have a size attribute
|
||||
members.append(IDLAttribute(self.location,
|
||||
IDLUnresolvedIdentifier(BuiltinLocation("<auto-generated-identifier>"), "size"),
|
||||
BuiltinTypes[IDLBuiltinType.Types.unsigned_long],
|
||||
True,
|
||||
maplikeOrSetlike=self))
|
||||
sizeAttr = IDLAttribute(self.location,
|
||||
IDLUnresolvedIdentifier(BuiltinLocation("<auto-generated-identifier>"), "size"),
|
||||
BuiltinTypes[IDLBuiltinType.Types.unsigned_long],
|
||||
True,
|
||||
maplikeOrSetlike=self)
|
||||
# This should be non-enumerable.
|
||||
sizeAttr.addExtendedAttributes(
|
||||
[IDLExtendedAttribute(self.location, ("NonEnumerable",))])
|
||||
members.append(sizeAttr)
|
||||
self.reserved_ro_names = ["size"]
|
||||
self.disallowedMemberNames.append("size")
|
||||
|
||||
|
@ -3964,7 +3998,9 @@ class IDLConst(IDLInterfaceMember):
|
|||
elif (identifier == "Pref" or
|
||||
identifier == "ChromeOnly" or
|
||||
identifier == "Func" or
|
||||
identifier == "SecureContext"):
|
||||
identifier == "SecureContext" or
|
||||
identifier == "NonEnumerable" or
|
||||
identifier == "NeedsWindowsUndef"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
@ -4000,6 +4036,7 @@ class IDLAttribute(IDLInterfaceMember):
|
|||
self.dependsOn = "Everything"
|
||||
self.affects = "Everything"
|
||||
self.navigatorObjectGetter = navigatorObjectGetter
|
||||
self.bindingAliases = []
|
||||
|
||||
if static and identifier.name == "prototype":
|
||||
raise WebIDLError("The identifier of a static attribute must not be 'prototype'",
|
||||
|
@ -4138,11 +4175,17 @@ class IDLAttribute(IDLInterfaceMember):
|
|||
|
||||
def handleExtendedAttribute(self, attr):
|
||||
identifier = attr.identifier()
|
||||
if ((identifier == "SetterThrows" or identifier == "SetterCanOOM")
|
||||
if ((identifier == "SetterThrows" or identifier == "SetterCanOOM" or
|
||||
identifier == "SetterNeedsSubjectPrincipal")
|
||||
and self.readonly):
|
||||
raise WebIDLError("Readonly attributes must not be flagged as "
|
||||
"[%s]" % identifier,
|
||||
[self.location])
|
||||
elif identifier == "BindingAlias":
|
||||
if not attr.hasValue():
|
||||
raise WebIDLError("[BindingAlias] takes an identifier or string",
|
||||
[attr.location])
|
||||
self._addBindingAlias(attr.value())
|
||||
elif (((identifier == "Throws" or identifier == "GetterThrows" or
|
||||
identifier == "CanOOM" or identifier == "GetterCanOOM") and
|
||||
self.getExtendedAttribute("StoreInSlot")) or
|
||||
|
@ -4338,11 +4381,13 @@ class IDLAttribute(IDLInterfaceMember):
|
|||
identifier == "SecureContext" or
|
||||
identifier == "Frozen" or
|
||||
identifier == "NewObject" or
|
||||
identifier == "UnsafeInPrerendering" or
|
||||
identifier == "NeedsSubjectPrincipal" or
|
||||
identifier == "SetterNeedsSubjectPrincipal" or
|
||||
identifier == "GetterNeedsSubjectPrincipal" or
|
||||
identifier == "NeedsCallerType" or
|
||||
identifier == "ReturnValueNeedsContainsHack" or
|
||||
identifier == "BinaryName"):
|
||||
identifier == "BinaryName" or
|
||||
identifier == "NonEnumerable"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
@ -4606,7 +4651,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
Special = enum(
|
||||
'Getter',
|
||||
'Setter',
|
||||
'Creator',
|
||||
'Deleter',
|
||||
'LegacyCaller',
|
||||
base=IDLInterfaceMember.Special
|
||||
|
@ -4619,7 +4663,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
)
|
||||
|
||||
def __init__(self, location, identifier, returnType, arguments,
|
||||
static=False, getter=False, setter=False, creator=False,
|
||||
static=False, getter=False, setter=False,
|
||||
deleter=False, specialType=NamedOrIndexed.Neither,
|
||||
legacycaller=False, stringifier=False, jsonifier=False,
|
||||
maplikeOrSetlikeOrIterable=None, htmlConstructor=False):
|
||||
|
@ -4640,8 +4684,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
self._getter = getter
|
||||
assert isinstance(setter, bool)
|
||||
self._setter = setter
|
||||
assert isinstance(creator, bool)
|
||||
self._creator = creator
|
||||
assert isinstance(deleter, bool)
|
||||
self._deleter = deleter
|
||||
assert isinstance(legacycaller, bool)
|
||||
|
@ -4682,7 +4724,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
assert not arguments[0].optional and not arguments[0].variadic
|
||||
assert not self._getter or not overload.returnType.isVoid()
|
||||
|
||||
if self._setter or self._creator:
|
||||
if self._setter:
|
||||
assert len(self._overloads) == 1
|
||||
arguments = self._overloads[0].arguments
|
||||
assert len(arguments) == 2
|
||||
|
@ -4715,9 +4757,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
def isSetter(self):
|
||||
return self._setter
|
||||
|
||||
def isCreator(self):
|
||||
return self._creator
|
||||
|
||||
def isDeleter(self):
|
||||
return self._deleter
|
||||
|
||||
|
@ -4750,7 +4789,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
def isSpecial(self):
|
||||
return (self.isGetter() or
|
||||
self.isSetter() or
|
||||
self.isCreator() or
|
||||
self.isDeleter() or
|
||||
self.isLegacycaller() or
|
||||
self.isStringifier() or
|
||||
|
@ -4806,8 +4844,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
assert not method.isGetter()
|
||||
assert not self.isSetter()
|
||||
assert not method.isSetter()
|
||||
assert not self.isCreator()
|
||||
assert not method.isCreator()
|
||||
assert not self.isDeleter()
|
||||
assert not method.isDeleter()
|
||||
assert not self.isStringifier()
|
||||
|
@ -4984,7 +5020,9 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
if (identifier == "GetterThrows" or
|
||||
identifier == "SetterThrows" or
|
||||
identifier == "GetterCanOOM" or
|
||||
identifier == "SetterCanOOM"):
|
||||
identifier == "SetterCanOOM" or
|
||||
identifier == "SetterNeedsSubjectPrincipal" or
|
||||
identifier == "GetterNeedsSubjectPrincipal"):
|
||||
raise WebIDLError("Methods must not be flagged as "
|
||||
"[%s]" % identifier,
|
||||
[attr.location, self.location])
|
||||
|
@ -5071,7 +5109,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
identifier == "CanOOM" or
|
||||
identifier == "NewObject" or
|
||||
identifier == "ChromeOnly" or
|
||||
identifier == "UnsafeInPrerendering" or
|
||||
identifier == "Pref" or
|
||||
identifier == "Deprecated" or
|
||||
identifier == "Func" or
|
||||
|
@ -5079,7 +5116,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
identifier == "BinaryName" or
|
||||
identifier == "NeedsSubjectPrincipal" or
|
||||
identifier == "NeedsCallerType" or
|
||||
identifier == "StaticClassOverride"):
|
||||
identifier == "StaticClassOverride" or
|
||||
identifier == "NonEnumerable"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
@ -5262,7 +5300,6 @@ class Tokenizer(object):
|
|||
"static": "STATIC",
|
||||
"getter": "GETTER",
|
||||
"setter": "SETTER",
|
||||
"creator": "CREATOR",
|
||||
"deleter": "DELETER",
|
||||
"legacycaller": "LEGACYCALLER",
|
||||
"optional": "OPTIONAL",
|
||||
|
@ -5977,13 +6014,12 @@ class Parser(Tokenizer):
|
|||
|
||||
getter = True if IDLMethod.Special.Getter in p[1] else False
|
||||
setter = True if IDLMethod.Special.Setter in p[1] else False
|
||||
creator = True if IDLMethod.Special.Creator in p[1] else False
|
||||
deleter = True if IDLMethod.Special.Deleter in p[1] else False
|
||||
legacycaller = True if IDLMethod.Special.LegacyCaller in p[1] else False
|
||||
|
||||
if getter or deleter:
|
||||
if setter or creator:
|
||||
raise WebIDLError("getter and deleter are incompatible with setter and creator",
|
||||
if setter:
|
||||
raise WebIDLError("getter and deleter are incompatible with setter",
|
||||
[self.getLocation(p, 1)])
|
||||
|
||||
(returnType, identifier, arguments) = p[2]
|
||||
|
@ -6018,10 +6054,9 @@ class Parser(Tokenizer):
|
|||
if returnType.isVoid():
|
||||
raise WebIDLError("getter cannot have void return type",
|
||||
[self.getLocation(p, 2)])
|
||||
if setter or creator:
|
||||
if setter:
|
||||
if len(arguments) != 2:
|
||||
raise WebIDLError("%s has wrong number of arguments" %
|
||||
("setter" if setter else "creator"),
|
||||
raise WebIDLError("setter has wrong number of arguments",
|
||||
[self.getLocation(p, 2)])
|
||||
argType = arguments[0].type
|
||||
if argType == BuiltinTypes[IDLBuiltinType.Types.domstring]:
|
||||
|
@ -6029,18 +6064,15 @@ class Parser(Tokenizer):
|
|||
elif argType == BuiltinTypes[IDLBuiltinType.Types.unsigned_long]:
|
||||
specialType = IDLMethod.NamedOrIndexed.Indexed
|
||||
else:
|
||||
raise WebIDLError("%s has wrong argument type (must be DOMString or UnsignedLong)" %
|
||||
("setter" if setter else "creator"),
|
||||
raise WebIDLError("settter has wrong argument type (must be DOMString or UnsignedLong)",
|
||||
[arguments[0].location])
|
||||
if arguments[0].optional or arguments[0].variadic:
|
||||
raise WebIDLError("%s cannot have %s argument" %
|
||||
("setter" if setter else "creator",
|
||||
"optional" if arguments[0].optional else "variadic"),
|
||||
raise WebIDLError("setter cannot have %s argument" %
|
||||
("optional" if arguments[0].optional else "variadic"),
|
||||
[arguments[0].location])
|
||||
if arguments[1].optional or arguments[1].variadic:
|
||||
raise WebIDLError("%s cannot have %s argument" %
|
||||
("setter" if setter else "creator",
|
||||
"optional" if arguments[1].optional else "variadic"),
|
||||
raise WebIDLError("setter cannot have %s argument" %
|
||||
("optional" if arguments[1].optional else "variadic"),
|
||||
[arguments[1].location])
|
||||
|
||||
if stringifier:
|
||||
|
@ -6053,7 +6085,7 @@ class Parser(Tokenizer):
|
|||
|
||||
# identifier might be None. This is only permitted for special methods.
|
||||
if not identifier:
|
||||
if (not getter and not setter and not creator and
|
||||
if (not getter and not setter and
|
||||
not deleter and not legacycaller and not stringifier):
|
||||
raise WebIDLError("Identifier required for non-special methods",
|
||||
[self.getLocation(p, 2)])
|
||||
|
@ -6061,19 +6093,18 @@ class Parser(Tokenizer):
|
|||
location = BuiltinLocation("<auto-generated-identifier>")
|
||||
identifier = IDLUnresolvedIdentifier(
|
||||
location,
|
||||
"__%s%s%s%s%s%s%s" %
|
||||
"__%s%s%s%s%s%s" %
|
||||
("named" if specialType == IDLMethod.NamedOrIndexed.Named else
|
||||
"indexed" if specialType == IDLMethod.NamedOrIndexed.Indexed else "",
|
||||
"getter" if getter else "",
|
||||
"setter" if setter else "",
|
||||
"deleter" if deleter else "",
|
||||
"creator" if creator else "",
|
||||
"legacycaller" if legacycaller else "",
|
||||
"stringifier" if stringifier else ""),
|
||||
allowDoubleUnderscore=True)
|
||||
|
||||
method = IDLMethod(self.getLocation(p, 2), identifier, returnType, arguments,
|
||||
static=static, getter=getter, setter=setter, creator=creator,
|
||||
static=static, getter=getter, setter=setter,
|
||||
deleter=deleter, specialType=specialType,
|
||||
legacycaller=legacycaller, stringifier=stringifier)
|
||||
p[0] = method
|
||||
|
@ -6149,12 +6180,6 @@ class Parser(Tokenizer):
|
|||
"""
|
||||
p[0] = IDLMethod.Special.Setter
|
||||
|
||||
def p_SpecialCreator(self, p):
|
||||
"""
|
||||
Special : CREATOR
|
||||
"""
|
||||
p[0] = IDLMethod.Special.Creator
|
||||
|
||||
def p_SpecialDeleter(self, p):
|
||||
"""
|
||||
Special : DELETER
|
||||
|
@ -6246,7 +6271,6 @@ class Parser(Tokenizer):
|
|||
| ATTRIBUTE
|
||||
| CALLBACK
|
||||
| CONST
|
||||
| CREATOR
|
||||
| DELETER
|
||||
| DICTIONARY
|
||||
| ENUM
|
||||
|
@ -6396,7 +6420,6 @@ class Parser(Tokenizer):
|
|||
| BYTE
|
||||
| LEGACYCALLER
|
||||
| CONST
|
||||
| CREATOR
|
||||
| DELETER
|
||||
| DOUBLE
|
||||
| EXCEPTION
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--- WebIDL.py
|
||||
+++ WebIDL.py
|
||||
@@ -1416,7 +1416,8 @@
|
||||
identifier == "LegacyEventInit" or
|
||||
identifier == "ProbablyShortLivingObject" or
|
||||
@@ -1744,7 +1744,8 @@
|
||||
identifier == "ProbablyShortLivingWrapper" or
|
||||
identifier == "LegacyUnenumerableNamedProperties" or
|
||||
identifier == "RunConstructorInCallerCompartment" or
|
||||
- identifier == "NonOrdinaryGetPrototypeOf"):
|
||||
+ identifier == "NonOrdinaryGetPrototypeOf" or
|
||||
+ identifier == "Abstract"):
|
||||
|
|
|
@ -101,21 +101,6 @@ def WebIDLTest(parser, harness):
|
|||
harness.ok(threw,
|
||||
"Should have thrown for [CEReactions] used on a named getter")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface Foo {
|
||||
[CEReactions] creator boolean (DOMString name, boolean value);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown for [CEReactions] used on a named creator")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
|
|
@ -11,7 +11,7 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(argument.variadic, variadic, "Argument has the right variadic value")
|
||||
|
||||
def checkMethod(method, QName, name, signatures,
|
||||
static=True, getter=False, setter=False, creator=False,
|
||||
static=True, getter=False, setter=False,
|
||||
deleter=False, legacycaller=False, stringifier=False,
|
||||
chromeOnly=False, htmlConstructor=False):
|
||||
harness.ok(isinstance(method, WebIDL.IDLMethod),
|
||||
|
@ -24,7 +24,6 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(method.isStatic(), static, "Method has the correct static value")
|
||||
harness.check(method.isGetter(), getter, "Method has the correct getter value")
|
||||
harness.check(method.isSetter(), setter, "Method has the correct setter value")
|
||||
harness.check(method.isCreator(), creator, "Method has the correct creator value")
|
||||
harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
|
||||
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
|
||||
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
|
||||
|
|
|
@ -27,20 +27,6 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface DuplicateQualifiers3 {
|
||||
creator creator byte foo(unsigned long index, byte value);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
|
@ -68,17 +54,3 @@ def WebIDLTest(parser, harness):
|
|||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
results = parser.parse("""
|
||||
interface DuplicateQualifiers6 {
|
||||
creator setter creator byte foo(unsigned long index, byte value);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -32,24 +32,6 @@ def WebIDLTest(parser, harness):
|
|||
"Should have thrown for [Global] used on an interface with a "
|
||||
"named setter")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
[Global]
|
||||
interface Foo {
|
||||
getter any(DOMString name);
|
||||
creator void(DOMString name, any arg);
|
||||
};
|
||||
""")
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw,
|
||||
"Should have thrown for [Global] used on an interface with a "
|
||||
"named creator")
|
||||
|
||||
parser = parser.reset()
|
||||
threw = False
|
||||
try:
|
||||
|
|
|
@ -41,7 +41,7 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(argument.variadic, variadic, "Argument has the right variadic value")
|
||||
|
||||
def checkMethod(method, QName, name, signatures,
|
||||
static=False, getter=False, setter=False, creator=False,
|
||||
static=False, getter=False, setter=False,
|
||||
deleter=False, legacycaller=False, stringifier=False):
|
||||
harness.ok(isinstance(method, WebIDL.IDLMethod),
|
||||
"Should be an IDLMethod")
|
||||
|
@ -53,7 +53,6 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(method.isStatic(), static, "Method has the correct static value")
|
||||
harness.check(method.isGetter(), getter, "Method has the correct getter value")
|
||||
harness.check(method.isSetter(), setter, "Method has the correct setter value")
|
||||
harness.check(method.isCreator(), creator, "Method has the correct creator value")
|
||||
harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
|
||||
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
|
||||
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
|
||||
|
|
|
@ -222,73 +222,3 @@ def WebIDLTest(parser, harness):
|
|||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodSignatureMismatch20 {
|
||||
creator long long foo(long index, long long value);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodSignatureMismatch22 {
|
||||
creator boolean foo(unsigned long index, boolean value, long long extraArg);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodSignatureMismatch23 {
|
||||
creator boolean foo(unsigned long index, boolean... value);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodSignatureMismatch24 {
|
||||
creator boolean foo(unsigned long index, optional boolean value);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodSignatureMismatch25 {
|
||||
creator boolean foo();
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
|
|
@ -5,25 +5,21 @@ def WebIDLTest(parser, harness):
|
|||
interface SpecialMethods {
|
||||
getter long long (unsigned long index);
|
||||
setter long long (unsigned long index, long long value);
|
||||
creator long long (unsigned long index, long long value);
|
||||
getter boolean (DOMString name);
|
||||
setter boolean (DOMString name, boolean value);
|
||||
creator boolean (DOMString name, boolean value);
|
||||
deleter boolean (DOMString name);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface SpecialMethodsCombination {
|
||||
setter creator long long (unsigned long index, long long value);
|
||||
getter deleter boolean (DOMString name);
|
||||
setter creator boolean (DOMString name, boolean value);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
|
||||
def checkMethod(method, QName, name,
|
||||
static=False, getter=False, setter=False, creator=False,
|
||||
static=False, getter=False, setter=False,
|
||||
deleter=False, legacycaller=False, stringifier=False):
|
||||
harness.ok(isinstance(method, WebIDL.IDLMethod),
|
||||
"Should be an IDLMethod")
|
||||
|
@ -32,7 +28,6 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(method.isStatic(), static, "Method has the correct static value")
|
||||
harness.check(method.isGetter(), getter, "Method has the correct getter value")
|
||||
harness.check(method.isSetter(), setter, "Method has the correct setter value")
|
||||
harness.check(method.isCreator(), creator, "Method has the correct creator value")
|
||||
harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
|
||||
harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
|
||||
harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
|
||||
|
@ -40,32 +35,24 @@ def WebIDLTest(parser, harness):
|
|||
harness.check(len(results), 2, "Expect 2 interfaces")
|
||||
|
||||
iface = results[0]
|
||||
harness.check(len(iface.members), 8, "Expect 8 members")
|
||||
harness.check(len(iface.members), 6, "Expect 6 members")
|
||||
|
||||
checkMethod(iface.members[0], "::SpecialMethods::__indexedgetter", "__indexedgetter",
|
||||
getter=True)
|
||||
checkMethod(iface.members[1], "::SpecialMethods::__indexedsetter", "__indexedsetter",
|
||||
setter=True)
|
||||
checkMethod(iface.members[2], "::SpecialMethods::__indexedcreator", "__indexedcreator",
|
||||
creator=True)
|
||||
checkMethod(iface.members[3], "::SpecialMethods::__namedgetter", "__namedgetter",
|
||||
checkMethod(iface.members[2], "::SpecialMethods::__namedgetter", "__namedgetter",
|
||||
getter=True)
|
||||
checkMethod(iface.members[4], "::SpecialMethods::__namedsetter", "__namedsetter",
|
||||
checkMethod(iface.members[3], "::SpecialMethods::__namedsetter", "__namedsetter",
|
||||
setter=True)
|
||||
checkMethod(iface.members[5], "::SpecialMethods::__namedcreator", "__namedcreator",
|
||||
creator=True)
|
||||
checkMethod(iface.members[6], "::SpecialMethods::__nameddeleter", "__nameddeleter",
|
||||
checkMethod(iface.members[4], "::SpecialMethods::__nameddeleter", "__nameddeleter",
|
||||
deleter=True)
|
||||
|
||||
iface = results[1]
|
||||
harness.check(len(iface.members), 3, "Expect 3 members")
|
||||
harness.check(len(iface.members), 1, "Expect 1 member")
|
||||
|
||||
checkMethod(iface.members[0], "::SpecialMethodsCombination::__indexedsettercreator",
|
||||
"__indexedsettercreator", setter=True, creator=True)
|
||||
checkMethod(iface.members[1], "::SpecialMethodsCombination::__namedgetterdeleter",
|
||||
checkMethod(iface.members[0], "::SpecialMethodsCombination::__namedgetterdeleter",
|
||||
"__namedgetterdeleter", getter=True, deleter=True)
|
||||
checkMethod(iface.members[2], "::SpecialMethodsCombination::__namedsettercreator",
|
||||
"__namedsettercreator", setter=True, creator=True)
|
||||
|
||||
parser = parser.reset();
|
||||
|
||||
|
|
|
@ -31,27 +31,12 @@ def WebIDLTest(parser, harness):
|
|||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodUniqueness1 {
|
||||
setter creator boolean (DOMString name);
|
||||
creator boolean (DOMString name);
|
||||
};
|
||||
""")
|
||||
|
||||
results = parser.finish()
|
||||
except:
|
||||
threw = True
|
||||
|
||||
harness.ok(threw, "Should have thrown.")
|
||||
|
||||
threw = False
|
||||
try:
|
||||
parser.parse("""
|
||||
interface SpecialMethodUniqueness1 {
|
||||
setter boolean (DOMString name);
|
||||
creator setter boolean (DOMString name);
|
||||
setter boolean (DOMString name);
|
||||
};
|
||||
""")
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@ use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
|
|||
use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
|
||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
|
||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
||||
use dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferView;
|
||||
use dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer;
|
||||
use dom::bindings::codegen::UnionTypes::Float32ArrayOrUnrestrictedFloatSequence;
|
||||
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
|
||||
use dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence;
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
use dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use dom::bindings::root::{Dom, DomRoot, LayoutDom};
|
||||
|
@ -32,7 +34,7 @@ use euclid::Size2D;
|
|||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::jsval::JSVal;
|
||||
use js::rust::CustomAutoRooterGuard;
|
||||
use js::typedarray::{ArrayBufferView, Float32Array, Int32Array};
|
||||
use js::typedarray::ArrayBufferView;
|
||||
use offscreen_gl_context::GLContextAttributes;
|
||||
use script_layout_interface::HTMLCanvasDataSource;
|
||||
use std::ptr::NonNull;
|
||||
|
@ -239,7 +241,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferOrArrayBufferView>) {
|
||||
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferViewOrArrayBuffer>) {
|
||||
self.base.BufferSubData(target, offset, data)
|
||||
}
|
||||
|
||||
|
@ -610,29 +612,23 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform1iv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>) {
|
||||
fn Uniform1iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.base.Uniform1iv(location, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform1iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||
self.base.Uniform1iv_(location, v);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform1fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn Uniform1fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.Uniform1fv(location, v);
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform1fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
self.base.Uniform1fv_(location, v);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2f(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
|
@ -641,15 +637,12 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.base.Uniform2fv(location, v)
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
self.base.Uniform2fv_(location, v);
|
||||
fn Uniform2fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.Uniform2fv(location, v);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
|
@ -660,17 +653,14 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2iv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>) {
|
||||
fn Uniform2iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.base.Uniform2iv(location, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||
self.base.Uniform2iv_(location, v);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3f(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
|
@ -679,15 +669,12 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.base.Uniform3fv(location, v)
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
self.base.Uniform3fv_(location, v);
|
||||
fn Uniform3fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.Uniform3fv(location, v);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
|
@ -698,19 +685,14 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3iv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>) {
|
||||
fn Uniform3iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.base.Uniform3iv(location, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3iv_(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Vec<i32>) {
|
||||
self.base.Uniform3iv_(location, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4i(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
|
@ -718,21 +700,15 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
self.base.Uniform4i(location, x, y, z, w)
|
||||
}
|
||||
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4iv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>) {
|
||||
fn Uniform4iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.base.Uniform4iv(location, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4iv_(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Vec<i32>) {
|
||||
self.base.Uniform4iv_(location, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4f(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
|
@ -741,56 +717,44 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.base.Uniform4fv(location, v)
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
self.base.Uniform4fv_(location, v);
|
||||
fn Uniform4fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.Uniform4fv(location, v);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix2fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn UniformMatrix2fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.UniformMatrix2fv(location, transpose, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix2fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) {
|
||||
self.base.UniformMatrix2fv_(location, transpose, value);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix3fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn UniformMatrix3fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.UniformMatrix3fv(location, transpose, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix3fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) {
|
||||
self.base.UniformMatrix3fv_(location, transpose, value);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix4fv(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn UniformMatrix4fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.base.UniformMatrix4fv(location, transpose, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix4fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) {
|
||||
self.base.UniformMatrix4fv_(location, transpose, value);
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||
fn UseProgram(&self, program: Option<&WebGLProgram>) {
|
||||
self.base.UseProgram(program)
|
||||
|
@ -807,60 +771,40 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib1fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn VertexAttrib1fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
self.base.VertexAttrib1fv(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib1fv_(&self, indx: u32, v: Vec<f32>) {
|
||||
self.base.VertexAttrib1fv_(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib2f(&self, indx: u32, x: f32, y: f32) {
|
||||
self.base.VertexAttrib2f(indx, x, y)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib2fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn VertexAttrib2fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
self.base.VertexAttrib2fv(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib2fv_(&self, indx: u32, v: Vec<f32>) {
|
||||
self.base.VertexAttrib2fv_(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib3f(&self, indx: u32, x: f32, y: f32, z: f32) {
|
||||
self.base.VertexAttrib3f(indx, x, y, z)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib3fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn VertexAttrib3fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
self.base.VertexAttrib3fv(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib3fv_(&self, indx: u32, v: Vec<f32>) {
|
||||
self.base.VertexAttrib3fv_(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib4f(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
|
||||
self.base.VertexAttrib4f(indx, x, y, z, w)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib4fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
fn VertexAttrib4fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
self.base.VertexAttrib4fv(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib4fv_(&self, indx: u32, v: Vec<f32>) {
|
||||
self.base.VertexAttrib4fv_(indx, v)
|
||||
}
|
||||
|
||||
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttribPointer(&self, attrib_id: u32, size: i32, data_type: u32,
|
||||
normalized: bool, stride: i32, offset: i64) {
|
||||
|
|
|
@ -14,10 +14,12 @@ use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2Rende
|
|||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
|
||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
|
||||
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
|
||||
use dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferView;
|
||||
use dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer;
|
||||
use dom::bindings::codegen::UnionTypes::Float32ArrayOrUnrestrictedFloatSequence;
|
||||
use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
|
||||
use dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence;
|
||||
use dom::bindings::conversions::ToJSValConvertible;
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::error::{Error, ErrorResult};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||
use dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
|
||||
|
@ -50,7 +52,7 @@ use half::f16;
|
|||
use js::jsapi::{JSContext, JSObject, Type};
|
||||
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue};
|
||||
use js::rust::CustomAutoRooterGuard;
|
||||
use js::typedarray::{ArrayBufferView, Float32Array, Int32Array};
|
||||
use js::typedarray::ArrayBufferView;
|
||||
use net_traits::image::base::PixelFormat;
|
||||
use net_traits::image_cache::ImageResponse;
|
||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||
|
@ -1674,7 +1676,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||
unsafe fn BufferData(&self, cx: *mut JSContext, target: u32, data: *mut JSObject, usage: u32) -> Fallible<()> {
|
||||
unsafe fn BufferData(
|
||||
&self,
|
||||
cx: *mut JSContext,
|
||||
target: u32,
|
||||
data: *mut JSObject,
|
||||
usage: u32,
|
||||
) -> ErrorResult {
|
||||
if data.is_null() {
|
||||
return Ok(self.webgl_error(InvalidValue));
|
||||
}
|
||||
|
@ -1709,7 +1717,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||
fn BufferData_(&self, target: u32, size: i64, usage: u32) -> Fallible<()> {
|
||||
fn BufferData_(&self, target: u32, size: i64, usage: u32) -> ErrorResult {
|
||||
let bound_buffer = match target {
|
||||
constants::ARRAY_BUFFER => self.bound_buffer_array.get(),
|
||||
constants::ELEMENT_ARRAY_BUFFER => self.bound_buffer_element_array.get(),
|
||||
|
@ -1741,11 +1749,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferOrArrayBufferView>) {
|
||||
fn BufferSubData(&self, target: u32, offset: i64, data: Option<ArrayBufferViewOrArrayBuffer>) {
|
||||
let data_vec = match data {
|
||||
// Typed array is rooted, so we can safely temporarily retrieve its slice
|
||||
Some(ArrayBufferOrArrayBufferView::ArrayBuffer(mut inner)) => inner.to_vec(),
|
||||
Some(ArrayBufferOrArrayBufferView::ArrayBufferView(mut inner)) => inner.to_vec(),
|
||||
Some(ArrayBufferViewOrArrayBuffer::ArrayBuffer(mut inner)) => inner.to_vec(),
|
||||
Some(ArrayBufferViewOrArrayBuffer::ArrayBufferView(mut inner)) => inner.to_vec(),
|
||||
// Spec: If data is null then an INVALID_VALUE error is generated.
|
||||
None => return self.webgl_error(InvalidValue),
|
||||
};
|
||||
|
@ -2867,13 +2875,12 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform1iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.Uniform1iv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform1iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||
let v = match v {
|
||||
Int32ArrayOrLongSequence::Int32Array(v) => v.to_vec(),
|
||||
Int32ArrayOrLongSequence::LongSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::Int, &v) {
|
||||
self.send_command(WebGLCommand::Uniform1iv(location.unwrap().id(), v))
|
||||
}
|
||||
|
@ -2883,13 +2890,12 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform1fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.Uniform1fv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform1fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::Float, &v) {
|
||||
self.send_command(WebGLCommand::Uniform1fv(location.unwrap().id(), v));
|
||||
}
|
||||
|
@ -2908,16 +2914,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform2fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.Uniform2fv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::FloatVec2,
|
||||
&v) {
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::FloatVec2, &v) {
|
||||
self.send_command(WebGLCommand::Uniform2fv(location.unwrap().id(), v));
|
||||
}
|
||||
}
|
||||
|
@ -2940,16 +2943,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform2iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.Uniform2iv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform2iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::IntVec2,
|
||||
&v) {
|
||||
let v = match v {
|
||||
Int32ArrayOrLongSequence::Int32Array(v) => v.to_vec(),
|
||||
Int32ArrayOrLongSequence::LongSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::IntVec2, &v) {
|
||||
self.send_command(WebGLCommand::Uniform2iv(location.unwrap().id(), v));
|
||||
}
|
||||
}
|
||||
|
@ -2973,16 +2973,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform3fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.Uniform3fv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::FloatVec3,
|
||||
&v) {
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::FloatVec3, &v) {
|
||||
self.send_command(WebGLCommand::Uniform3fv(location.unwrap().id(), v))
|
||||
}
|
||||
}
|
||||
|
@ -3002,16 +2999,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform3iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.Uniform3iv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform3iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::IntVec3,
|
||||
&v) {
|
||||
let v = match v {
|
||||
Int32ArrayOrLongSequence::Int32Array(v) => v.to_vec(),
|
||||
Int32ArrayOrLongSequence::LongSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::IntVec3, &v) {
|
||||
self.send_command(WebGLCommand::Uniform3iv(location.unwrap().id(), v))
|
||||
}
|
||||
}
|
||||
|
@ -3037,16 +3031,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform4iv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Int32Array>,
|
||||
v: Int32ArrayOrLongSequence,
|
||||
) {
|
||||
self.Uniform4iv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::IntVec4,
|
||||
&v) {
|
||||
let v = match v {
|
||||
Int32ArrayOrLongSequence::Int32Array(v) => v.to_vec(),
|
||||
Int32ArrayOrLongSequence::LongSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::IntVec4, &v) {
|
||||
self.send_command(WebGLCommand::Uniform4iv(location.unwrap().id(), v))
|
||||
}
|
||||
}
|
||||
|
@ -3071,16 +3062,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
fn Uniform4fv(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.Uniform4fv_(location, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn Uniform4fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::FloatVec4,
|
||||
&v) {
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::FloatVec4, &v) {
|
||||
self.send_command(WebGLCommand::Uniform4fv(location.unwrap().id(), v))
|
||||
}
|
||||
}
|
||||
|
@ -3090,20 +3078,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.UniformMatrix2fv_(location, transpose, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix2fv_(&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
value: Vec<f32>) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::FloatMat2,
|
||||
&value) {
|
||||
self.send_command(WebGLCommand::UniformMatrix2fv(location.unwrap().id(), transpose, value));
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::FloatMat2, &v) {
|
||||
self.send_command(WebGLCommand::UniformMatrix2fv(location.unwrap().id(), transpose, v));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3112,22 +3094,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.UniformMatrix3fv_(location, transpose, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix3fv_(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
value: Vec<f32>,
|
||||
) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::FloatMat3,
|
||||
&value) {
|
||||
self.send_command(WebGLCommand::UniformMatrix3fv(location.unwrap().id(), transpose, value));
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::FloatMat3, &v) {
|
||||
self.send_command(WebGLCommand::UniformMatrix3fv(location.unwrap().id(), transpose, v));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3136,22 +3110,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
v: CustomAutoRooterGuard<Float32Array>,
|
||||
v: Float32ArrayOrUnrestrictedFloatSequence,
|
||||
) {
|
||||
self.UniformMatrix4fv_(location, transpose, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn UniformMatrix4fv_(
|
||||
&self,
|
||||
location: Option<&WebGLUniformLocation>,
|
||||
transpose: bool,
|
||||
value: Vec<f32>,
|
||||
) {
|
||||
if self.validate_uniform_parameters(location,
|
||||
UniformSetterType::FloatMat4,
|
||||
&value) {
|
||||
self.send_command(WebGLCommand::UniformMatrix4fv(location.unwrap().id(), transpose, value));
|
||||
let v = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if self.validate_uniform_parameters(location, UniformSetterType::FloatMat4, &v) {
|
||||
self.send_command(WebGLCommand::UniformMatrix4fv(location.unwrap().id(), transpose, v));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3178,16 +3144,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib1fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.VertexAttrib1fv_(indx, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib1fv_(&self, indx: u32, values: Vec<f32>) {
|
||||
fn VertexAttrib1fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
let values = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if values.len() < 1 {
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
self.vertex_attrib(indx, values[0], 0f32, 0f32, 1f32);
|
||||
}
|
||||
|
||||
|
@ -3197,16 +3161,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib2fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.VertexAttrib2fv_(indx, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib2fv_(&self, indx: u32, values: Vec<f32>) {
|
||||
fn VertexAttrib2fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
let values = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if values.len() < 2 {
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
self.vertex_attrib(indx, values[0], values[1], 0f32, 1f32);
|
||||
}
|
||||
|
||||
|
@ -3216,16 +3178,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib3fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.VertexAttrib3fv_(indx, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib3fv_(&self, indx: u32, values: Vec<f32>) {
|
||||
fn VertexAttrib3fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
let values = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if values.len() < 3 {
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
self.vertex_attrib(indx, values[0], values[1], values[2], 1f32);
|
||||
}
|
||||
|
||||
|
@ -3235,16 +3195,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib4fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) {
|
||||
self.VertexAttrib4fv_(indx, v.to_vec());
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||
fn VertexAttrib4fv_(&self, indx: u32, values: Vec<f32>) {
|
||||
fn VertexAttrib4fv(&self, indx: u32, v: Float32ArrayOrUnrestrictedFloatSequence) {
|
||||
let values = match v {
|
||||
Float32ArrayOrUnrestrictedFloatSequence::Float32Array(v) => v.to_vec(),
|
||||
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
|
||||
};
|
||||
if values.len() < 4 {
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
self.vertex_attrib(indx, values[0], values[1], values[2], values[3]);
|
||||
}
|
||||
|
||||
|
@ -3304,16 +3262,18 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||
fn TexImage2D(&self,
|
||||
target: u32,
|
||||
level: i32,
|
||||
internal_format: u32,
|
||||
width: i32,
|
||||
height: i32,
|
||||
border: i32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) -> Fallible<()> {
|
||||
fn TexImage2D(
|
||||
&self,
|
||||
target: u32,
|
||||
level: i32,
|
||||
internal_format: u32,
|
||||
width: i32,
|
||||
height: i32,
|
||||
border: i32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>,
|
||||
) -> ErrorResult {
|
||||
if !self.extension_manager.is_tex_type_enabled(data_type) {
|
||||
return Ok(self.webgl_error(InvalidEnum));
|
||||
}
|
||||
|
@ -3437,7 +3397,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
height: i32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
source: &HTMLIFrameElement) -> Fallible<()> {
|
||||
source: &HTMLIFrameElement) -> ErrorResult {
|
||||
// Currently DOMToTexture only supports TEXTURE_2D, RGBA, UNSIGNED_BYTE and no levels.
|
||||
if target != constants::TEXTURE_2D || level != 0 || internal_format != constants::RGBA ||
|
||||
format != constants::RGBA || data_type != constants::UNSIGNED_BYTE {
|
||||
|
@ -3468,16 +3428,18 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||
fn TexSubImage2D(&self,
|
||||
target: u32,
|
||||
level: i32,
|
||||
xoffset: i32,
|
||||
yoffset: i32,
|
||||
width: i32,
|
||||
height: i32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>) -> Fallible<()> {
|
||||
fn TexSubImage2D(
|
||||
&self,
|
||||
target: u32,
|
||||
level: i32,
|
||||
xoffset: i32,
|
||||
yoffset: i32,
|
||||
width: i32,
|
||||
height: i32,
|
||||
format: u32,
|
||||
data_type: u32,
|
||||
mut pixels: CustomAutoRooterGuard<Option<ArrayBufferView>>,
|
||||
) -> ErrorResult {
|
||||
let validator = TexImage2DValidator::new(self, target, level,
|
||||
format, width, height,
|
||||
0, format, data_type);
|
||||
|
|
|
@ -573,10 +573,10 @@ interface WebGL2RenderingContextBase
|
|||
[WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray);
|
||||
void bindVertexArray(WebGLVertexArrayObject? array);*/
|
||||
};
|
||||
WebGL2RenderingContextBase implements WebGLRenderingContextBase;
|
||||
|
||||
[Pref="dom.webgl2.enabled"]
|
||||
interface WebGL2RenderingContext
|
||||
{
|
||||
};
|
||||
WebGL2RenderingContext implements WebGLRenderingContextBase;
|
||||
WebGL2RenderingContext implements WebGL2RenderingContextBase;
|
||||
|
|
|
@ -28,8 +28,9 @@ typedef (ImageData or
|
|||
HTMLImageElement or
|
||||
HTMLCanvasElement or
|
||||
HTMLVideoElement) TexImageSource;
|
||||
typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
|
||||
|
||||
typedef (/*[AllowShared]*/ Float32Array or sequence<GLfloat>) Float32List;
|
||||
typedef (/*[AllowShared]*/ Int32Array or sequence<GLint>) Int32List;
|
||||
|
||||
dictionary WebGLContextAttributes {
|
||||
GLboolean alpha = true;
|
||||
|
@ -470,7 +471,8 @@ interface WebGLRenderingContextBase
|
|||
readonly attribute GLsizei drawingBufferHeight;
|
||||
|
||||
[WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
|
||||
//[WebGLHandlesContextLoss] boolean isContextLost();
|
||||
// FIXME: https://github.com/servo/servo/issues/15266
|
||||
// [WebGLHandlesContextLoss] boolean isContextLost();
|
||||
|
||||
sequence<DOMString>? getSupportedExtensions();
|
||||
object? getExtension(DOMString name);
|
||||
|
@ -489,15 +491,12 @@ interface WebGLRenderingContextBase
|
|||
void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
|
||||
GLenum srcAlpha, GLenum dstAlpha);
|
||||
|
||||
// FIXME(xanewok) from CodegenRust.py:
|
||||
// 'No support for unions as distinguishing arguments yet' for below
|
||||
// original WebIDL function definition
|
||||
// void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
|
||||
// FIXME(xanewok): https://github.com/servo/servo/issues/20513
|
||||
[Throws]
|
||||
void bufferData(GLenum target, object? data, GLenum usage);
|
||||
[Throws]
|
||||
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
|
||||
void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
|
||||
void bufferSubData(GLenum target, GLintptr offset, /*[AllowShared]*/ BufferSource? data);
|
||||
|
||||
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
|
||||
void clear(GLbitfield mask);
|
||||
|
@ -509,17 +508,15 @@ interface WebGLRenderingContextBase
|
|||
|
||||
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border,
|
||||
ArrayBufferView data);
|
||||
/*[AllowShared]*/ ArrayBufferView data);
|
||||
void compressedTexSubImage2D(GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format,
|
||||
ArrayBufferView data);
|
||||
/*[AllowShared]*/ ArrayBufferView data);
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border);
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
|
||||
void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
|
@ -576,7 +573,8 @@ interface WebGLRenderingContextBase
|
|||
GLenum pname);
|
||||
any getProgramParameter(WebGLProgram program, GLenum pname);
|
||||
DOMString? getProgramInfoLog(WebGLProgram program);
|
||||
//any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
// FIXME: https://github.com/servo/servo/issues/20514
|
||||
// any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
any getShaderParameter(WebGLShader shader, GLenum pname);
|
||||
WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
|
||||
DOMString? getShaderInfoLog(WebGLShader shader);
|
||||
|
@ -585,7 +583,7 @@ interface WebGLRenderingContextBase
|
|||
|
||||
any getTexParameter(GLenum target, GLenum pname);
|
||||
|
||||
//any getUniform(WebGLProgram program, WebGLUniformLocation location);
|
||||
// any getUniform(WebGLProgram program, WebGLUniformLocation location);
|
||||
|
||||
WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name);
|
||||
|
||||
|
@ -607,7 +605,7 @@ interface WebGLRenderingContextBase
|
|||
void polygonOffset(GLfloat factor, GLfloat units);
|
||||
|
||||
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, ArrayBufferView? pixels);
|
||||
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
|
||||
|
||||
void renderbufferStorage(GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLsizei height);
|
||||
|
@ -623,11 +621,11 @@ interface WebGLRenderingContextBase
|
|||
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
|
||||
|
||||
// FIXME: Codegen requires that this have [Throws] to match the other one.
|
||||
// FIXME: https://github.com/servo/servo/issues/20516
|
||||
[Throws]
|
||||
void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint border, GLenum format,
|
||||
GLenum type, ArrayBufferView? pixels);
|
||||
GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
|
||||
[Throws]
|
||||
void texImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
||||
|
@ -638,78 +636,52 @@ interface WebGLRenderingContextBase
|
|||
void texParameterf(GLenum target, GLenum pname, GLfloat param);
|
||||
void texParameteri(GLenum target, GLenum pname, GLint param);
|
||||
|
||||
// FIXME: Codegen requires that this have [Throws] to match the other one.
|
||||
// FIXME: https://github.com/servo/servo/issues/20516
|
||||
[Throws]
|
||||
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, ArrayBufferView? pixels);
|
||||
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
|
||||
[Throws]
|
||||
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
|
||||
|
||||
void uniform1f(WebGLUniformLocation? location, GLfloat x);
|
||||
void uniform1fv(WebGLUniformLocation? location, Float32Array v);
|
||||
void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
|
||||
void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
|
||||
void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
|
||||
void uniform1i(WebGLUniformLocation? location, GLint x);
|
||||
void uniform1iv(WebGLUniformLocation? location, Int32Array v);
|
||||
void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
|
||||
|
||||
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
|
||||
void uniform2fv(WebGLUniformLocation? location, Float32Array v);
|
||||
void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||
|
||||
void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
|
||||
void uniform2iv(WebGLUniformLocation? location, Int32Array v);
|
||||
void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
|
||||
|
||||
void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
|
||||
void uniform3fv(WebGLUniformLocation? location, Float32Array v);
|
||||
void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||
|
||||
void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
|
||||
void uniform3iv(WebGLUniformLocation? location, Int32Array v);
|
||||
void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
|
||||
|
||||
void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void uniform4fv(WebGLUniformLocation? location, Float32Array v);
|
||||
void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||
|
||||
void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
|
||||
void uniform4iv(WebGLUniformLocation? location, Int32Array v);
|
||||
void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
|
||||
|
||||
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
Float32Array value);
|
||||
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
sequence<GLfloat> value);
|
||||
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
Float32Array value);
|
||||
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
sequence<GLfloat> value);
|
||||
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
Float32Array value);
|
||||
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
sequence<GLfloat> value);
|
||||
void uniform1fv(WebGLUniformLocation? location, Float32List v);
|
||||
void uniform2fv(WebGLUniformLocation? location, Float32List v);
|
||||
void uniform3fv(WebGLUniformLocation? location, Float32List v);
|
||||
void uniform4fv(WebGLUniformLocation? location, Float32List v);
|
||||
|
||||
void uniform1iv(WebGLUniformLocation? location, Int32List v);
|
||||
void uniform2iv(WebGLUniformLocation? location, Int32List v);
|
||||
void uniform3iv(WebGLUniformLocation? location, Int32List v);
|
||||
void uniform4iv(WebGLUniformLocation? location, Int32List v);
|
||||
|
||||
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
|
||||
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
|
||||
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
|
||||
|
||||
void useProgram(WebGLProgram? program);
|
||||
void validateProgram(WebGLProgram program);
|
||||
|
||||
void vertexAttrib1f(GLuint indx, GLfloat x);
|
||||
void vertexAttrib1fv(GLuint indx, Float32Array values);
|
||||
void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
|
||||
|
||||
void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
|
||||
void vertexAttrib2fv(GLuint indx, Float32Array values);
|
||||
void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
|
||||
|
||||
void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
|
||||
void vertexAttrib3fv(GLuint indx, Float32Array values);
|
||||
void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
|
||||
|
||||
void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
void vertexAttrib4fv(GLuint indx, Float32Array values);
|
||||
void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
|
||||
|
||||
void vertexAttrib1fv(GLuint indx, Float32List values);
|
||||
void vertexAttrib2fv(GLuint indx, Float32List values);
|
||||
void vertexAttrib3fv(GLuint indx, Float32List values);
|
||||
void vertexAttrib4fv(GLuint indx, Float32List values);
|
||||
|
||||
void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
|
||||
GLboolean normalized, GLsizei stride, GLintptr offset);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue