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

dglazkov at chromium.org dglazkov at chromium.org
Thu Apr 8 00:38:47 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 5a9c114923e0632a5a8bb593189d9a31e17db2ce
Author: dglazkov at chromium.org <dglazkov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 16 19:25:09 2009 +0000

    2009-12-16  Dimitri Glazkov  <dglazkov at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [V8] There is no such thing as HTMLSelectElementCollection.
            https://bugs.webkit.org/show_bug.cgi?id=32616
    
            Refactoring, covered by existing tests.
    
            * WebCore.gypi: Removed V8HTMLSelectElementCollectionCustom.cpp
            * bindings/v8/V8Collection.h: Removed one-off template.
            * bindings/v8/V8DOMWrapper.cpp:
            (WebCore::V8DOMWrapper::getTemplate): Renamed all references to HTMLSelectElementCollection
                to HTMLSelectElement.
            * bindings/v8/custom/V8CustomBinding.h: Renamed custom indexer decls.
            * bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp: Removed.
            * bindings/v8/custom/V8HTMLSelectElementCustom.cpp: Moved code as-is from
                V8HTMLSelectElementCollectionCustom.cpp
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52211 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ebc5ec7..03a10c5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2009-12-16  Dimitri Glazkov  <dglazkov at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [V8] There is no such thing as HTMLSelectElementCollection.
+        https://bugs.webkit.org/show_bug.cgi?id=32616
+
+        Refactoring, covered by existing tests.
+
+        * WebCore.gypi: Removed V8HTMLSelectElementCollectionCustom.cpp
+        * bindings/v8/V8Collection.h: Removed one-off template.
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::getTemplate): Renamed all references to HTMLSelectElementCollection
+            to HTMLSelectElement.
+        * bindings/v8/custom/V8CustomBinding.h: Renamed custom indexer decls.
+        * bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp: Removed.
+        * bindings/v8/custom/V8HTMLSelectElementCustom.cpp: Moved code as-is from
+            V8HTMLSelectElementCollectionCustom.cpp
+
 2009-12-16  Dan Winship  <danw at gnome.org>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 295b4fd..ad8ce57 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -710,7 +710,6 @@
             'bindings/v8/custom/V8HTMLOptionElementConstructor.h',
             'bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp',
             'bindings/v8/custom/V8HTMLPlugInElementCustom.cpp',
-            'bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp',
             'bindings/v8/custom/V8HTMLSelectElementCustom.cpp',
             'bindings/v8/custom/V8HTMLSelectElementCustom.h',
             'bindings/v8/custom/V8InjectedScriptHostCustom.cpp',
diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h
index 6961d5a..9a1341b 100644
--- a/WebCore/bindings/v8/V8Collection.h
+++ b/WebCore/bindings/v8/V8Collection.h
@@ -122,16 +122,6 @@ namespace WebCore {
         return getIndexedPropertyOfCollection<Collection, ItemType>(index, info.Holder(), info.Data());
     }
 
-    // A template of index interceptor of HTMLSelectElement and HTMLFormElement.
-    template<class Collection> static v8::Handle<v8::Value> nodeCollectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-    {
-        ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
-        ASSERT(V8DOMWrapper::domWrapperType(info.Holder()) == V8ClassIndex::NODE);
-        Collection* collection = V8DOMWrapper::convertDOMWrapperToNode<Collection>(info.Holder());
-        void* implementation = collection->item(index);
-        return getV8Object(implementation, info.Data());
-    }
-
     // Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement.
     template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info)
     {
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 29c7726..7ad1cb1 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -289,9 +289,8 @@ v8::Persistent<v8::FunctionTemplate> V8DOMWrapper::getTemplate(V8ClassIndex::V8W
         descriptor->InstanceTemplate()->SetCallAsFunctionHandler(USE_CALLBACK(HTMLCollectionCallAsFunction));
         break;
     case V8ClassIndex::HTMLSELECTELEMENT:
-        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection));
-        descriptor->InstanceTemplate()->SetIndexedPropertyHandler(nodeCollectionIndexedPropertyGetter<HTMLSelectElement>, USE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection),
-            0, 0, nodeCollectionIndexedPropertyEnumerator<HTMLSelectElement>, v8::Integer::New(V8ClassIndex::NODE));
+        descriptor->InstanceTemplate()->SetNamedPropertyHandler(USE_NAMED_PROPERTY_GETTER(HTMLSelectElement));
+        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));
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index e3cd657..f4f054d 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -531,8 +531,9 @@ namespace WebCore {
         DECLARE_INDEXED_PROPERTY_GETTER(HTMLFormElement);
         DECLARE_INDEXED_PROPERTY_GETTER(HTMLOptionsCollection);
         DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection);
