[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

tony at chromium.org tony at chromium.org
Wed Apr 7 23:06:57 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 80d4e9d260a3768a883b4f2c023539cf7bd0e139
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 26 22:04:00 2009 +0000

    2009-10-26  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Roll back r50073 because r50041-50043 were reverted.  r50073 was
            a chromium side fix for r50041.
            https://bugs.webkit.org/show_bug.cgi?id=30789
    
            * bindings/v8/V8Collection.h:
            * bindings/v8/custom/V8CustomBinding.h:
            * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
            (WebCore::getNamedItems):
            (WebCore::getItem):
            (WebCore::NAMED_PROPERTY_GETTER):
            (WebCore::CALLBACK_FUNC_DECL):
            * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
            (WebCore::getNamedItems):
            (WebCore::getItem):
            (WebCore::NAMED_PROPERTY_GETTER):
            (WebCore::CALLBACK_FUNC_DECL):
            * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50101 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b4ac79f..2129ddd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-10-26  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Roll back r50073 because r50041-50043 were reverted.  r50073 was
+        a chromium side fix for r50041.
+        https://bugs.webkit.org/show_bug.cgi?id=30789
+
+        * bindings/v8/V8Collection.h:
+        * bindings/v8/custom/V8CustomBinding.h:
+        * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp:
+        (WebCore::getNamedItems):
+        (WebCore::getItem):
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
+        (WebCore::getNamedItems):
+        (WebCore::getItem):
+        (WebCore::NAMED_PROPERTY_GETTER):
+        (WebCore::CALLBACK_FUNC_DECL):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+
 2009-10-26  Geoffrey Garen  <ggaren at apple.com>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h
index 8eae2a2..cbfe921 100644
--- a/WebCore/bindings/v8/V8Collection.h
+++ b/WebCore/bindings/v8/V8Collection.h
@@ -34,7 +34,6 @@
 #include "HTMLFormElement.h"
 #include "HTMLSelectElement.h"
 #include "V8Binding.h"
-#include "V8NamedNodesCollection.h"
 #include "V8Proxy.h"
 #include <v8.h>
 
@@ -211,38 +210,6 @@ namespace WebCore {
 
     v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*);
 
-    template<class Collection>
-    v8::Handle<v8::Value> getNamedItemsFromCollection(Collection* collection, AtomicString name)
-    {
-        Vector<RefPtr<Node> > namedItems;
-        collection->namedItems(name, namedItems);
-
-        if (!namedItems.size())
-            return v8::Handle<v8::Value>();
-
-        if (namedItems.size() == 1)
-            return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release());
-
-        NodeList* list = new V8NamedNodesCollection(namedItems);
-        return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
-    }
-
-    template<class Collection>
-    v8::Handle<v8::Value> getItemFromCollection(Collection* collection, v8::Handle<v8::Value> argument)
-    {
-        v8::Local<v8::Uint32> index = argument->ToArrayIndex();
-        if (index.IsEmpty()) {
-            v8::Handle<v8::Value> result = getNamedItemsFromCollection(collection, toWebCoreString(argument->ToString()));
-
-            if (result.IsEmpty())
-                return v8::Undefined();
-
-            return result;
-        }
-
-        RefPtr<Node> result = collection->item(index->Uint32Value());
-        return V8DOMWrapper::convertNodeToV8Object(result.release());
-    }
 } // namespace WebCore
 
 #endif // V8Collection_h
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 1971c96..d9f9344 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -280,8 +280,6 @@ namespace WebCore {
 
         DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue);
 
-        DECLARE_CALLBACK(HTMLOptionsCollectionItem);
-        DECLARE_CALLBACK(HTMLOptionsCollectionNamedItem);
         DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength);
 
         DECLARE_CALLBACK(HTMLInputElementSetSelectionRange);
diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index fb387ea..419f374 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -32,12 +32,43 @@
 #include "HTMLAllCollection.h"
 
 #include "V8Binding.h"
-#include "V8Collection.h"
 #include "V8CustomBinding.h"
+#include "V8NamedNodesCollection.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
 
+static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name)
+{
+    Vector<RefPtr<Node> > namedItems;
+    collection->namedItems(name, namedItems);
+
+    if (!namedItems.size())
+        return v8::Handle<v8::Value>();
+
+    if (namedItems.size() == 1)
+        return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release());
+
+    NodeList* list = new V8NamedNodesCollection(namedItems);
+    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+}
+
+static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument)
+{
+    v8::Local<v8::Uint32> index = argument->ToArrayIndex();
+    if (index.IsEmpty()) {
+        v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()));
+
+        if (result.IsEmpty())
+            return v8::Undefined();
+
+        return result;
+    }
+
+    RefPtr<Node> result = collection->item(index->Uint32Value());
+    return V8DOMWrapper::convertNodeToV8Object(result.release());
+}
+
 NAMED_PROPERTY_GETTER(HTMLAllCollection)
 {
     INC_STATS("DOM.HTMLAllCollection.NamedPropertyGetter");
@@ -54,21 +85,21 @@ NAMED_PROPERTY_GETTER(HTMLAllCollection)
 
     // Finally, search the DOM structure.
     HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, info.Holder());
