[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
dglazkov at chromium.org
dglazkov at chromium.org
Tue Jan 5 23:49:30 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit a28cca871fae89fc0bd7a3780bed10f7dd305706
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 14 22:17:19 2009 +0000
2009-12-14 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Eric Seidel.
[V8] Generate bindings for trivial indexers.
https://bugs.webkit.org/show_bug.cgi?id=32455
Covered by existing tests.
* bindings/scripts/CodeGeneratorV8.pm:
Added detecting indexers and generating code for them.
* bindings/v8/V8Collection.h: Removed code that's now generated.
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::getTemplate): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52120 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8a67e1b..1575810 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-12-14 Dimitri Glazkov <dglazkov at chromium.org>
+
+ Reviewed by Eric Seidel.
+
+ [V8] Generate bindings for trivial indexers.
+ https://bugs.webkit.org/show_bug.cgi?id=32455
+
+ Covered by existing tests.
+
+ * bindings/scripts/CodeGeneratorV8.pm:
+ Added detecting indexers and generating code for them.
+ * bindings/v8/V8Collection.h: Removed code that's now generated.
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::getTemplate): Ditto.
+
2009-12-14 Alexey Proskuryakov <ap at apple.com>
Reviewed by Dave Hyatt.
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 23b74e3..9b6349f 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1127,6 +1127,37 @@ sub GenerateSingleBatchedAttribute
END
}
+sub GenerateImplementationIndexer
+{
+ my $dataNode = shift;
+ my $indexer = shift;
+ my $interfaceName = $dataNode->name;
+
+ if ($dataNode->extendedAttributes->{"HasIndexGetter"}) {
+ $implIncludes{"V8Collection.h"} = 1;
+ if (!$dataNode->extendedAttributes->{"HasCustomIndexGetter"}) {
+ if ($indexer->type eq "DOMString") {
+ my $conversion = $indexer->extendedAttributes->{"ConvertNullStringTo"};
+ if ($conversion && $conversion eq "Null") {
+ push(@implContent, <<END);
+ setCollectionStringOrNullIndexedGetter<${interfaceName}>(desc);
+END
+ } else {
+ push(@implContent, <<END);
+ setCollectionStringIndexedGetter<${interfaceName}>(desc);
+END
+ }
+ } else {
+ my $indexerType = $indexer->type;
+ my $indexerClassIndex = uc($indexerType);
+ push(@implContent, <<END);
+ setCollectionIndexedGetter<${interfaceName}, ${indexerType}>(desc, V8ClassIndex::${indexerClassIndex});
+END
+ }
+ }
+ }
+}
+
sub GenerateImplementation
{
my $object = shift;
@@ -1165,7 +1196,6 @@ sub GenerateImplementation
push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n");
my $hasConstructors = 0;
-
# Generate property accessors for attributes.
for ($index = 0; $index < @{$dataNode->attributes}; $index++) {
$attribute = @{$dataNode->attributes}[$index];
@@ -1216,6 +1246,7 @@ sub GenerateImplementation
GenerateConstructorGetter($implClassName, $classIndex);
}
+ my $indexer;
# Generate methods for functions.
foreach my $function (@{$dataNode->functions}) {
# hack for addEventListener/RemoveEventListener
@@ -1226,6 +1257,10 @@ sub GenerateImplementation
GenerateFunctionCallback($function, $dataNode, $classIndex, $implClassName);
}
+ if ($function->signature->name eq "item") {
+ $indexer = $function->signature;
+ }
+
# If the function does not need domain security check, we need to
# generate an access getter that returns different function objects
# for different calling context.
@@ -1244,6 +1279,7 @@ sub GenerateImplementation
my @enabledAtRuntime;
my @normal;
foreach my $attribute (@$attributes) {
+
if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8DisallowShadowing"}) {
push(@disallowsShadowing, $attribute);
} elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}) {
@@ -1409,6 +1445,8 @@ END
push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
}
+ GenerateImplementationIndexer($dataNode, $indexer) if $indexer;
+
# Define our functions with Set() or SetAccessor()
$total_functions = 0;
foreach my $function (@{$dataNode->functions}) {
diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h
index 0a4134e..8dea839 100644
--- a/WebCore/bindings/v8/V8Collection.h
+++ b/WebCore/bindings/v8/V8Collection.h
@@ -203,17 +203,6 @@ namespace WebCore {
desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0, v8::Integer::New(V8ClassIndex::ToInt(type)));
}
-
- // Add named and indexed getters to the function template for a collection.
- template<class Collection, class ItemType> static void setCollectionIndexedAndNamedGetters(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type)
- {
- // If we interceptor before object, accessing 'length' can trigger a webkit assertion error (see fast/dom/HTMLDocument/document-special-properties.html).
- desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0, v8::Integer::New(V8ClassIndex::ToInt(type)));
- desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionIndexedPropertyGetter<Collection, ItemType>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>,
- v8::Integer::New(V8ClassIndex::ToInt(type)));
- }
-
-
// Add indexed getter returning a string or null to a function template for a collection.
template<class Collection> static void setCollectionStringOrNullIndexedGetter(v8::Handle<v8::FunctionTemplate> desc)
{
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 6591325..4263e73 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -276,26 +276,12 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
// setter. Therefore, the interceptor has to be on the object
// itself and not on the prototype object.
descriptor->InstanceTemplate()->SetNamedPropertyHandler( USE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration), USE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration));
- setCollectionStringIndexedGetter<CSSStyleDeclaration>(descriptor);
- break;
- case V8ClassIndex::CSSRULELIST:
- setCollectionIndexedGetter<CSSRuleList, CSSRule>(descriptor, V8ClassIndex::CSSRULE);
- break;
- case V8ClassIndex::CSSVALUELIST:
- setCollectionIndexedGetter<CSSValueList, CSSValue>(descriptor, V8ClassIndex::CSSVALUE);
- break;
- case V8ClassIndex::CSSVARIABLESDECLARATION:
- setCollectionStringIndexedGetter<CSSVariablesDeclaration>(descriptor);
- break;
- case V8ClassIndex::WEBKITCSSTRANSFORMVALUE:
- setCollectionIndexedGetter<WebKitCSSTransformValue, CSSValue>(descriptor, V8ClassIndex::CSSVALUE);
break;
case V8ClassIndex::HTMLALLCOLLECTION:
descriptor->InstanceTemplate()->MarkAsUndetectable(); // fall through
case V8ClassIndex::HTMLCOLLECTION:
descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLCollection));
descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HTMLCollectionCallAsFunction));
- setCollectionIndexedGetter<HTMLCollection, Node>(descriptor, V8ClassIndex::NODE);
break;
case V8ClassIndex::HTMLOPTIONSCOLLECTION:
descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLCollection));
@@ -361,11 +347,8 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
instanceTemplate->SetInternalFieldCount(V8Custom::kStyleSheetInternalFieldCount);
break;
}
- case V8ClassIndex::MEDIALIST:
- setCollectionStringOrNullIndexedGetter<MediaList>(descriptor);
- break;
case V8ClassIndex::MIMETYPEARRAY:
- setCollectionIndexedAndNamedGetters<MimeTypeArray, MimeType>(descriptor, V8ClassIndex::MIMETYPE);
+ setCollectionNamedGetter<MimeTypeArray, MimeType>(descriptor, V8ClassIndex::MIMETYPE);
break;
case V8ClassIndex::NAMEDNODEMAP: {
// We add an extra internal field to hold a reference to the owner node.
@@ -383,18 +366,16 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
break;
#endif
case V8ClassIndex::NODELIST:
- setCollectionIndexedGetter<NodeList, Node>(descriptor, V8ClassIndex::NODE);
descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(NodeList));
break;
case V8ClassIndex::PLUGIN:
- setCollectionIndexedAndNamedGetters<Plugin, MimeType>(descriptor, V8ClassIndex::MIMETYPE);
+ setCollectionNamedGetter<Plugin, MimeType>(descriptor, V8ClassIndex::MIMETYPE);
break;
case V8ClassIndex::PLUGINARRAY:
- setCollectionIndexedAndNamedGetters<PluginArray, Plugin>(descriptor, V8ClassIndex::PLUGIN);
+ setCollectionNamedGetter<PluginArray, Plugin>(descriptor, V8ClassIndex::PLUGIN);
break;
case V8ClassIndex::STYLESHEETLIST:
descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(StyleSheetList));
- setCollectionIndexedGetter<StyleSheetList, StyleSheet>(descriptor, V8ClassIndex::STYLESHEET);
break;
case V8ClassIndex::DOMWINDOW: {
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(descriptor);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list