Title: [136595] trunk/Source/WebCore
Revision
136595
Author
[email protected]
Date
2012-12-04 16:51:34 -0800 (Tue, 04 Dec 2012)

Log Message

[V8] V8DOMWrapper shouldn't know about NodeFilter
https://bugs.webkit.org/show_bug.cgi?id=104057

Reviewed by Kentaro Hara.

This patch just moves this code into V8Bindings.h, which is where we
have our other type conversion functions. It's too bad that we still
need to special case NodeFilter, but fixing that is going to be a bit
more work.

* bindings/scripts/CodeGeneratorV8.pm:
(JSValueToNative):
* bindings/v8/V8Binding.cpp:
(WebCore::toNodeFilter):
(WebCore):
* bindings/v8/V8Binding.h:
(WebCore):
* bindings/v8/V8DOMWrapper.cpp:
* bindings/v8/V8DOMWrapper.h:
(WebCore):
(V8DOMWrapper):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136594 => 136595)


--- trunk/Source/WebCore/ChangeLog	2012-12-05 00:49:33 UTC (rev 136594)
+++ trunk/Source/WebCore/ChangeLog	2012-12-05 00:51:34 UTC (rev 136595)
@@ -1,3 +1,27 @@
+2012-12-04  Adam Barth  <[email protected]>
+
+        [V8] V8DOMWrapper shouldn't know about NodeFilter
+        https://bugs.webkit.org/show_bug.cgi?id=104057
+
+        Reviewed by Kentaro Hara.
+
+        This patch just moves this code into V8Bindings.h, which is where we
+        have our other type conversion functions. It's too bad that we still
+        need to special case NodeFilter, but fixing that is going to be a bit
+        more work.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (JSValueToNative):
+        * bindings/v8/V8Binding.cpp:
+        (WebCore::toNodeFilter):
+        (WebCore):
+        * bindings/v8/V8Binding.h:
+        (WebCore):
+        * bindings/v8/V8DOMWrapper.cpp:
+        * bindings/v8/V8DOMWrapper.h:
+        (WebCore):
+        (V8DOMWrapper):
+
 2012-12-04  Simon Fraser  <[email protected]>
 
         Show a mini visualizer for the tile cache tiles

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (136594 => 136595)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-12-05 00:49:33 UTC (rev 136594)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-12-05 00:51:34 UTC (rev 136595)
@@ -3812,7 +3812,7 @@
     }
 
     if ($type eq "NodeFilter") {
-        return "V8DOMWrapper::wrapNativeNodeFilter($value)";
+        return "toNodeFilter($value)";
     }
 
     if ($type eq "MediaQueryListListener") {

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (136594 => 136595)


--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-12-05 00:49:33 UTC (rev 136594)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-12-05 00:51:34 UTC (rev 136595)
@@ -42,6 +42,7 @@
 #include "V8DOMStringList.h"
 #include "V8DOMWindow.h"
 #include "V8Element.h"
+#include "V8NodeFilterCondition.h"
 #include "V8ObjectConstructor.h"
 #include "V8WorkerContext.h"
 #include "V8XPathNSResolver.h"
@@ -149,6 +150,11 @@
     return result;
 }
 
+PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback)
+{
+    return NodeFilter::create(V8NodeFilterCondition::create(callback));
+}
+
 int toInt32(v8::Handle<v8::Value> value, bool& ok)
 {
     ok = true;

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (136594 => 136595)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-12-05 00:49:33 UTC (rev 136594)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-12-05 00:51:34 UTC (rev 136595)
@@ -35,6 +35,7 @@
 #include "BindingSecurity.h"
 #include "DOMWrapperWorld.h"
 #include "Document.h"
+#include "NodeFilter.h"
 #include "V8BindingMacros.h"
 #include "V8DOMConfiguration.h"
 #include "V8DOMWrapper.h"
@@ -267,7 +268,6 @@
         return result;
     }
 
-
     // Validates that the passed object is a sequence type per WebIDL spec
     // http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence
     inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint32_t& length)
@@ -293,6 +293,8 @@
         return v8Value;
     }
 
+    PassRefPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>);
+
     // Convert a value to a 32-bit integer.  The conversion fails if the
     // value cannot be converted to an integer or converts to nan or to an infinity.
     int toInt32(v8::Handle<v8::Value> value, bool& ok);

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp (136594 => 136595)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2012-12-05 00:49:33 UTC (rev 136594)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2012-12-05 00:51:34 UTC (rev 136595)
@@ -110,19 +110,6 @@
     return toWrapperTypeInfo(object);
 }
 
-PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value> filter)
-{
-    // A NodeFilter is used when walking through a DOM tree or iterating tree
-    // nodes.
-    // FIXME: we may want to cache NodeFilterCondition and NodeFilter
-    // object, but it is minor.
-    // NodeFilter is passed to NodeIterator that has a ref counted pointer
-    // to NodeFilter. NodeFilter has a ref counted pointer to NodeFilterCondition.
-    // In NodeFilterCondition, filter object is persisted in its constructor,
-    // and disposed in its destructor.
-    return NodeFilter::create(V8NodeFilterCondition::create(filter));
-}
-
 v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(v8::Handle<v8::Object> creationContext, WrapperTypeInfo* type, void* impl)
 {
     V8WrapperInstantiationScope scope(creationContext);

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h (136594 => 136595)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h	2012-12-05 00:49:33 UTC (rev 136594)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h	2012-12-05 00:51:34 UTC (rev 136595)
@@ -35,7 +35,6 @@
 #include "DOMWrapperWorld.h"
 #include "Event.h"
 #include "Node.h"
-#include "NodeFilter.h"
 #include "V8CustomXPathNSResolver.h"
 #include "V8DOMWindowShell.h"
 #include "V8Utilities.h"
@@ -50,7 +49,6 @@
     class DOMWindow;
     class EventTarget;
     class Frame;
-    class Node;
     class V8PerContextData;
     class WorkerContext;
 
@@ -92,9 +90,6 @@
 
         static PassRefPtr<EventListener> getEventListener(v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup);
 
-        // Wrap JS node filter in C++.
-        static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
-
         template<typename T>
         static v8::Persistent<v8::Object> createDOMWrapper(PassRefPtr<T>, WrapperTypeInfo*, v8::Handle<v8::Object>, v8::Isolate* = 0);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to