-    return getNamedItemsFromCollection(imp, v8StringToAtomicWebCoreString(name));
+    return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
 }
 
 CALLBACK_FUNC_DECL(HTMLAllCollectionItem)
 {
     INC_STATS("DOM.HTMLAllCollection.item()");
     HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
-    return getItemFromCollection(imp, args[0]);
+    return getItem(imp, args[0]);
 }
 
 CALLBACK_FUNC_DECL(HTMLAllCollectionNamedItem)
 {
     INC_STATS("DOM.HTMLAllCollection.namedItem()");
     HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
-    v8::Handle<v8::Value> result = getNamedItemsFromCollection(imp, toWebCoreString(args[0]));
+    v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
 
     if (result.IsEmpty())
         return v8::Undefined();
@@ -85,7 +116,7 @@ CALLBACK_FUNC_DECL(HTMLAllCollectionCallAsFunction)
     HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
 
     if (args.Length() == 1)
-        return getItemFromCollection(imp, args[0]);
+        return getItem(imp, args[0]);
 
     // If there is a second argument it is the index of the item we want.
     String name = toWebCoreString(args[0]);
diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index c45c41b..7c9b40f 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -32,12 +32,43 @@
 #include "HTMLCollection.h"
 
 #include "V8Binding.h"
-#include "V8Collection.h"
 #include "V8CustomBinding.h"
+#include "V8NamedNodesCollection.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
 
+static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicString name)
+{
+    Vector<RefPtr<Node> > namedItems;
+    collection->namedItems(name, namedItems);
+
+    if (!namedItems.size())
+        return v8::Handle<v8::Value>();
+
+    if (namedItems.size() == 1)
+        return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release());
+
+    NodeList* list = new V8NamedNodesCollection(namedItems);
+    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+}
+
+static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument)
+{
+    v8::Local<v8::Uint32> index = argument->ToArrayIndex();
+    if (index.IsEmpty()) {
+        v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString()));
+
+        if (result.IsEmpty())
+            return v8::Undefined();
+
+        return result;
+    }
+
+    RefPtr<Node> result = collection->item(index->Uint32Value());
+    return V8DOMWrapper::convertNodeToV8Object(result.release());
+}
+
 NAMED_PROPERTY_GETTER(HTMLCollection)
 {
     INC_STATS("DOM.HTMLCollection.NamedPropertyGetter");
@@ -54,21 +85,21 @@ NAMED_PROPERTY_GETTER(HTMLCollection)
 
     // Finally, search the DOM structure.
     HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, info.Holder());
-    return getNamedItemsFromCollection(imp, v8StringToAtomicWebCoreString(name));
+    return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
 }
 
 CALLBACK_FUNC_DECL(HTMLCollectionItem)
 {
     INC_STATS("DOM.HTMLCollection.item()");
     HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
-    return getItemFromCollection(imp, args[0]);
+    return getItem(imp, args[0]);
 }
 
 CALLBACK_FUNC_DECL(HTMLCollectionNamedItem)
 {
     INC_STATS("DOM.HTMLCollection.namedItem()");
     HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
-    v8::Handle<v8::Value> result = getNamedItemsFromCollection(imp, toWebCoreString(args[0]));
+    v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]));
 
     if (result.IsEmpty())
         return v8::Undefined();
@@ -85,7 +116,7 @@ CALLBACK_FUNC_DECL(HTMLCollectionCallAsFunction)
     HTMLCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, args.Holder());
 
     if (args.Length() == 1)
-        return getItemFromCollection(imp, args[0]);
+        return getItem(imp, args[0]);
 
     // If there is a second argument it is the index of the item we want.
     String name = toWebCoreString(args[0]);
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index 15015b4..02c3499 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -133,23 +133,4 @@ INDEXED_PROPERTY_SETTER(HTMLOptionsCollection)
     return toOptionsCollectionSetter(index, value, base);
 }
 
-CALLBACK_FUNC_DECL(HTMLOptionsCollectionItem)
-{
-    INC_STATS("DOM.HTMLOptionsCollection.item()");
-    HTMLOptionsCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
-    return getItemFromCollection(imp, args[0]);
-}
-
-CALLBACK_FUNC_DECL(HTMLOptionsCollectionNamedItem)
-{
-    INC_STATS("DOM.HTMLOptionsCollection.namedItem()");
-    HTMLOptionsCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLOptionsCollection>(V8ClassIndex::HTMLOPTIONSCOLLECTION, args.Holder());
-    v8::Handle<v8::Value> result = getNamedItemsFromCollection(imp, toWebCoreString(args[0]));
-
-    if (result.IsEmpty())
-        return v8::Undefined();
-
-    return result;
-}
-
 } // namespace WebCore

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list