summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/scripts
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
commit635860845790a19bf50bbc51ba8fb66a96dde068 (patch)
treeef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/bindings/scripts
parent8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff)
downloadexternal_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/bindings/scripts')
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorJS.pm276
-rw-r--r--WebCore/bindings/scripts/CodeGeneratorObjC.pm6
-rw-r--r--WebCore/bindings/scripts/InFilesParser.pm14
3 files changed, 193 insertions, 103 deletions
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index a095fc7..2af88e2 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
# Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
# Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
-# Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+# Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -279,8 +279,8 @@ sub GenerateGetOwnPropertySlotBody
my @getOwnPropertySlotImpl = ();
if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection") {
- push(@getOwnPropertySlotImpl, " ${namespaceMaybe}JSValue* proto = prototype();\n");
- push(@getOwnPropertySlotImpl, " if (proto->isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
+ push(@getOwnPropertySlotImpl, " ${namespaceMaybe}JSValuePtr proto = prototype();\n");
+ push(@getOwnPropertySlotImpl, " if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
push(@getOwnPropertySlotImpl, " return false;\n\n");
}
@@ -395,7 +395,7 @@ sub GenerateHeader
}
if ($dataNode->extendedAttributes->{"InlineGetOwnPropertySlot"}) {
- push(@headerContentHeader, "#include <kjs/lookup.h>\n");
+ push(@headerContentHeader, "#include <runtime/Lookup.h>\n");
push(@headerContentHeader, "#include <wtf/AlwaysInline.h>\n");
}
@@ -427,18 +427,18 @@ sub GenerateHeader
# Constructor
if ($interfaceName eq "DOMWindow") {
- push(@headerContent, " $className(PassRefPtr<JSC::StructureID>, PassRefPtr<$implType>, JSDOMWindowShell*);\n");
+ push(@headerContent, " $className(PassRefPtr<JSC::Structure>, PassRefPtr<$implType>, JSDOMWindowShell*);\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@headerContent, " $className(PassRefPtr<JSC::StructureID>, PassRefPtr<$implType>, SVGElement* context);\n");
+ push(@headerContent, " $className(PassRefPtr<JSC::Structure>, PassRefPtr<$implType>, SVGElement* context);\n");
} else {
- push(@headerContent, " $className(PassRefPtr<JSC::StructureID>, PassRefPtr<$implType>);\n");
+ push(@headerContent, " $className(PassRefPtr<JSC::Structure>, PassRefPtr<$implType>);\n");
}
# Destructor
push(@headerContent, " virtual ~$className();\n") if (!$hasParent or $interfaceName eq "Document");
# Prototype
- push(@headerContent, " static JSC::JSObject* createPrototype(JSC::ExecState*);\n") if $interfaceName ne "DOMWindow";
+ push(@headerContent, " static JSC::JSObject* createPrototype(JSC::ExecState*);\n") unless ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"});
$implIncludes{"${className}Custom.h"} = 1 if $dataNode->extendedAttributes->{"CustomHeader"} || $dataNode->extendedAttributes->{"CustomPutFunction"};
@@ -471,9 +471,9 @@ sub GenerateHeader
# Getters
if ($hasSetter) {
- push(@headerContent, " virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue*, JSC::PutPropertySlot&);\n");
- push(@headerContent, " virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValue*);\n") if $dataNode->extendedAttributes->{"HasCustomIndexSetter"};
- push(@headerContent, " bool customPut(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue*, JSC::PutPropertySlot&);\n") if $dataNode->extendedAttributes->{"CustomPutFunction"};
+ push(@headerContent, " virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValuePtr, JSC::PutPropertySlot&);\n");
+ push(@headerContent, " virtual void put(JSC::ExecState*, unsigned propertyName, JSC::JSValuePtr);\n") if $dataNode->extendedAttributes->{"HasCustomIndexSetter"};
+ push(@headerContent, " bool customPut(JSC::ExecState*, const JSC::Identifier&, JSC::JSValuePtr, JSC::PutPropertySlot&);\n") if $dataNode->extendedAttributes->{"CustomPutFunction"};
}
# Class info
@@ -483,15 +483,15 @@ sub GenerateHeader
# Structure ID
if ($interfaceName eq "DOMWindow") {
push(@headerContent,
- " static PassRefPtr<JSC::StructureID> createStructureID(JSC::JSValue* prototype)\n" .
+ " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValuePtr prototype)\n" .
" {\n" .
- " return JSC::StructureID::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::ImplementsHasInstance | JSC::NeedsThisConversion));\n" .
+ " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::ImplementsHasInstance | JSC::NeedsThisConversion));\n" .
" }\n\n");
} elsif ($hasGetter) {
push(@headerContent,
- " static PassRefPtr<JSC::StructureID> createStructureID(JSC::JSValue* prototype)\n" .
+ " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValuePtr prototype)\n" .
" {\n" .
- " return JSC::StructureID::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" .
+ " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" .
" }\n\n");
}
@@ -521,13 +521,13 @@ sub GenerateHeader
push(@headerContent, " virtual void defineSetter(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction);\n") if $dataNode->extendedAttributes->{"CustomDefineSetter"};
# Custom lookupGetter function
- push(@headerContent, " virtual JSC::JSValue* lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupGetter"};
+ push(@headerContent, " virtual JSC::JSValuePtr lookupGetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupGetter"};
# Custom lookupSetter function
- push(@headerContent, " virtual JSC::JSValue* lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupSetter"};
+ push(@headerContent, " virtual JSC::JSValuePtr lookupSetter(JSC::ExecState*, const JSC::Identifier& propertyName);\n") if $dataNode->extendedAttributes->{"CustomLookupSetter"};
# Constructor object getter
- push(@headerContent, " static JSC::JSValue* getConstructor(JSC::ExecState*);\n") if $dataNode->extendedAttributes->{"GenerateConstructor"};
+ push(@headerContent, " static JSC::JSValuePtr getConstructor(JSC::ExecState*);\n") if $dataNode->extendedAttributes->{"GenerateConstructor"};
my $numCustomFunctions = 0;
my $numCustomAttributes = 0;
@@ -547,15 +547,15 @@ sub GenerateHeader
foreach my $attribute (@{$dataNode->attributes}) {
if ($attribute->signature->extendedAttributes->{"Custom"}) {
- push(@headerContent, " JSC::JSValue* " . $codeGenerator->WK_lcfirst($attribute->signature->name) . "(JSC::ExecState*) const;\n");
+ push(@headerContent, " JSC::JSValuePtr " . $codeGenerator->WK_lcfirst($attribute->signature->name) . "(JSC::ExecState*) const;\n");
if ($attribute->type !~ /^readonly/) {
- push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue*);\n");
+ push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValuePtr);\n");
}
} elsif ($attribute->signature->extendedAttributes->{"CustomGetter"}) {
- push(@headerContent, " JSC::JSValue* " . $codeGenerator->WK_lcfirst($attribute->signature->name) . "(JSC::ExecState*) const;\n");
+ push(@headerContent, " JSC::JSValuePtr " . $codeGenerator->WK_lcfirst($attribute->signature->name) . "(JSC::ExecState*) const;\n");
} elsif ($attribute->signature->extendedAttributes->{"CustomSetter"}) {
if ($attribute->type !~ /^readonly/) {
- push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue*);\n");
+ push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValuePtr);\n");
}
}
}
@@ -570,7 +570,7 @@ sub GenerateHeader
foreach my $function (@{$dataNode->functions}) {
if ($function->signature->extendedAttributes->{"Custom"}) {
my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name);
- push(@headerContent, " JSC::JSValue* " . $functionImplementationName . "(JSC::ExecState*, const JSC::ArgList&);\n");
+ push(@headerContent, " JSC::JSValuePtr " . $functionImplementationName . "(JSC::ExecState*, const JSC::ArgList&);\n");
}
}
}
@@ -602,21 +602,21 @@ sub GenerateHeader
# Index getter
if ($dataNode->extendedAttributes->{"HasIndexGetter"}) {
- push(@headerContent, " static JSC::JSValue* indexGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
+ push(@headerContent, " static JSC::JSValuePtr indexGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
}
if ($dataNode->extendedAttributes->{"HasCustomIndexGetter"}) {
- push(@headerContent, " JSC::JSValue* getByIndex(JSC::ExecState*, unsigned index);\n");
+ push(@headerContent, " JSC::JSValuePtr getByIndex(JSC::ExecState*, unsigned index);\n");
}
# Index setter
if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) {
- push(@headerContent, " void indexSetter(JSC::ExecState*, unsigned index, JSC::JSValue*);\n");
+ push(@headerContent, " void indexSetter(JSC::ExecState*, unsigned index, JSC::JSValuePtr);\n");
}
# Name getter
if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) {
push(@headerContent, "private:\n");
push(@headerContent, " static bool canGetItemsForName(JSC::ExecState*, $implClassName*, const JSC::Identifier&);\n");
- push(@headerContent, " static JSC::JSValue* nameGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
+ push(@headerContent, " static JSC::JSValuePtr nameGetter(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
}
push(@headerContent, "};\n\n");
@@ -630,30 +630,31 @@ sub GenerateHeader
if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"}) {
if ($podType) {
- push(@headerContent, "JSC::JSValue* toJS(JSC::ExecState*, JSSVGPODTypeWrapper<$podType>*, SVGElement* context);\n");
+ push(@headerContent, "JSC::JSValuePtr toJS(JSC::ExecState*, JSSVGPODTypeWrapper<$podType>*, SVGElement* context);\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@headerContent, "JSC::JSValue* toJS(JSC::ExecState*, $implType*, SVGElement* context);\n");
+ push(@headerContent, "JSC::JSValuePtr toJS(JSC::ExecState*, $implType*, SVGElement* context);\n");
} else {
- push(@headerContent, "JSC::JSValue* toJS(JSC::ExecState*, $implType*);\n");
+ push(@headerContent, "JSC::JSValuePtr toJS(JSC::ExecState*, $implType*);\n");
}
# Resolve ambiguity with EventTarget that otherwise exists.
if ($interfaceName eq "Node") {
- push(@headerContent, "inline JSC::JSValue* toJS(JSC::ExecState* exec, EventTargetNode* node) { return toJS(exec, static_cast<Node*>(node)); }\n");
+ push(@headerContent, "inline JSC::JSValuePtr toJS(JSC::ExecState* exec, EventTargetNode* node) { return toJS(exec, static_cast<Node*>(node)); }\n");
}
}
if (!$hasParent || $dataNode->extendedAttributes->{"GenerateNativeConverter"}) {
if ($podType) {
- push(@headerContent, "$podType to${interfaceName}(JSC::JSValue*);\n");
+ push(@headerContent, "$podType to${interfaceName}(JSC::JSValuePtr);\n");
} elsif ($interfaceName eq "NodeFilter") {
- push(@headerContent, "PassRefPtr<NodeFilter> toNodeFilter(JSC::JSValue*);\n");
+ push(@headerContent, "PassRefPtr<NodeFilter> toNodeFilter(JSC::JSValuePtr);\n");
} else {
- push(@headerContent, "$implClassName* to${interfaceName}(JSC::JSValue*);\n");
- }
- if ($interfaceName eq "Node" or $interfaceName eq "Element" or $interfaceName eq "Text") {
- push(@headerContent, "JSC::JSValue* toJSNewlyCreated(JSC::ExecState*, $interfaceName*);\n");
+ push(@headerContent, "$implClassName* to${interfaceName}(JSC::JSValuePtr);\n");
}
}
+ if ($interfaceName eq "Node" or $interfaceName eq "Element" or $interfaceName eq "Text" or $interfaceName eq "CDATASection") {
+ push(@headerContent, "JSC::JSValuePtr toJSNewlyCreated(JSC::ExecState*, $interfaceName*);\n");
+ }
+
push(@headerContent, "\n");
# Add prototype declaration.
@@ -661,6 +662,8 @@ sub GenerateHeader
push(@headerContent, "public:\n");
if ($interfaceName eq "DOMWindow") {
push(@headerContent, " void* operator new(size_t);\n");
+ } elsif ($interfaceName eq "WorkerContext") {
+ push(@headerContent, " void* operator new(size_t, JSC::JSGlobalData*);\n");
} else {
push(@headerContent, " static JSC::JSObject* self(JSC::ExecState*);\n");
}
@@ -669,12 +672,12 @@ sub GenerateHeader
if ($numFunctions > 0 || $numConstants > 0) {
push(@headerContent, " virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n");
push(@headerContent,
- " static PassRefPtr<JSC::StructureID> createStructureID(JSC::JSValue* prototype)\n" .
+ " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValuePtr prototype)\n" .
" {\n" .
- " return JSC::StructureID::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" .
+ " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" .
" }\n");
}
- push(@headerContent, " ${className}Prototype(PassRefPtr<JSC::StructureID> structure) : JSC::JSObject(structure) { }\n");
+ push(@headerContent, " ${className}Prototype(PassRefPtr<JSC::Structure> structure) : JSC::JSObject(structure) { }\n");
push(@headerContent, "};\n\n");
@@ -682,7 +685,7 @@ sub GenerateHeader
push(@headerContent,"// Functions\n\n");
foreach my $function (@{$dataNode->functions}) {
my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name);
- push(@headerContent, "JSC::JSValue* ${functionName}(JSC::ExecState*, JSC::JSObject*, JSC::JSValue*, const JSC::ArgList&);\n");
+ push(@headerContent, "JSC::JSValuePtr ${functionName}(JSC::ExecState*, JSC::JSObject*, JSC::JSValuePtr, const JSC::ArgList&);\n");
}
}
@@ -690,16 +693,16 @@ sub GenerateHeader
push(@headerContent,"// Attributes\n\n");
foreach my $attribute (@{$dataNode->attributes}) {
my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
- push(@headerContent, "JSC::JSValue* ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
+ push(@headerContent, "JSC::JSValuePtr ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
unless ($attribute->type =~ /readonly/) {
my $setter = "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
- push(@headerContent, "void ${setter}(JSC::ExecState*, JSC::JSObject*, JSC::JSValue*);\n");
+ push(@headerContent, "void ${setter}(JSC::ExecState*, JSC::JSObject*, JSC::JSValuePtr);\n");
}
}
if ($dataNode->extendedAttributes->{"GenerateConstructor"}) {
my $getter = "js" . $interfaceName . "Constructor";
- push(@headerContent, "JSC::JSValue* ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
+ push(@headerContent, "JSC::JSValuePtr ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
}
}
@@ -707,7 +710,7 @@ sub GenerateHeader
push(@headerContent,"// Constants\n\n");
foreach my $constant (@{$dataNode->constants}) {
my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
- push(@headerContent, "JSC::JSValue* ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
+ push(@headerContent, "JSC::JSValuePtr ${getter}(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&);\n");
}
}
@@ -767,6 +770,7 @@ sub GenerateImplementation
$numAttributes++ if $dataNode->extendedAttributes->{"GenerateConstructor"};
if ($numAttributes > 0) {
+ my $hashSize = $numAttributes;
my $hashName = $className . "Table";
my @hashKeys = ();
@@ -806,7 +810,7 @@ sub GenerateImplementation
push(@hashSpecials, "DontEnum|ReadOnly"); # FIXME: Setting the constructor should be possible.
}
- $object->GenerateHashTable($hashName,
+ $object->GenerateHashTable($hashName, $hashSize,
\@hashKeys, \@hashSpecials,
\@hashValue1, \@hashValue2);
}
@@ -816,6 +820,7 @@ sub GenerateImplementation
# - Add all constants
if ($dataNode->extendedAttributes->{"GenerateConstructor"}) {
+ $hashSize = $numConstants;
$hashName = $className . "ConstructorTable";
@hashKeys = ();
@@ -832,7 +837,7 @@ sub GenerateImplementation
push(@hashSpecials, "DontDelete|ReadOnly");
}
- $object->GenerateHashTable($hashName,
+ $object->GenerateHashTable($hashName, $hashSize,
\@hashKeys, \@hashSpecials,
\@hashValue1, \@hashValue2);
@@ -843,6 +848,7 @@ sub GenerateImplementation
}
# - Add functions and constants to a hashtable definition
+ $hashSize = $numFunctions + $numConstants;
$hashName = $className . "PrototypeTable";
@hashKeys = ();
@@ -877,7 +883,7 @@ sub GenerateImplementation
push(@hashSpecials, $special);
}
- $object->GenerateHashTable($hashName,
+ $object->GenerateHashTable($hashName, $hashSize,
\@hashKeys, \@hashSpecials,
\@hashValue1, \@hashValue2);
@@ -890,17 +896,21 @@ sub GenerateImplementation
} else {
push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleClassName}Prototype\", 0, &${className}PrototypeTable, 0 };\n\n");
}
- if ($interfaceName ne "DOMWindow") {
- push(@implContent, "JSObject* ${className}Prototype::self(ExecState* exec)\n");
- push(@implContent, "{\n");
- push(@implContent, " return getDOMPrototype<${className}>(exec);\n");
- push(@implContent, "}\n\n");
- }
if ($interfaceName eq "DOMWindow") {
push(@implContent, "void* ${className}Prototype::operator new(size_t size)\n");
push(@implContent, "{\n");
push(@implContent, " return JSDOMWindow::commonJSGlobalData()->heap.allocate(size);\n");
push(@implContent, "}\n\n");
+ } elsif ($interfaceName eq "WorkerContext") {
+ push(@implContent, "void* ${className}Prototype::operator new(size_t size, JSGlobalData* globalData)\n");
+ push(@implContent, "{\n");
+ push(@implContent, " return globalData->heap.allocate(size);\n");
+ push(@implContent, "}\n\n");
+ } else {
+ push(@implContent, "JSObject* ${className}Prototype::self(ExecState* exec)\n");
+ push(@implContent, "{\n");
+ push(@implContent, " return getDOMPrototype<${className}>(exec);\n");
+ push(@implContent, "}\n\n");
}
if ($numConstants > 0 || $numFunctions > 0) {
push(@implContent, "bool ${className}Prototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
@@ -951,10 +961,18 @@ sub GenerateImplementation
# Constructor
if ($interfaceName eq "DOMWindow") {
AddIncludesForType("JSDOMWindowShell");
- push(@implContent, "${className}::$className(PassRefPtr<StructureID> structure, PassRefPtr<$implType> impl, JSDOMWindowShell* shell)\n");
+ push(@implContent, "${className}::$className(PassRefPtr<Structure> structure, PassRefPtr<$implType> impl, JSDOMWindowShell* shell)\n");
push(@implContent, " : $parentClassName(structure, impl, shell)\n");
} else {
- push(@implContent, "${className}::$className(PassRefPtr<StructureID> structure, PassRefPtr<$implType> impl" . ($needsSVGContext ? ", SVGElement* context" : "") . ")\n");
+ my $contextArg = "";
+ if ($needsSVGContext) {
+ if ($hasParent && !$parentNeedsSVGContext) {
+ $contextArg = ", SVGElement*";
+ } else {
+ $contextArg = ", SVGElement* context";
+ }
+ }
+ push(@implContent, "${className}::$className(PassRefPtr<Structure> structure, PassRefPtr<$implType> impl$contextArg)\n");
if ($hasParent) {
push(@implContent, " : $parentClassName(structure, impl" . ($parentNeedsSVGContext ? ", context" : "") . ")\n");
} else {
@@ -996,13 +1014,13 @@ sub GenerateImplementation
push(@implContent, "{\n forgetDOMObject(*Heap::heap(this)->globalData(), static_cast<${implClassName}*>(impl()));\n}\n\n");
}
- if ($interfaceName ne "DOMWindow") {
+ if (!$dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) {
push(@implContent, "JSObject* ${className}::createPrototype(ExecState* exec)\n");
push(@implContent, "{\n");
if ($hasParent && $parentClassName ne "JSC::DOMNodeFilter") {
- push(@implContent, " return new (exec) ${className}Prototype(${className}Prototype::createStructureID(${parentClassName}Prototype::self(exec)));\n");
+ push(@implContent, " return new (exec) ${className}Prototype(${className}Prototype::createStructure(${parentClassName}Prototype::self(exec)));\n");
} else {
- push(@implContent, " return new (exec) ${className}Prototype(${className}Prototype::createStructureID(exec->lexicalGlobalObject()->objectPrototype()));\n");
+ push(@implContent, " return new (exec) ${className}Prototype(${className}Prototype::createStructure(exec->lexicalGlobalObject()->objectPrototype()));\n");
}
push(@implContent, "}\n\n");
}
@@ -1047,7 +1065,7 @@ sub GenerateImplementation
my $getFunctionName = "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
my $implGetterFunctionName = $codeGenerator->WK_lcfirst($name);
- push(@implContent, "JSValue* ${getFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
+ push(@implContent, "JSValuePtr ${getFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
push(@implContent, "{\n");
my $implClassNameForValueConversion = "";
@@ -1082,6 +1100,7 @@ sub GenerateImplementation
} else {
$listenerType = "JSUnprotectedEventListener";
}
+ push(@implContent, " UNUSED_PARAM(exec);\n");
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
push(@implContent, " if (${listenerType}* listener = static_cast<${listenerType}*>(imp->$implGetterFunctionName())) {\n");
push(@implContent, " if (JSObject* listenerObj = listener->listenerObj())\n");
@@ -1091,8 +1110,10 @@ sub GenerateImplementation
} elsif ($attribute->signature->type =~ /Constructor$/) {
my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
$constructorType =~ s/Constructor$//;
+ push(@implContent, " UNUSED_PARAM(slot);\n");
push(@implContent, " return JS" . $constructorType . "::getConstructor(exec);\n");
} elsif (!@{$attribute->getterExceptions}) {
+ push(@implContent, " UNUSED_PARAM(exec);\n");
if ($podType) {
push(@implContent, " $podType imp(*static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
if ($podType eq "float") { # Special case for JSSVGNumber
@@ -1115,10 +1136,10 @@ sub GenerateImplementation
if ($podType) {
push(@implContent, " $podType imp(*static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
- push(@implContent, " JSC::JSValue* result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName(ec)", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
+ push(@implContent, " JSC::JSValuePtr result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName(ec)", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
} else {
push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
- push(@implContent, " JSC::JSValue* result = " . NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName(ec)", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
+ push(@implContent, " JSC::JSValuePtr result = " . NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName(ec)", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
}
push(@implContent, " setDOMException(exec, ec);\n");
@@ -1131,7 +1152,7 @@ sub GenerateImplementation
if ($dataNode->extendedAttributes->{"GenerateConstructor"}) {
my $constructorFunctionName = "js" . $interfaceName . "Constructor";
- push(@implContent, "JSValue* ${constructorFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
+ push(@implContent, "JSValuePtr ${constructorFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
push(@implContent, "{\n");
push(@implContent, " return static_cast<$className*>(asObject(slot.slotBase()))->getConstructor(exec);\n");
push(@implContent, "}\n");
@@ -1149,7 +1170,7 @@ sub GenerateImplementation
|| $dataNode->extendedAttributes->{"HasCustomIndexSetter"};
if ($hasSetter) {
- push(@implContent, "void ${className}::put(ExecState* exec, const Identifier& propertyName, JSValue* value, PutPropertySlot& slot)\n");
+ push(@implContent, "void ${className}::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)\n");
push(@implContent, "{\n");
if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) {
push(@implContent, " bool ok;\n");
@@ -1172,7 +1193,7 @@ sub GenerateImplementation
push(@implContent, "}\n\n");
if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) {
- push(@implContent, "void ${className}::put(ExecState* exec, unsigned propertyName, JSValue* value)\n");
+ push(@implContent, "void ${className}::put(ExecState* exec, unsigned propertyName, JSValuePtr value)\n");
push(@implContent, "{\n");
push(@implContent, " indexSetter(exec, propertyName, value);\n");
push(@implContent, " return;\n");
@@ -1187,7 +1208,7 @@ sub GenerateImplementation
my $putFunctionName = "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name);
- push(@implContent, "void ${putFunctionName}(ExecState* exec, JSObject* thisObject, JSValue* value)\n");
+ push(@implContent, "void ${putFunctionName}(ExecState* exec, JSObject* thisObject, JSValuePtr value)\n");
push(@implContent, "{\n");
if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) {
@@ -1210,8 +1231,8 @@ sub GenerateImplementation
} else {
$listenerType = "JSUnprotectedEventListener";
}
- if ($interfaceName eq "DOMWindow") {
- push(@implContent, " JSDOMGlobalObject* globalObject = static_cast<JSDOMWindow*>(thisObject);\n");
+ if ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}) {
+ push(@implContent, " JSDOMGlobalObject* globalObject = static_cast<$className*>(thisObject);\n");
} else {
$implIncludes{"Frame.h"} = 1;
$implIncludes{"JSDOMGlobalObject.h"} = 1;
@@ -1275,7 +1296,7 @@ sub GenerateImplementation
}
if ($dataNode->extendedAttributes->{"GenerateConstructor"}) {
- push(@implContent, "JSValue* ${className}::getConstructor(ExecState* exec)\n{\n");
+ push(@implContent, "JSValuePtr ${className}::getConstructor(ExecState* exec)\n{\n");
push(@implContent, " return getDOMConstructor<${className}Constructor>(exec);\n");
push(@implContent, "}\n\n");
}
@@ -1288,8 +1309,9 @@ sub GenerateImplementation
my $functionName = $codeGenerator->WK_lcfirst($className) . "PrototypeFunction" . $codeGenerator->WK_ucfirst($function->signature->name);
my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name);
- push(@implContent, "JSValue* ${functionName}(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)\n");
+ push(@implContent, "JSValuePtr ${functionName}(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)\n");
push(@implContent, "{\n");
+ push(@implContent, " UNUSED_PARAM(args);\n");
$implKJSInclude{"Error.h"} = 1;
@@ -1298,7 +1320,7 @@ sub GenerateImplementation
push(@implContent, " if (!castedThisObj)\n");
push(@implContent, " return throwError(exec, TypeError);\n");
} else {
- push(@implContent, " if (!thisValue->isObject(&${className}::s_info))\n");
+ push(@implContent, " if (!thisValue.isObject(&${className}::s_info))\n");
push(@implContent, " return throwError(exec, TypeError);\n");
push(@implContent, " $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n");
}
@@ -1341,6 +1363,11 @@ sub GenerateImplementation
my $hasOptionalArguments = 0;
+ if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
+ push(@implContent, " ScriptCallStack callStack(exec, args, $numParameters);\n");
+ $implIncludes{"ScriptCallStack.h"} = 1;
+ }
+
foreach my $parameter (@{$function->parameters}) {
if (!$hasOptionalArguments && $parameter->extendedAttributes->{"Optional"}) {
push(@implContent, "\n int argsCount = args.size();\n");
@@ -1404,7 +1431,7 @@ sub GenerateImplementation
my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
# FIXME: this casts into int to match our previous behavior which turned 0xFFFFFFFF in -1 for NodeFilter.SHOW_ALL
- push(@implContent, "JSValue* ${getter}(ExecState* exec, const Identifier&, const PropertySlot&)\n");
+ push(@implContent, "JSValuePtr ${getter}(ExecState* exec, const Identifier&, const PropertySlot&)\n");
push(@implContent, "{\n");
push(@implContent, " return jsNumber(exec, static_cast<int>(" . $constant->value . "));\n");
push(@implContent, "}\n\n");
@@ -1412,7 +1439,7 @@ sub GenerateImplementation
}
if ($dataNode->extendedAttributes->{"HasIndexGetter"}) {
- push(@implContent, "\nJSValue* ${className}::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)\n");
+ push(@implContent, "\nJSValuePtr ${className}::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
push(@implContent, "{\n");
push(@implContent, " ${className}* thisObj = static_cast<$className*>(asObject(slot.slotBase()));\n");
if (IndexGetterReturnsStrings($implClassName)) {
@@ -1430,11 +1457,11 @@ sub GenerateImplementation
if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !UsesManualToJSImplementation($implClassName)) {
if ($podType) {
- push(@implContent, "JSC::JSValue* toJS(JSC::ExecState* exec, JSSVGPODTypeWrapper<$podType>* object, SVGElement* context)\n");
+ push(@implContent, "JSC::JSValuePtr toJS(JSC::ExecState* exec, JSSVGPODTypeWrapper<$podType>* object, SVGElement* context)\n");
} elsif (IsSVGTypeNeedingContextParameter($implClassName)) {
- push(@implContent, "JSC::JSValue* toJS(JSC::ExecState* exec, $implType* object, SVGElement* context)\n");
+ push(@implContent, "JSC::JSValuePtr toJS(JSC::ExecState* exec, $implType* object, SVGElement* context)\n");
} else {
- push(@implContent, "JSC::JSValue* toJS(JSC::ExecState* exec, $implType* object)\n");
+ push(@implContent, "JSC::JSValuePtr toJS(JSC::ExecState* exec, $implType* object)\n");
}
push(@implContent, "{\n");
@@ -1450,14 +1477,14 @@ sub GenerateImplementation
if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateNativeConverter"}) and !$dataNode->extendedAttributes->{"CustomNativeConverter"}) {
if ($podType) {
- push(@implContent, "$podType to${interfaceName}(JSC::JSValue* value)\n");
+ push(@implContent, "$podType to${interfaceName}(JSC::JSValuePtr value)\n");
} else {
- push(@implContent, "$implClassName* to${interfaceName}(JSC::JSValue* value)\n");
+ push(@implContent, "$implClassName* to${interfaceName}(JSC::JSValuePtr value)\n");
}
push(@implContent, "{\n");
- push(@implContent, " return value->isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : ");
+ push(@implContent, " return value.isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : ");
if ($podType and $podType ne "float") {
push(@implContent, "$podType();\n}\n");
} else {
@@ -1479,6 +1506,12 @@ sub GenerateImplementationFunctionCall()
my $podType = shift;
my $implClassName = shift;
+ if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
+ $functionString .= ", " if $paramIndex;
+ ++$paramIndex;
+ $functionString .= "&callStack";
+ }
+
if (@{$function->raisesExceptions}) {
$functionString .= ", " if $paramIndex;
$functionString .= "ec";
@@ -1495,10 +1528,12 @@ sub GenerateImplementationFunctionCall()
push(@implContent, $indent . "return jsUndefined();\n");
} else {
- push(@implContent, "\n" . $indent . "JSC::JSValue* result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n");
+ push(@implContent, "\n" . $indent . "JSC::JSValuePtr result = " . NativeToJSValue($function->signature, 1, $implClassName, "", $functionString, "castedThisObj") . ";\n");
push(@implContent, $indent . "setDOMException(exec, ec);\n") if @{$function->raisesExceptions};
- if ($podType) {
+ if ($podType and not $function->signature->extendedAttributes->{"Immutable"}) {
+ # Immutable methods do not commit changes back to the instance, thus producing
+ # a new instance rather than mutating existing one.
push(@implContent, $indent . "wrapper->commitChange(imp, castedThisObj->context());\n");
}
@@ -1525,7 +1560,7 @@ my %nativeType = (
"EventTarget" => "EventTargetNode*",
"NodeFilter" => "RefPtr<NodeFilter>",
"SVGLength" => "SVGLength",
- "SVGMatrix" => "AffineTransform",
+ "SVGMatrix" => "TransformationMatrix",
"SVGNumber" => "float",
"SVGPaintType" => "SVGPaint::SVGPaintType",
"SVGPoint" => "FloatPoint",
@@ -1556,18 +1591,18 @@ sub JSValueToNative
my $type = $codeGenerator->StripModule($signature->type);
- return "$value->toBoolean(exec)" if $type eq "boolean";
- return "$value->toNumber(exec)" if $type eq "double";
- return "$value->toFloat(exec)" if $type eq "float" or $type eq "SVGNumber";
- return "$value->toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short";
+ return "$value.toBoolean(exec)" if $type eq "boolean";
+ return "$value.toNumber(exec)" if $type eq "double";
+ return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber";
+ return "$value.toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short";
- return "static_cast<Range::CompareHow>($value->toInt32(exec))" if $type eq "CompareHow";
- return "static_cast<SVGPaint::SVGPaintType>($value->toInt32(exec))" if $type eq "SVGPaintType";
+ return "static_cast<Range::CompareHow>($value.toInt32(exec))" if $type eq "CompareHow";
+ return "static_cast<SVGPaint::SVGPaintType>($value.toInt32(exec))" if $type eq "SVGPaintType";
if ($type eq "DOMString") {
return "valueToStringWithNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertNullToNullString"};
return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"};
- return "$value->toString(exec)";
+ return "$value.toString(exec)";
}
if ($type eq "EventTarget") {
@@ -1726,24 +1761,63 @@ sub GenerateHashTable
my $object = shift;
my $name = shift;
+ my $size = shift;
my $keys = shift;
my $specials = shift;
my $value1 = shift;
my $value2 = shift;
+ # Generate size data for two hash tables
+ # - The 'perfect' size makes a table large enough for perfect hashing
+ # - The 'compact' size uses the legacy table format for smaller table sizes
+
+ # Perfect size
my @hashes = ();
foreach my $key (@{$keys}) {
push @hashes, $object->GenerateHashValue($key);
}
+ # Compact size
+ my @table = ();
+ my @links = ();
+
+ my $compactSize = ceilingToPowerOf2($size * 2);
+
+ my $maxDepth = 0;
+ my $collisions = 0;
+ my $numEntries = $compactSize;
+
+ my $i = 0;
+ foreach (@{$keys}) {
+ my $depth = 0;
+ my $h = $object->GenerateHashValue($_) % $numEntries;
+
+ while (defined($table[$h])) {
+ if (defined($links[$h])) {
+ $h = $links[$h];
+ $depth++;
+ } else {
+ $collisions++;
+ $links[$h] = $compactSize;
+ $h = $compactSize;
+ $compactSize++;
+ }
+ }
+
+ $table[$h] = $i;
+
+ $i++;
+ $maxDepth = $depth if ($depth > $maxDepth);
+ }
+
# Collect hashtable information
- my $size;
+ my $perfectSize;
tableSizeLoop:
- for ($size = ceilingToPowerOf2(scalar @{$keys}); ; $size += $size) {
+ for ($perfectSize = ceilingToPowerOf2(scalar @{$keys}); ; $perfectSize += $perfectSize) {
my @table = ();
my $i = 0;
foreach my $hash (@hashes) {
- my $h = $hash % $size;
+ my $h = $hash % $perfectSize;
next tableSizeLoop if defined $table[$h];
$table[$h] = $i++;
}
@@ -1774,15 +1848,21 @@ tableSizeLoop:
# Dump the hash table
my $count = scalar @{$keys} + 1;
push(@implContent, "\nstatic const HashTableValue $nameEntries\[$count\] =\n\{\n");
- my $i = 0;
+ $i = 0;
foreach my $key (@{$keys}) {
push(@implContent, " { \"$key\", @$specials[$i], (intptr_t)@$value1[$i], (intptr_t)@$value2[$i] },\n");
++$i;
}
push(@implContent, " { 0, 0, 0, 0 }\n");
push(@implContent, "};\n\n");
- my $sizeMask = $size - 1;
- push(@implContent, "static const HashTable $name = { $sizeMask, $nameEntries, 0 };\n\n");
+ my $perfectSizeMask = $perfectSize - 1;
+ my $compactSizeMask = $numEntries - 1;
+ push(@implContent, "static const HashTable $name =\n");
+ push(@implContent, "#if ENABLE(PERFECT_HASH_SIZE)\n");
+ push(@implContent, " { $perfectSizeMask, $nameEntries, 0 };\n");
+ push(@implContent, "#else\n");
+ push(@implContent, " { $compactSize, $compactSizeMask, $nameEntries, 0 };\n");
+ push(@implContent, "#endif\n\n");
}
# Internal helper
@@ -1899,7 +1979,7 @@ my $implContent = << "EOF";
class ${className}Constructor : public DOMObject {
public:
${className}Constructor(ExecState* exec)
- : DOMObject(${className}Constructor::createStructureID(exec->lexicalGlobalObject()->objectPrototype()))
+ : DOMObject(${className}Constructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
{
putDirect(exec->propertyNames().prototype, ${protoClassName}::self(exec), None);
}
@@ -1907,9 +1987,9 @@ public:
virtual const ClassInfo* classInfo() const { return &s_info; }
static const ClassInfo s_info;
- static PassRefPtr<StructureID> createStructureID(JSValue* proto)
+ static PassRefPtr<Structure> createStructure(JSValuePtr proto)
{
- return StructureID::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
+ return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
}
EOF
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index 7969b2c..68fce3d 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -647,7 +647,7 @@ sub AddIncludesForType
}
if ($type eq "SVGMatrix") {
- $implIncludes{"AffineTransform.h"} = 1;
+ $implIncludes{"TransformationMatrix.h"} = 1;
$implIncludes{"DOM$type.h"} = 1;
$implIncludes{"SVGException.h"} = 1;
return;
@@ -1444,8 +1444,8 @@ sub GenerateImplementation
}
# FIXME! We need [Custom] support for ObjC, to move these hacks into DOMSVGLength/MatrixCustom.mm
- my $svgMatrixRotateFromVector = ($podType and $podType eq "AffineTransform" and $functionName eq "rotateFromVector");
- my $svgMatrixInverse = ($podType and $podType eq "AffineTransform" and $functionName eq "inverse");
+ my $svgMatrixRotateFromVector = ($podType and $podType eq "TransformationMatrix" and $functionName eq "rotateFromVector");
+ my $svgMatrixInverse = ($podType and $podType eq "TransformationMatrix" and $functionName eq "inverse");
my $svgLengthConvertToSpecifiedUnits = ($podType and $podType eq "SVGLength" and $functionName eq "convertToSpecifiedUnits");
push(@parameterNames, "ec") if $raisesExceptions and !($svgMatrixRotateFromVector || $svgMatrixInverse);
diff --git a/WebCore/bindings/scripts/InFilesParser.pm b/WebCore/bindings/scripts/InFilesParser.pm
index 89664ed..c6b3644 100644
--- a/WebCore/bindings/scripts/InFilesParser.pm
+++ b/WebCore/bindings/scripts/InFilesParser.pm
@@ -109,7 +109,12 @@ sub parse($)
my ($name, $value) = split '=', $_;
$name = trimWS($name);
- $value = trimQuoteAndWS($value);
+ if (defined($value)) {
+ $value = trimQuoteAndWS($value);
+ } else {
+ # We default to 1 as it eases the syntax.
+ $value = "1";
+ }
&$commonParameterHandler($name, $value);
} else {
@@ -125,7 +130,12 @@ sub parse($)
for (my $i = 0; $i < @options; ++$i) {
($option, $value) = split "=", $options[$i];
$option = trimWS($option);
- $value = trimQuoteAndWS($value);
+ if (defined($value)) {
+ $value = trimQuoteAndWS($value);
+ } else {
+ # We default to 1 as it eases the syntax.
+ $value = "1";
+ }
&$perTagHandler($elementName, $option, $value);
}