summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
authorFeng Qian <fqian@google.com>2009-07-17 22:43:49 -0700
committerFeng Qian <fqian@google.com>2009-07-18 08:47:05 -0700
commit54c7b5fa917905784d2d3d5c1ca6a914a6e86334 (patch)
tree817a97ecb2a97a6547fd76668c6e0e7124007136 /WebCore/bindings
parent8c0b3ad422aebaf26f4a7810bb435c2f7aab479e (diff)
downloadexternal_webkit-54c7b5fa917905784d2d3d5c1ca6a914a6e86334.zip
external_webkit-54c7b5fa917905784d2d3d5c1ca6a914a6e86334.tar.gz
external_webkit-54c7b5fa917905784d2d3d5c1ca6a914a6e86334.tar.bz2
Add indexed getter for TouchList.
http://maps.google.com/maps/m uses TouchEvent.touches[i], which requires a customized index getter.
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/v8/custom/V8CustomBinding.h5
-rw-r--r--WebCore/bindings/v8/custom/V8TouchListCustom.cpp59
2 files changed, 64 insertions, 0 deletions
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index ae8c6ee..e039c6f 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -458,6 +458,11 @@ namespace WebCore {
DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
+#if ENABLE(TOUCH_EVENTS)
+ // TODO(andreip): upstream touch related changes to Chromium
+ DECLARE_INDEXED_PROPERTY_GETTER(TouchList);
+#endif
+
#if ENABLE(DOM_STORAGE)
DECLARE_INDEXED_PROPERTY_GETTER(Storage);
DECLARE_INDEXED_PROPERTY_SETTER(Storage);
diff --git a/WebCore/bindings/v8/custom/V8TouchListCustom.cpp b/WebCore/bindings/v8/custom/V8TouchListCustom.cpp
new file mode 100644
index 0000000..7cf893d
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8TouchListCustom.cpp
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+// TODO(andreip): upstream touch related changes to Chromium
+#include "config.h"
+
+#if ENABLE(TOUCH_EVENTS)
+#include "TouchList.h"
+
+#include "Touch.h"
+
+#include "V8Binding.h"
+#include "V8CustomBinding.h"
+#include "V8Proxy.h"
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+INDEXED_PROPERTY_GETTER(TouchList)
+{
+ INC_STATS("DOM.TouchList.IndexedPropertyGetter");
+ TouchList* imp = V8Proxy::ToNativeObject<TouchList>(V8ClassIndex::TOUCHLIST, info.Holder());
+ RefPtr<Touch> result = imp->item(index);
+ if (!result)
+ return notHandledByInterceptor();
+
+ return V8Proxy::ToV8Object(V8ClassIndex::TOUCH, result.get());
+}
+} // namespace WebCore
+
+#endif // TOUCH_EVENTS