-        DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection);
-        DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection);
+        DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElement);
+        DECLARE_INDEXED_PROPERTY_GETTER(HTMLSelectElement);
+        DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElement);
         DECLARE_NAMED_PROPERTY_GETTER(HTMLAllCollection);
         DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection);
 
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp
deleted file mode 100644
index 0dfa515..0000000
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCollectionCustom.cpp
+++ /dev/null
@@ -1,78 +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.
- */
-
-#include "config.h"
-#include "HTMLSelectElement.h"
-
-#include "HTMLOptionsCollection.h"
-#include "V8Binding.h"
-#include "V8Collection.h"
-#include "V8CustomBinding.h"
-#include "V8NamedNodesCollection.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-NAMED_PROPERTY_GETTER(HTMLSelectElementCollection)
-{
-    INC_STATS("DOM.HTMLSelectElementCollection.NamedPropertySetter");
-    HTMLSelectElement* select = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
-    v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
-
-    if (!value.IsEmpty())
-        return value;
-
-    // Search local callback properties next to find IDL defined properties.
-    if (info.Holder()->HasRealNamedCallbackProperty(name))
-        return notHandledByInterceptor();
-
-    PassRefPtr<HTMLOptionsCollection> collection = select->options();
-
-    Vector<RefPtr<Node> > items;
-    collection->namedItems(v8StringToAtomicWebCoreString(name), items);
-
-    if (!items.size())
-        return notHandledByInterceptor();
-
-    if (items.size() == 1)
-        return V8DOMWrapper::convertNodeToV8Object(items.at(0).release());
-
-    NodeList* list = new V8NamedNodesCollection(items);
-    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
-}
-
-INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection)
-{
-    INC_STATS("DOM.HTMLSelectElementCollection.IndexedPropertySetter");
-    HTMLSelectElement* select = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
-    return toOptionsCollectionSetter(index, value, select);
-}
-
-} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
index 661ffa2..7e29290 100644
--- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp
@@ -33,14 +33,63 @@
 
 #include "HTMLSelectElement.h"
 #include "HTMLOptionElement.h"
+#include "HTMLOptionsCollection.h"
 
 #include "V8Binding.h"
+#include "V8Collection.h"
 #include "V8CustomBinding.h"
 #include "V8HTMLOptionElement.h"
+#include "V8NamedNodesCollection.h"
 #include "V8Proxy.h"
 
 namespace WebCore {
 
+NAMED_PROPERTY_GETTER(HTMLSelectElement)
+{
+    INC_STATS("DOM.HTMLSelectElement.NamedPropertySetter");
+    HTMLSelectElement* select = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
+    v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
+
+    if (!value.IsEmpty())
+        return value;
+
+    // Search local callback properties next to find IDL defined properties.
+    if (info.Holder()->HasRealNamedCallbackProperty(name))
+        return notHandledByInterceptor();
+
+    PassRefPtr<HTMLOptionsCollection> collection = select->options();
+
+    Vector<RefPtr<Node> > items;
+    collection->namedItems(v8StringToAtomicWebCoreString(name), items);
+
+    if (!items.size())
+        return notHandledByInterceptor();
+
+    if (items.size() == 1)
+        return V8DOMWrapper::convertNodeToV8Object(items.at(0).release());
+
+    NodeList* list = new V8NamedNodesCollection(items);
+    return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list);
+}
+
+INDEXED_PROPERTY_GETTER(HTMLSelectElement)
+{
+    ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));
+    ASSERT(V8DOMWrapper::domWrapperType(info.Holder()) == V8ClassIndex::NODE);
+    RefPtr<Node> result = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder())->item(index);
+    if (!result)
+        return notHandledByInterceptor();
+
+    return V8DOMWrapper::convertNodeToV8Object(result.release());
+}
+
+INDEXED_PROPERTY_SETTER(HTMLSelectElement)
+{
+    INC_STATS("DOM.HTMLSelectElement.IndexedPropertySetter");
+    HTMLSelectElement* select = V8DOMWrapper::convertDOMWrapperToNode<HTMLSelectElement>(info.Holder());
+    return toOptionsCollectionSetter(index, value, select);
+}
+
 CALLBACK_FUNC_DECL(HTMLSelectElementRemove)
 {
     INC_STATS("DOM.HTMLSelectElement.remove");

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list