[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:32 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 8cbb1df2d9d5b6cc79a993e2982d684a1dc388f0
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 30 19:28:21 2009 +0000
2009-12-30 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Adam Barth.
[V8] Generate configuring of call-as-function callbacks.
https://bugs.webkit.org/show_bug.cgi?id=33061
Refactoring, covered by existing tests.
* bindings/scripts/CodeGeneratorV8.pm: Added GenerateHeaderCustomCall and
GenerateImplementationCustomCall.
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::getTemplate): Removed all hand-configuring of call-as-function
callbacks.
* bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
(WebCore::V8HTMLAppletElement::callAsFunctionCallback): Added.
(WebCore::V8HTMLEmbedElement::callAsFunctionCallback): Added.
(WebCore::V8HTMLObjectElement::callAsFunctionCallback): Added.
* bindings/v8/custom/V8HTMLPlugInElementCustom.h: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a1b5f0b..23bd436 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-12-30 Dimitri Glazkov <dglazkov at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ [V8] Generate configuring of call-as-function callbacks.
+ https://bugs.webkit.org/show_bug.cgi?id=33061
+
+ Refactoring, covered by existing tests.
+
+ * bindings/scripts/CodeGeneratorV8.pm: Added GenerateHeaderCustomCall and
+ GenerateImplementationCustomCall.
+ * bindings/v8/V8DOMWrapper.cpp:
+ (WebCore::V8DOMWrapper::getTemplate): Removed all hand-configuring of call-as-function
+ callbacks.
+ * bindings/v8/custom/V8HTMLPlugInElementCustom.cpp:
+ (WebCore::V8HTMLAppletElement::callAsFunctionCallback): Added.
+ (WebCore::V8HTMLEmbedElement::callAsFunctionCallback): Added.
+ (WebCore::V8HTMLObjectElement::callAsFunctionCallback): Added.
+ * bindings/v8/custom/V8HTMLPlugInElementCustom.h: Removed.
+
2009-12-30 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index b5ade94..2780f21 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -290,7 +290,7 @@ END
END
}
- GenerateSpecialCaseHeaderDeclarations($dataNode);
+ GenerateHeaderCustomCall($dataNode);
push(@headerContent, <<END);
@@ -308,11 +308,11 @@ END
push(@headerContent, "#endif // ${conditionalString}\n\n") if $conditionalString;
}
-sub GenerateSpecialCaseHeaderDeclarations
+sub GenerateHeaderCustomCall
{
my $dataNode = shift;
- if ($dataNode->name eq "HTMLCollection" || $dataNode->name eq "HTMLAllCollection" || $dataNode->name eq "NodeList") {
+ if ($dataNode->extendedAttributes->{"CustomCall"}) {
push(@headerContent, " static v8::Handle<v8::Value> callAsFunctionCallback(const v8::Arguments&);\n");
}
}
@@ -1280,6 +1280,23 @@ END
push(@implContent, ");\n");
}
+sub GenerateImplementationCustomCall
+{
+ my $dataNode = shift;
+ my $interfaceName = $dataNode->name;
+ my $hasCustomCall = $dataNode->extendedAttributes->{"CustomCall"};
+
+ # FIXME: Remove hard-coded HTMLOptionsCollection reference.
+ if ($interfaceName eq "HTMLOptionsCollection") {
+ $interfaceName = "HTMLCollection";
+ $hasCustomCall = 1;
+ }
+
+ if ($hasCustomCall) {
+ push(@implContent, " desc->InstanceTemplate()->SetCallAsFunctionHandler(V8${interfaceName}::callAsFunctionCallback);\n");
+ }
+}
+
sub GenerateImplementation
{
my $object = shift;
@@ -1574,6 +1591,7 @@ END
GenerateImplementationIndexer($dataNode, $indexer);
GenerateImplementationNamedPropertyGetter($dataNode, $namedPropertyGetter);
+ GenerateImplementationCustomCall($dataNode);
# Define our functions with Set() or SetAccessor()
$total_functions = 0;
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 141c160..2ea4c1c 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -48,7 +48,6 @@
#include "V8DOMWindow.h"
#include "V8EventListenerList.h"
#include "V8HTMLCollection.h"
-#include "V8HTMLPlugInElementCustom.h"
#include "V8Index.h"
#include "V8IsolatedWorld.h"
#include "V8NodeList.h"
@@ -275,12 +274,7 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
descriptor->Set(GetToStringName(), toStringTemplate);
switch (type) {
case V8ClassIndex::HTMLALLCOLLECTION:
- descriptor->InstanceTemplate()->MarkAsUndetectable(); // fall through
- case V8ClassIndex::HTMLCOLLECTION:
- descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLCollection::callAsFunctionCallback);
- break;
- case V8ClassIndex::HTMLOPTIONSCOLLECTION:
- descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLCollection::callAsFunctionCallback);
+ descriptor->InstanceTemplate()->MarkAsUndetectable();
break;
case V8ClassIndex::HTMLDOCUMENT: {
// We add an extra internal field to all Document wrappers for
@@ -308,14 +302,6 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
instanceTemplate->SetInternalFieldCount( V8Custom::kDocumentMinimumInternalFieldCount);
break;
}
- case V8ClassIndex::HTMLAPPLETELEMENT: // fall through
- case V8ClassIndex::HTMLEMBEDELEMENT: // fall through
- case V8ClassIndex::HTMLOBJECTELEMENT:
- // HTMLAppletElement, HTMLEmbedElement and HTMLObjectElement are
- // inherited from HTMLPlugInElement, and they share the same property
- // handling code.
- descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8HTMLPlugInElement::defaultCallback);
- break;
case V8ClassIndex::STYLESHEET: // fall through
case V8ClassIndex::CSSSTYLESHEET: {
// We add an extra internal field to hold a reference to
@@ -332,9 +318,6 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
instanceTemplate->SetInternalFieldCount(V8Custom::kNamedNodeMapInternalFieldCount);
break;
}
- case V8ClassIndex::NODELIST:
- descriptor->InstanceTemplate()->SetCallAsFunctionHandler(V8NodeList::callAsFunctionCallback);
- break;
case V8ClassIndex::DOMWINDOW: {
descriptor->PrototypeTemplate()->SetInternalFieldCount(V8Custom::kDOMWindowInternalFieldCount);
descriptor->SetHiddenPrototype(true);
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
index e173ab9..bc2b16c 100644
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
@@ -29,13 +29,14 @@
*/
#include "config.h"
-#include "V8HTMLPlugInElementCustom.h"
-
#include "HTMLPlugInElement.h"
-#include "ScriptInstance.h"
+#include "ScriptInstance.h"
#include "V8Binding.h"
#include "V8CustomBinding.h"
+#include "V8HTMLAppletElement.h"
+#include "V8HTMLEmbedElement.h"
+#include "V8HTMLObjectElement.h"
#include "V8NPObject.h"
#include "V8Proxy.h"
@@ -108,9 +109,21 @@ NAMED_PROPERTY_SETTER(HTMLObjectElement)
return npObjectNamedSetter(name, value, info);
}
-v8::Handle<v8::Value> V8HTMLPlugInElement::defaultCallback(const v8::Arguments& args)
+v8::Handle<v8::Value> V8HTMLAppletElement::callAsFunctionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.HTMLAppletElement()");
+ return npObjectInvokeDefaultHandler(args);
+}
+
+v8::Handle<v8::Value> V8HTMLEmbedElement::callAsFunctionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.HTMLEmbedElement()");
+ return npObjectInvokeDefaultHandler(args);
+}
+
+v8::Handle<v8::Value> V8HTMLObjectElement::callAsFunctionCallback(const v8::Arguments& args)
{
- INC_STATS("DOM.HTMLPluginElement()");
+ INC_STATS("DOM.HTMLObjectElement()");
return npObjectInvokeDefaultHandler(args);
}
diff --git a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.h b/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.h
deleted file mode 100644
index 8e5f061..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLPlugInElementCustom.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2009 Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8HTMLPlugInElementCustom_h
-#define V8HTMLPlugInElementCustom_h
-
-#include <v8.h>
-
-namespace WebCore {
-
-class V8HTMLPlugInElement {
-public:
- static v8::Handle<v8::Value> defaultCallback(const v8::Arguments&);
-};
-
-} // namespace WebCore
-
-#endif // V8HTMLPlugInElementCustom_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list