[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
dglazkov at chromium.org
dglazkov at chromium.org
Wed Jan 6 00:13:06 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 9157fe708d6a23bac9a07a4b40ef93ddeecf22e0
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 30 16:13:48 2009 +0000
2009-12-30 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Adam Barth.
[V8] Generate configuring of all named property getters/setters/enumerators.
https://bugs.webkit.org/show_bug.cgi?id=32996
Refactoring, covered by existing tests.
* bindings/scripts/CodeGeneratorV8.pm: Added generation of named property handlers
for special cases (See bug for more info).
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::getTemplate): Removed custom template configuration of named
property handlers.
* bindings/v8/custom/V8CustomBinding.h: Added decls for Applet, Embed, and Object
elements (these will be generated, too -- later.)
* bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
(WebCore::npObjectNamedGetter): Moved common code to a separate method.
(WebCore::npObjectNamedSetter): Ditto.
(WebCore::NAMED_PROPERTY_GETTER): Added custom handlers for Applet, Embed, and Object
all calling the common method.
(WebCore::NAMED_PROPERTY_SETTER): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 05169ea..1303d0a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2009-12-30 Dimitri Glazkov <dglazkov at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ [V8] Generate configuring of all named property getters/setters/enumerators.
+ https://bugs.webkit.org/show_bug.cgi?id=32996
+
+ Refactoring, covered by existing tests.
+
+ * bindings/scripts/CodeGeneratorV8.pm: Added generation of named property handlers
+ for special cases (See bug for more info).
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::getTemplate): Removed custom template configuration of named
+ property handlers.
+ * bindings/v8/custom/V8CustomBinding.h: Added decls for Applet, Embed, and Object
+ elements (these will be generated, too -- later.)
+ * bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
+ (WebCore::npObjectNamedGetter): Moved common code to a separate method.
+ (WebCore::npObjectNamedSetter): Ditto.
+ (WebCore::NAMED_PROPERTY_GETTER): Added custom handlers for Applet, Embed, and Object
+ all calling the common method.
+ (WebCore::NAMED_PROPERTY_SETTER): Ditto.
+
2009-12-30 Jakub Wieczorek <faw217 at gmail.com>
Reviewed by Simon Hausmann.
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 292e750..0d44500 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1176,13 +1176,21 @@ sub GenerateImplementationNamedPropertyGetter
my $dataNode = shift;
my $namedPropertyGetter = shift;
my $interfaceName = $dataNode->name;
+ my $hasCustomGetter = $dataNode->extendedAttributes->{"HasOverridingNameGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"};
- my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $namedPropertyGetter;
+ # FIXME: Remove hard-coded HTMLOptionsCollection reference by changing HTMLOptionsCollection to not inherit
+ # from HTMLCollection per W3C spec (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#HTMLOptionsCollection).
+ if ($interfaceName eq "HTMLOptionsCollection") {
+ $interfaceName = "HTMLCollection";
+ $hasCustomGetter = 1;
+ }
+
+ my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter || $namedPropertyGetter;
if (!$hasGetter) {
return;
}
- if ($namedPropertyGetter && $namedPropertyGetter->type ne "Node" && !$namedPropertyGetter->extendedAttributes->{"Custom"}) {
+ if ($namedPropertyGetter && $namedPropertyGetter->type ne "Node" && !$namedPropertyGetter->extendedAttributes->{"Custom"} && !$hasCustomGetter) {
$implIncludes{"V8Collection.h"} = 1;
my $type = $namedPropertyGetter->type;
my $classIndex = uc($type);
@@ -1193,10 +1201,22 @@ END
}
my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"};
- my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"};
+ # FIXME: Try to remove hard-coded HTMLDocument reference by aligning handling of document.all with JSC bindings.
+ my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"} || $interfaceName eq "HTMLDocument";
my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"};
+ my $setOn = "Instance";
+
+ # V8 has access-check callback API (see ObjectTemplate::SetAccessCheckCallbacks) and it's used on DOMWindow
+ # instead of deleters or enumerators. In addition, the getter should be set on prototype template, to
+ # get implementation straight out of the DOMWindow prototype regardless of what prototype is actually set
+ # on the object.
+ if ($interfaceName eq "DOMWindow") {
+ $setOn = "Prototype";
+ $hasDeleter = 0;
+ $hasEnumerator = 0;
+ }
- push(@implContent, " desc->InstanceTemplate()->SetNamedPropertyHandler(V8Custom::v8${interfaceName}NamedPropertyGetter, ");
+ push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8Custom::v8${interfaceName}NamedPropertyGetter, ");
push(@implContent, $hasSetter ? "V8Custom::v8${interfaceName}NamedPropertySetter, " : "0, ");
push(@implContent, "0 ,"); # NamedPropertyQuery -- not being used at the moment.
push(@implContent, $hasDeleter ? "V8Custom::v8${interfaceName}NamedPropertyDeleter, " : "0, ");
diff --git a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
index bd2bb7b..8d7bf24 100644
--- a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
+++ b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
@@ -421,3 +421,4 @@
#include "bindings/V8InspectorBackend.cpp"
#include "bindings/V8InspectorFrontendHost.cpp"
#endif
+
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index eef7ec1..ba2d86f 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -280,7 +280,6 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLCollection::callAsFunctionCallback);
break;
case V8ClassIndex::HTMLOPTIONSCOLLECTION:
- descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLCollection));
descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection), USE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection));
descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLCollection::callAsFunctionCallback);
break;
@@ -288,8 +287,6 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLSelectElement), USE_INDEXED_PROPERTY_SETTER(HTMLSelectElement), 0, 0, nodeCollectionIndexedPropertyEnumerator<HTMLSelectElement>, v8::Integer::New(V8ClassIndex::NODE));
break;
case V8ClassIndex::HTMLDOCUMENT: {
- descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLDocument), 0, 0, USE_NAMED_PROPERTY_DELETER(HTMLDocument));
-
// We add an extra internal field to all Document wrappers for
// storing a per document DOMImplementation wrapper.
//
@@ -321,15 +318,10 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
// HTMLAppletElement, HTMLEmbedElement and HTMLObjectElement are
// inherited from HTMLPlugInElement, and they share the same property
// handling code.
- descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLPlugInElement), USE_NAMED_PROPERTY_SETTER(HTMLPlugInElement));
descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement), USE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement));
descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLPlugInElement::defaultCallback);
break;
- case V8ClassIndex::HTMLFRAMESETELEMENT:
- descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement));
- break;
case V8ClassIndex::HTMLFORMELEMENT:
- descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLFormElement));
descriptor->InstanceTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(HTMLFormElement), 0, 0, 0, nodeCollectionIndexedPropertyEnumerator<HTMLFormElement>, v8::Integer::New(V8ClassIndex::NODE));
break;
case V8ClassIndex::STYLESHEET: // fall through
@@ -360,7 +352,6 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
case V8ClassIndex::DOMWINDOW: {
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(descriptor);
- descriptor->PrototypeTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(DOMWindow));
descriptor->PrototypeTemplate()->SetIndexedPropertyHandler(USE_INDEXED_PROPERTY_GETTER(DOMWindow));
descriptor->PrototypeTemplate()->SetInternalFieldCount(V8Custom::kDOMWindowInternalFieldCount);
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 32e5df8..ad3a0ae 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -361,8 +361,12 @@ namespace WebCore {
DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap);
DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration);
DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration);
- DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement);
- DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement);
+ DECLARE_NAMED_PROPERTY_GETTER(HTMLAppletElement);
+ DECLARE_NAMED_PROPERTY_SETTER(HTMLAppletElement);
+ DECLARE_NAMED_PROPERTY_GETTER(HTMLEmbedElement);
+ DECLARE_NAMED_PROPERTY_SETTER(HTMLEmbedElement);
+ DECLARE_NAMED_PROPERTY_GETTER(HTMLObjectElement);
+ DECLARE_NAMED_PROPERTY_SETTER(HTMLObjectElement);
DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement);
DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement);
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
index 3212cb6..6acd689 100644
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -41,9 +41,11 @@
namespace WebCore {
-NAMED_PROPERTY_GETTER(HTMLPlugInElement)
+// FIXME: Consider moving getter/setter helpers to V8NPObject and renaming this file to V8PluginElementFunctions
+// to match JSC bindings naming convention.
+
+static v8::Handle<v8::Value> npObjectNamedGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.HTMLPlugInElement.NamedPropertyGetter");
HTMLPlugInElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
ScriptInstance scriptInstance = imp->getInstance();
if (!scriptInstance)
@@ -56,9 +58,8 @@ NAMED_PROPERTY_GETTER(HTMLPlugInElement)
return npObjectGetNamedProperty(instance, name);
}
-NAMED_PROPERTY_SETTER(HTMLPlugInElement)
+static v8::Handle<v8::Value> npObjectNamedSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.HTMLPlugInElement.NamedPropertySetter");
HTMLPlugInElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLPlugInElement>(info.Holder());
ScriptInstance scriptInstance = imp->getInstance();
if (!scriptInstance)
@@ -71,6 +72,42 @@ NAMED_PROPERTY_SETTER(HTMLPlugInElement)
return npObjectSetNamedProperty(instance, name, value);
}
+NAMED_PROPERTY_GETTER(HTMLAppletElement)
+{
+ INC_STATS("DOM.HTMLAppletElement.NamedPropertyGetter");
+ return npObjectNamedGetter(name, info);
+}
+
+NAMED_PROPERTY_GETTER(HTMLEmbedElement)
+{
+ INC_STATS("DOM.HTMLEmbedElement.NamedPropertyGetter");
+ return npObjectNamedGetter(name, info);
+}
+
+NAMED_PROPERTY_GETTER(HTMLObjectElement)
+{
+ INC_STATS("DOM.HTMLObjectElement.NamedPropertyGetter");
+ return npObjectNamedGetter(name, info);
+}
+
+NAMED_PROPERTY_SETTER(HTMLAppletElement)
+{
+ INC_STATS("DOM.HTMLAppletElement.NamedPropertySetter");
+ return npObjectNamedSetter(name, value, info);
+}
+
+NAMED_PROPERTY_SETTER(HTMLEmbedElement)
+{
+ INC_STATS("DOM.HTMLEmbedElement.NamedPropertySetter");
+ return npObjectNamedSetter(name, value, info);
+}
+
+NAMED_PROPERTY_SETTER(HTMLObjectElement)
+{
+ INC_STATS("DOM.HTMLObjectElement.NamedPropertySetter");
+ return npObjectNamedSetter(name, value, info);
+}
+
v8::Handle<v8::Value> V8HTMLPlugInElement::defaultCallback(const v8::Arguments& args)
{
INC_STATS("DOM.HTMLPluginElement()");
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list