auto merge of #912 : brson/servo/longcat, r=jdm

This also comes with a longcat demo, including about 35k of images that I don't know the copyright status of.
This commit is contained in:
bors-servo 2013-09-11 23:49:02 -07:00
commit 5aa207a7f7
14 changed files with 207 additions and 25 deletions

View file

@ -550,12 +550,13 @@ def addExternalIface(iface, nativeType=None, headerFile=None, pointerType=None):
domInterface['pointerType'] = pointerType
DOMInterfaces[iface] = domInterface
def addHTMLElement(element, concrete=None):
def addHTMLElement(element, concrete=None, needsAbstract=[]):
DOMInterfaces[element] = {
'nativeType': 'AbstractNode<ScriptView>',
'pointerType': '',
'concreteType': concrete if concrete else element,
'customTrace': 'trace'
'customTrace': 'trace',
'needsAbstract': needsAbstract
}
addHTMLElement('Comment')
@ -588,7 +589,7 @@ addHTMLElement('HTMLHeadingElement')
addHTMLElement('HTMLHtmlElement')
addHTMLElement('HTMLHRElement')
addHTMLElement('HTMLIFrameElement')
addHTMLElement('HTMLImageElement')
addHTMLElement('HTMLImageElement', needsAbstract=['width', 'height'])
addHTMLElement('HTMLInputElement')
addHTMLElement('HTMLLabelElement')
addHTMLElement('HTMLLegendElement')

View file

@ -3115,8 +3115,8 @@ class CGGetterCall(CGPerSignatureCall):
A class to generate a native object getter call for a particular IDL
getter.
"""
def __init__(self, returnType, nativeMethodName, descriptor, attr):
CGPerSignatureCall.__init__(self, returnType, [], [],
def __init__(self, argsPre, returnType, nativeMethodName, descriptor, attr):
CGPerSignatureCall.__init__(self, returnType, argsPre, [],
nativeMethodName, False, descriptor,
attr, getter=True)
@ -3290,6 +3290,8 @@ class CGSpecializedGetter(CGAbstractExternMethod):
def definition_body(self):
name = self.attr.identifier.name
nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name))
extraPre = ''
argsPre = []
# resultOutParam does not depend on whether resultAlreadyAddRefed is set
(_, resultOutParam) = getRetvalDeclarationForType(self.attr.type,
self.descriptor,
@ -3297,11 +3299,16 @@ class CGSpecializedGetter(CGAbstractExternMethod):
infallible = ('infallible' in
self.descriptor.getExtendedAttributes(self.attr,
getter=True))
if name in self.descriptor.needsAbstract:
abstractName = re.sub(r'<\w+>', '', self.descriptor.nativeType)
extraPre = ' let abstract_this = %s::from_box(this);\n' % abstractName
argsPre = ['abstract_this']
if resultOutParam or self.attr.type.nullable() or not infallible:
nativeName = "Get" + nativeName
return CGWrapper(CGIndenter(CGGetterCall(self.attr.type, nativeName,
return CGWrapper(CGIndenter(CGGetterCall(argsPre, self.attr.type, nativeName,
self.descriptor, self.attr)),
pre=" let obj = (*obj.unnamed);\n" +
pre=extraPre +
" let obj = (*obj.unnamed);\n" +
" let this = &mut (*this).payload;\n").define()
class CGGenericSetter(CGAbstractBindingMethod):