Merge change 5521

* changes:
  Adding mouse events to the plugin API
diff --git a/V8Binding/V8Binding.derived.mk b/V8Binding/V8Binding.derived.mk
index c7a1ee0..d269e04 100644
--- a/V8Binding/V8Binding.derived.mk
+++ b/V8Binding/V8Binding.derived.mk
@@ -102,6 +102,7 @@
 	bindings/v8/custom/V8NodeListCustom.cpp \
 	bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \
 	bindings/v8/custom/V8SQLTransactionCustom.cpp \
+	bindings/v8/custom/V8StorageCustom.cpp \
 
 ifeq ($(ENABLE_SVG), true)
 WEBCORE_SRC_FILES := $(WEBCORE_SRC_FILES) \
@@ -114,6 +115,7 @@
 	bindings/v8/custom/V8StyleSheetListCustom.cpp \
 	bindings/v8/custom/V8TreeWalkerCustom.cpp \
 	bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp \
+	bindings/v8/custom/V8WebKitPointConstructor.cpp \
 	bindings/v8/custom/V8WorkerContextCustom.cpp \
 	bindings/v8/custom/V8WorkerCustom.cpp \
 	bindings/v8/custom/V8XMLHttpRequestConstructor.cpp \
@@ -136,7 +138,6 @@
 	binding/V8NPUtils.cpp \
 	binding/npruntime.cpp \
 	binding/v8_binding.cpp \
-	binding/v8_custom.cpp \
 	binding/v8_helpers.cpp \
 	binding/v8_index.cpp \
 	binding/v8_proxy.cpp \
@@ -156,7 +157,7 @@
   $(WEBCORE_PATH)/bindings/scripts/IDLStructure.pm \
 	$(LOCAL_PATH)/scripts/generate-bindings.pl
 
-FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 V8_BINDING ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1
+FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 V8_BINDING ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1
 
 ifeq ($(ENABLE_VIDEO), true)
   FEATURE_DEFINES += ENaBLE_VIDEO=1
@@ -411,6 +412,20 @@
 # above rules.  Specifying this explicitly makes -j2 work.
 $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h
 
+# DOM Storage support
+GEN := \
+    $(intermediates)/storage/V8Storage.h \
+    $(intermediates)/storage/V8StorageEvent.h
+
+$(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(WEBCORE_PATH) perl -I$(v8binding_dir)/scripts -I$(WEBCORE_PATH)/bindings/scripts $(v8binding_dir)/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --outputdir $(dir $@) $<
+$(GEN): $(intermediates)/storage/V8%.h : $(WEBCORE_PATH)/storage/%.idl $(js_binding_scripts)
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp)
+
+# We also need the .cpp files, which are generated as side effects of the
+# above rules.  Specifying this explicitly makes -j2 work.
+$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h
+
 #new section for svg
 ifeq ($(ENABLE_SVG), true)
 GEN := \
diff --git a/V8Binding/binding/DOMObjectsInclude.h b/V8Binding/binding/DOMObjectsInclude.h
index a79f03d..9db9b6d 100644
--- a/V8Binding/binding/DOMObjectsInclude.h
+++ b/V8Binding/binding/DOMObjectsInclude.h
@@ -127,6 +127,11 @@
 #include "XPathNSResolver.h"
 #include "XPathResult.h"
 
+#if ENABLE(DOM_STORAGE)
+#include "Storage.h"
+#include "StorageEvent.h"
+#endif
+
 #if ENABLE(SVG)
 #include "SVGAngle.h"
 #include "SVGAnimatedPoints.h"
diff --git a/V8Binding/binding/NPV8Object.cpp b/V8Binding/binding/NPV8Object.cpp
index e7ce792..3bd55d7 100644
--- a/V8Binding/binding/NPV8Object.cpp
+++ b/V8Binding/binding/NPV8Object.cpp
@@ -39,7 +39,7 @@
 #include "npruntime_priv.h"
 #include "PlatformString.h"
 #include "ScriptController.h"
-#include "v8_custom.h"
+#include "V8CustomBinding.h"
 #include "v8_helpers.h"
 #include "V8NPUtils.h"
 #include "v8_proxy.h"
diff --git a/V8Binding/binding/v8_custom.cpp b/V8Binding/binding/v8_custom.cpp
deleted file mode 100644
index 2af9cbd..0000000
--- a/V8Binding/binding/v8_custom.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *  Copyright (C) 2000 Harri Porten (porten@kde.org)
- *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
- *  Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
- *  Copyright (C) 2006 James G. Speth (speth@end.com)
- *  Copyright (C) 2006 Samuel Weinig (sam@webkit.org)
- *  Copyright (C) 2007, 2008 Google Inc. All Rights Reserved.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-
-#include <Assertions.h>
-#include <wtf/ASCIICType.h>
-
-#include "v8_proxy.h"
-#include "v8_binding.h"
-#include "V8NPObject.h"
-
-#include "V8CanvasGradient.h"
-#include "V8CanvasPattern.h"
-#include "V8CustomEventListener.h"
-#include "V8Document.h"
-#include "V8DOMWindow.h"
-#include "V8HTMLCanvasElement.h"
-#include "V8HTMLDocument.h"
-#include "V8HTMLImageElement.h"
-#include "V8NamedNodesCollection.h"
-#include "V8Node.h"
-#include "V8Proxy.h"
-#if ENABLE(XPATH)
-#include "V8XPathNSResolver.h"
-#include "V8XPathResult.h"
-#endif
-
-#include "Attr.h"
-#include "Base64.h"
-#include "CanvasGradient.h"
-#include "CanvasPattern.h"
-#include "CanvasRenderingContext2D.h"
-#include "CanvasStyle.h"
-#include "Clipboard.h"
-#include "ClipboardEvent.h"
-#include "Console.h"
-#include "DOMParser.h"
-#include "DOMStringList.h"
-#include "DOMTimer.h"
-#include "Document.h"
-#include "DocumentFragment.h"
-#include "Event.h"
-#include "EventTarget.h"
-#include "FloatRect.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "FrameTree.h"
-#include "HTMLBodyElement.h"
-#include "HTMLCanvasElement.h"
-#include "HTMLDocument.h"
-#include "HTMLEmbedElement.h"
-#include "HTMLImageElement.h"
-#include "HTMLInputElement.h"
-#include "HTMLNames.h"
-#include "History.h"
-#include "JSXPathNSResolver.h"
-#include "KURL.h"
-#include "Location.h"
-#include "MessageChannel.h"
-#include "MessagePort.h"
-#include "MouseEvent.h"
-#include "NodeIterator.h"
-#include "NodeList.h"
-#include "RGBColor.h"
-#include "RenderPartObject.h"
-#include "RenderWidget.h"
-#include "ScheduledAction.h"
-#include "ScriptState.h"
-#include "ScriptController.h"
-#include "ScriptSourceCode.h"
-#include "SecurityOrigin.h"
-#include "StyleSheetList.h"
-#include "TreeWalker.h"
-#include "WebKitCSSMatrix.h"
-#include "WebKitPoint.h"
-#include "XMLSerializer.h"
-#include "XPathEvaluator.h"
-#include "XPathResult.h"
-#include "XSLTProcessor.h"
-
-#if ENABLE(SVG)
-#include "V8SVGPODTypeWrapper.h"
-#include "SVGElementInstance.h"
-#include "SVGException.h"
-#include "SVGPathSeg.h"
-#endif
-
-#include "Navigator.h"
-
-namespace WebCore {
-
-CALLBACK_FUNC_DECL(WebKitPointConstructor) {
-  INC_STATS("DOM.WebKitPoint.Constructor");
-  return V8Proxy::ConstructDOMObject<V8ClassIndex::WEBKITPOINT,
-                                     WebKitPoint>(args);
-}
-
-// DOMImplementation is a singleton in WebCore.  If we use our normal
-// mapping from DOM objects to V8 wrappers, the same wrapper will be
-// shared for all frames in the same process.  This is a major
-// security problem.  Therefore, we generate a DOMImplementation
-// wrapper per document and store it in an internal field of the
-// document.  Since the DOMImplementation object is a singleton, we do
-// not have to do anything to keep the DOMImplementation object alive
-// for the lifetime of the wrapper.
-ACCESSOR_GETTER(DocumentImplementation) {
-  ASSERT(info.Holder()->InternalFieldCount() >=
-         kDocumentMinimumInternalFieldCount);
-  // Check if the internal field already contains a wrapper.
-  v8::Local<v8::Value> implementation =
-      info.Holder()->GetInternalField(kDocumentImplementationIndex);
-  if (!implementation->IsUndefined()) {
-    return implementation;
-  }
-  // Generate a wrapper.
-  Document* doc = V8Proxy::DOMWrapperToNative<Document>(info.Holder());
-  v8::Handle<v8::Value> wrapper =
-      V8Proxy::DOMImplementationToV8Object(doc->implementation());
-  // Store the wrapper in the internal field.
-  info.Holder()->SetInternalField(kDocumentImplementationIndex, wrapper);
-
-  return wrapper;
-}
-
-// --------------- Security Checks -------------------------
-INDEXED_ACCESS_CHECK(History) {
-  ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
-  // Only allow same origin access
-  History* imp =
-      V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
-  return V8Proxy::CanAccessFrame(imp->frame(), false);
-}
-
-
-NAMED_ACCESS_CHECK(History) {
-  ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
-  // Only allow same origin access
-  History* imp =
-      V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
-  return V8Proxy::CanAccessFrame(imp->frame(), false);
-}
-
-
-
-#undef INDEXED_ACCESS_CHECK
-#undef NAMED_ACCESS_CHECK
-#undef NAMED_PROPERTY_GETTER
-#undef NAMED_PROPERTY_SETTER
-
-
-// static
-Frame* V8Custom::GetTargetFrame(v8::Local<v8::Object> host,
-                                v8::Local<v8::Value> data) {
-  Frame* target = 0;
-  switch (V8ClassIndex::FromInt(data->Int32Value())) {
-    case V8ClassIndex::DOMWINDOW: {
-      v8::Handle<v8::Value> window =
-          V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
-      if (window.IsEmpty())
-          return target;
-
-      DOMWindow* target_win =
-        V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
-      target = target_win->frame();
-      break;
-    }
-    case V8ClassIndex::LOCATION: {
-      History* imp =
-          V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
-      target = imp->frame();
-      break;
-    }
-    case V8ClassIndex::HISTORY: {
-      Location* imp =
-          V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, host);
-      target = imp->frame();
-      break;
-    }
-    default:
-      break;
-  }
-  return target;
-}
-
-#if ENABLE(SVG)
-V8ClassIndex::V8WrapperType V8Custom::DowncastSVGPathSeg(void* path_seg) {
-  WebCore::SVGPathSeg *real_path_seg =
-      reinterpret_cast<WebCore::SVGPathSeg*>(path_seg);
-
-  switch (real_path_seg->pathSegType()) {
-#define MAKE_CASE(svg_val, v8_val) \
-  case WebCore::SVGPathSeg::svg_val:           \
-    return V8ClassIndex::v8_val;
-
-MAKE_CASE(PATHSEG_CLOSEPATH,                    SVGPATHSEGCLOSEPATH)
-MAKE_CASE(PATHSEG_MOVETO_ABS,                   SVGPATHSEGMOVETOABS)
-MAKE_CASE(PATHSEG_MOVETO_REL,                   SVGPATHSEGMOVETOREL)
-MAKE_CASE(PATHSEG_LINETO_ABS,                   SVGPATHSEGLINETOABS)
-MAKE_CASE(PATHSEG_LINETO_REL,                   SVGPATHSEGLINETOREL)
-MAKE_CASE(PATHSEG_CURVETO_CUBIC_ABS,            SVGPATHSEGCURVETOCUBICABS)
-MAKE_CASE(PATHSEG_CURVETO_CUBIC_REL,            SVGPATHSEGCURVETOCUBICREL)
-MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_ABS,        SVGPATHSEGCURVETOQUADRATICABS)
-MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_REL,        SVGPATHSEGCURVETOQUADRATICREL)
-MAKE_CASE(PATHSEG_ARC_ABS,                      SVGPATHSEGARCABS)
-MAKE_CASE(PATHSEG_ARC_REL,                      SVGPATHSEGARCREL)
-MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_ABS,        SVGPATHSEGLINETOHORIZONTALABS)
-MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_REL,        SVGPATHSEGLINETOHORIZONTALREL)
-MAKE_CASE(PATHSEG_LINETO_VERTICAL_ABS,          SVGPATHSEGLINETOVERTICALABS)
-MAKE_CASE(PATHSEG_LINETO_VERTICAL_REL,          SVGPATHSEGLINETOVERTICALREL)
-MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,     SVGPATHSEGCURVETOCUBICSMOOTHABS)
-MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_REL,     SVGPATHSEGCURVETOCUBICSMOOTHREL)
-MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, \
-          SVGPATHSEGCURVETOQUADRATICSMOOTHABS)
-MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, \
-          SVGPATHSEGCURVETOQUADRATICSMOOTHREL)
-
-#undef MAKE_CASE
-
-  default:
-    return V8ClassIndex::INVALID_CLASS_INDEX;
-  }
-}
-
-#endif  // ENABLE(SVG)
-
-}  // namespace WebCore
diff --git a/V8Binding/binding/v8_custom.h b/V8Binding/binding/v8_custom.h
deleted file mode 100644
index 3e8f52e..0000000
--- a/V8Binding/binding/v8_custom.h
+++ /dev/null
@@ -1,600 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef V8_CUSTOM_H__
-#define V8_CUSTOM_H__
-
-#include <v8.h>
-#include "v8_index.h"
-
-struct NPObject;
-
-#define CALLBACK_FUNC_DECL(NAME)                \
-v8::Handle<v8::Value> V8Custom::v8##NAME##Callback(const v8::Arguments& args)
-
-#define ACCESSOR_GETTER(NAME) \
-v8::Handle<v8::Value> V8Custom::v8##NAME##AccessorGetter(\
-    v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define ACCESSOR_SETTER(NAME) \
-void V8Custom::v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
-                                        v8::Local<v8::Value> value, \
-                                        const v8::AccessorInfo& info)
-
-#define INDEXED_PROPERTY_GETTER(NAME)  \
-v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertyGetter(\
-    uint32_t index, const v8::AccessorInfo& info)
-
-#define INDEXED_PROPERTY_SETTER(NAME)  \
-v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertySetter(\
-    uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
-
-#define INDEXED_PROPERTY_DELETER(NAME) \
-v8::Handle<v8::Boolean> V8Custom::v8##NAME##IndexedPropertyDeleter(\
-    uint32_t index, const v8::AccessorInfo& info)
-
-#define NAMED_PROPERTY_GETTER(NAME)  \
-    v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertyGetter(\
-    v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define NAMED_PROPERTY_SETTER(NAME)  \
-    v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertySetter(\
-    v8::Local<v8::String> name, v8::Local<v8::Value> value, \
-    const v8::AccessorInfo& info)
-
-#define NAMED_PROPERTY_DELETER(NAME) \
-    v8::Handle<v8::Boolean> V8Custom::v8##NAME##NamedPropertyDeleter(\
-    v8::Local<v8::String> name, const v8::AccessorInfo& info)
-
-#define NAMED_ACCESS_CHECK(NAME) \
-    bool V8Custom::v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
-    v8::Local<v8::Value> key, \
-    v8::AccessType type, \
-    v8::Local<v8::Value> data)
-
-#define INDEXED_ACCESS_CHECK(NAME) \
-    bool V8Custom::v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
-    uint32_t index, \
-    v8::AccessType type, \
-    v8::Local<v8::Value> data)
-
-namespace WebCore {
-
-class Frame;
-class V8Proxy;
-class String;
-class HTMLCollection;
-class DOMWindow;
-
-class V8Custom {
- public:
-
-  // Constants.
-  static const int kDOMWrapperTypeIndex = 0;
-  static const int kDOMWrapperObjectIndex = 1;
-  static const int kDefaultWrapperInternalFieldCount = 2;
-
-  static const int kNPObjectInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 0;
-
-  static const int kDocumentImplementationIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kDocumentMinimumInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 1;
-
-  static const int kHTMLDocumentMarkerIndex =
-                      kDocumentMinimumInternalFieldCount + 0;
-  static const int kHTMLDocumentShadowIndex =
-                      kDocumentMinimumInternalFieldCount + 1;
-  static const int kHTMLDocumentInternalFieldCount =
-                      kDocumentMinimumInternalFieldCount + 2;
-
-  static const int kXMLHttpRequestCacheIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kXMLHttpRequestInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 1;
-
-  static const int kMessageChannelPort1Index =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kMessageChannelPort2Index =
-                      kDefaultWrapperInternalFieldCount + 1;
-  static const int kMessageChannelInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 2;
-
-  static const int kMessagePortRequestCacheIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kMessagePortEntangledPortIndex =
-                      kDefaultWrapperInternalFieldCount + 1;
-  static const int kMessagePortInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 2;
-
-#if ENABLE(WORKERS)
-  static const int kWorkerRequestCacheIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kWorkerInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 1;
-
-  static const int kWorkerContextRequestCacheIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kWorkerContextInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 1;
-#endif
-
-  static const int kDOMWindowConsoleIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kDOMWindowHistoryIndex =
-                      kDefaultWrapperInternalFieldCount + 1;
-  static const int kDOMWindowLocationbarIndex =
-                      kDefaultWrapperInternalFieldCount + 2;
-  static const int kDOMWindowMenubarIndex =
-                      kDefaultWrapperInternalFieldCount + 3;
-  static const int kDOMWindowNavigatorIndex =
-                      kDefaultWrapperInternalFieldCount + 4;
-  static const int kDOMWindowPersonalbarIndex =
-                      kDefaultWrapperInternalFieldCount + 5;
-  static const int kDOMWindowScreenIndex =
-                      kDefaultWrapperInternalFieldCount + 6;
-  static const int kDOMWindowScrollbarsIndex =
-                      kDefaultWrapperInternalFieldCount + 7;
-  static const int kDOMWindowSelectionIndex =
-                      kDefaultWrapperInternalFieldCount + 8;
-  static const int kDOMWindowStatusbarIndex =
-                      kDefaultWrapperInternalFieldCount + 9;
-  static const int kDOMWindowToolbarIndex =
-                      kDefaultWrapperInternalFieldCount + 10;
-  static const int kDOMWindowLocationIndex =
-                      kDefaultWrapperInternalFieldCount + 11;
-  static const int kDOMWindowDOMSelectionIndex =
-                      kDefaultWrapperInternalFieldCount + 12;
-  static const int kDOMWindowInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 13;
-
-  static const int kStyleSheetOwnerNodeIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kStyleSheetInternalFieldCount =
-                      kDefaultWrapperInternalFieldCount + 1;
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-  static const int kDOMApplicationCacheCacheIndex =
-                      kDefaultWrapperInternalFieldCount + 0;
-  static const int kDOMApplicationCacheFieldCount =
-                      kDefaultWrapperInternalFieldCount + 1;
-#endif
-
-#define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
-static v8::Handle<v8::Value> v8##NAME##AccessorGetter(\
-    v8::Local<v8::String> name, const v8::AccessorInfo& info);
-
-#define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)  \
-static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
-                                     v8::Local<v8::Value> value, \
-                                     const v8::AccessorInfo& info);
-
-#define DECLARE_PROPERTY_ACCESSOR(NAME) \
-  DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
-  DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)
-
-
-#define DECLARE_NAMED_PROPERTY_GETTER(NAME)  \
-static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter(\
-    v8::Local<v8::String> name, const v8::AccessorInfo& info);
-
-#define DECLARE_NAMED_PROPERTY_SETTER(NAME)  \
-static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter(\
-    v8::Local<v8::String> name, \
-    v8::Local<v8::Value> value, \
-    const v8::AccessorInfo& info);
-
-#define DECLARE_NAMED_PROPERTY_DELETER(NAME)  \
-static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter(\
-    v8::Local<v8::String> name, const v8::AccessorInfo& info);
-
-#define USE_NAMED_PROPERTY_GETTER(NAME) \
-  V8Custom::v8##NAME##NamedPropertyGetter
-
-#define USE_NAMED_PROPERTY_SETTER(NAME) \
-  V8Custom::v8##NAME##NamedPropertySetter
-
-#define USE_NAMED_PROPERTY_DELETER(NAME) \
-  V8Custom::v8##NAME##NamedPropertyDeleter
-
-#define DECLARE_INDEXED_PROPERTY_GETTER(NAME)  \
-static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter(\
-    uint32_t index, const v8::AccessorInfo& info);
-
-#define DECLARE_INDEXED_PROPERTY_SETTER(NAME)  \
-static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter(\
-    uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
-
-#define DECLARE_INDEXED_PROPERTY_DELETER(NAME)  \
-static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter(\
-    uint32_t index, const v8::AccessorInfo& info);
-
-#define USE_INDEXED_PROPERTY_GETTER(NAME) \
-  V8Custom::v8##NAME##IndexedPropertyGetter
-
-#define USE_INDEXED_PROPERTY_SETTER(NAME) \
-  V8Custom::v8##NAME##IndexedPropertySetter
-
-#define USE_INDEXED_PROPERTY_DELETER(NAME) \
-  V8Custom::v8##NAME##IndexedPropertyDeleter
-
-#define DECLARE_CALLBACK(NAME)                \
-static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args);
-
-#define USE_CALLBACK(NAME) \
-  V8Custom::v8##NAME##Callback
-
-#define DECLARE_NAMED_ACCESS_CHECK(NAME) \
-static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
-                                         v8::Local<v8::Value> key, \
-                                         v8::AccessType type, \
-                                         v8::Local<v8::Value> data);
-
-#define DECLARE_INDEXED_ACCESS_CHECK(NAME) \
-static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
-                                           uint32_t index, \
-                                           v8::AccessType type, \
-                                           v8::Local<v8::Value> data);
-
-DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle)
-DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle)
-DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent)
-DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto)
-// Customized getter&setter of DOMWindow.location
-DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation)
-// Customized setter of DOMWindow.opener
-DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener)
-
-DECLARE_PROPERTY_ACCESSOR(DocumentLocation)
-DECLARE_PROPERTY_ACCESSOR(DocumentImplementation)
-DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement)
-DECLARE_PROPERTY_ACCESSOR(EventReturnValue)
-DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer)
-DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData)
-
-// Getter/Setter for window event handlers
-DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler)
-// Getter/Setter for Element event handlers
-DECLARE_PROPERTY_ACCESSOR(ElementEventHandler)
-
-// HTMLCanvasElement
-DECLARE_CALLBACK(HTMLCanvasElementGetContext)
-
-// Customized setter of src and location on HTMLFrameElement
-DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc)
-DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation)
-// Customized setter of src on HTMLIFrameElement
-DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc)
-// Customized setter of Attr.value
-DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue)
-
-// Customized setter of HTMLOptionsCollection length
-DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength)
-
-DECLARE_CALLBACK(HTMLInputElementSetSelectionRange)
-
-// Customized accessors for HTMLInputElement
-DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart)
-DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd)
-
-DECLARE_NAMED_ACCESS_CHECK(Location)
-DECLARE_INDEXED_ACCESS_CHECK(History)
-
-DECLARE_NAMED_ACCESS_CHECK(History)
-DECLARE_INDEXED_ACCESS_CHECK(Location)
-
-// HTMLCollection customized functions.
-DECLARE_CALLBACK(HTMLCollectionItem)
-DECLARE_CALLBACK(HTMLCollectionNamedItem)
-// HTMLCollections are callable as functions.
-DECLARE_CALLBACK(HTMLCollectionCallAsFunction)
-
-// HTMLSelectElement customized functions.
-DECLARE_CALLBACK(HTMLSelectElementRemove)
-
-// HTMLOptionsCollection customized functions.
-DECLARE_CALLBACK(HTMLOptionsCollectionRemove)
-DECLARE_CALLBACK(HTMLOptionsCollectionAdd)
-
-// HTMLDocument customized functions
-DECLARE_CALLBACK(HTMLDocumentWrite)
-DECLARE_CALLBACK(HTMLDocumentWriteln)
-DECLARE_CALLBACK(HTMLDocumentOpen)
-DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll)
-DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument)
-DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument)
-
-// Document customized functions
-DECLARE_CALLBACK(DocumentEvaluate)
-DECLARE_CALLBACK(DocumentGetCSSCanvasContext)
-
-// Window customized functions
-DECLARE_CALLBACK(DOMWindowAddEventListener)
-DECLARE_CALLBACK(DOMWindowRemoveEventListener)
-DECLARE_CALLBACK(DOMWindowPostMessage)
-DECLARE_CALLBACK(DOMWindowSetTimeout)
-DECLARE_CALLBACK(DOMWindowSetInterval)
-DECLARE_CALLBACK(DOMWindowAtob)
-DECLARE_CALLBACK(DOMWindowBtoa)
-DECLARE_CALLBACK(DOMWindowNOP)
-DECLARE_CALLBACK(DOMWindowToString)
-DECLARE_CALLBACK(DOMWindowShowModalDialog)
-DECLARE_CALLBACK(DOMWindowOpen)
-DECLARE_CALLBACK(DOMWindowClearTimeout)
-DECLARE_CALLBACK(DOMWindowClearInterval)
-
-DECLARE_CALLBACK(DOMParserConstructor)
-DECLARE_CALLBACK(HTMLImageElementConstructor)
-DECLARE_CALLBACK(HTMLOptionElementConstructor)
-DECLARE_CALLBACK(MessageChannelConstructor)
-DECLARE_CALLBACK(WebKitCSSMatrixConstructor)
-DECLARE_CALLBACK(WebKitPointConstructor)
-DECLARE_CALLBACK(XMLHttpRequestConstructor)
-DECLARE_CALLBACK(XMLSerializerConstructor)
-DECLARE_CALLBACK(XPathEvaluatorConstructor)
-DECLARE_CALLBACK(XSLTProcessorConstructor)
-
-// Implementation of custom XSLTProcessor methods.
-DECLARE_CALLBACK(XSLTProcessorImportStylesheet)
-DECLARE_CALLBACK(XSLTProcessorTransformToFragment)
-DECLARE_CALLBACK(XSLTProcessorTransformToDocument)
-DECLARE_CALLBACK(XSLTProcessorSetParameter)
-DECLARE_CALLBACK(XSLTProcessorGetParameter)
-DECLARE_CALLBACK(XSLTProcessorRemoveParameter)
-
-// CSSPrimitiveValue customized functions
-DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue)
-
-// Canvas 2D customized functions
-DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor)
-DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor)
-DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect)
-DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow)
-DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage)
-DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect)
-DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern)
-DECLARE_CALLBACK(CanvasRenderingContext2DFillText)
-DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText)
-DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData)
-
-// Implementation of Clipboard attributes and methods.
-DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes)
-DECLARE_CALLBACK(ClipboardClearData)
-DECLARE_CALLBACK(ClipboardGetData)
-DECLARE_CALLBACK(ClipboardSetData)
-DECLARE_CALLBACK(ClipboardSetDragImage);
-
-// Implementation of Element methods.
-DECLARE_CALLBACK(ElementQuerySelector)
-DECLARE_CALLBACK(ElementQuerySelectorAll)
-DECLARE_CALLBACK(ElementSetAttribute)
-DECLARE_CALLBACK(ElementSetAttributeNode)
-DECLARE_CALLBACK(ElementSetAttributeNS)
-DECLARE_CALLBACK(ElementSetAttributeNodeNS)
-
-// Implementation of custom Location methods.
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash)
-DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref)
-DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign)
-DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace)
-DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload)
-DECLARE_CALLBACK(LocationAssign)
-DECLARE_CALLBACK(LocationReplace)
-DECLARE_CALLBACK(LocationReload)
-DECLARE_CALLBACK(LocationToString)
-DECLARE_CALLBACK(LocationValueOf)
-
-// Implementation of custom Node methods.
-DECLARE_CALLBACK(NodeAddEventListener)
-DECLARE_CALLBACK(NodeRemoveEventListener)
-DECLARE_CALLBACK(NodeInsertBefore)
-DECLARE_CALLBACK(NodeReplaceChild)
-DECLARE_CALLBACK(NodeRemoveChild)
-DECLARE_CALLBACK(NodeAppendChild)
-
-// Custom implementation is Navigator properties.
-// We actually only need this because WebKit has
-// navigator.appVersion as custom. Our version just
-// passes through.
-DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion)
-
-// Custom implementation of XMLHttpRequest properties
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText)
-DECLARE_CALLBACK(XMLHttpRequestAddEventListener)
-DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener)
-DECLARE_CALLBACK(XMLHttpRequestOpen)
-DECLARE_CALLBACK(XMLHttpRequestSend)
-DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader)
-DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader)
-DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType)
-DECLARE_CALLBACK(XMLHttpRequestDispatchEvent)
-
-// Custom implementation of XMLHttpRequestUpload properties
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart)
-DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress)
-DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener)
-DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener)
-DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent)
-
-// Custom implementation of TreeWalker functions
-DECLARE_CALLBACK(TreeWalkerParentNode)
-DECLARE_CALLBACK(TreeWalkerFirstChild)
-DECLARE_CALLBACK(TreeWalkerLastChild)
-DECLARE_CALLBACK(TreeWalkerNextNode)
-DECLARE_CALLBACK(TreeWalkerPreviousNode)
-DECLARE_CALLBACK(TreeWalkerNextSibling)
-DECLARE_CALLBACK(TreeWalkerPreviousSibling)
-
-// Custom implementation of InspectorController functions
-DECLARE_CALLBACK(InspectorControllerProfiles)
-DECLARE_CALLBACK(InspectorControllerHighlightDOMNode)
-DECLARE_CALLBACK(InspectorControllerAddResourceSourceToFrame)
-DECLARE_CALLBACK(InspectorControllerGetResourceDocumentNode)
-DECLARE_CALLBACK(InspectorControllerAddSourceToFrame)
-DECLARE_CALLBACK(InspectorControllerSearch)
-DECLARE_CALLBACK(InspectorControllerSetting)
-DECLARE_CALLBACK(InspectorControllerInspectedWindow)
-DECLARE_CALLBACK(InspectorControllerSetSetting)
-DECLARE_CALLBACK(InspectorControllerCurrentCallFrame)
-DECLARE_CALLBACK(InspectorControllerDebuggerEnabled)
-DECLARE_CALLBACK(InspectorControllerPauseOnExceptions)
-DECLARE_CALLBACK(InspectorControllerProfilerEnabled)
-#if ENABLE(DATABASE)
-DECLARE_CALLBACK(InspectorControllerDatabaseTableNames)
-#endif
-DECLARE_CALLBACK(InspectorControllerWrapCallback)
-
-// Custom implementation of NodeIterator functions
-DECLARE_CALLBACK(NodeIteratorNextNode)
-DECLARE_CALLBACK(NodeIteratorPreviousNode)
-
-// Custom implementation of NodeFilter function
-DECLARE_CALLBACK(NodeFilterAcceptNode)
-
-// Custom implementation of HTMLFormElement
-DECLARE_CALLBACK(HTMLFormElementSubmit)
-
-DECLARE_INDEXED_PROPERTY_GETTER(DOMStringList)
-DECLARE_CALLBACK(DOMStringListItem)
-
-DECLARE_NAMED_PROPERTY_GETTER(DOMWindow)
-DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow)
-DECLARE_NAMED_ACCESS_CHECK(DOMWindow)
-DECLARE_INDEXED_ACCESS_CHECK(DOMWindow)
-
-DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement)
-DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement)
-DECLARE_NAMED_PROPERTY_GETTER(NodeList)
-DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap)
-DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration)
-DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration)
-DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement)
-DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement)
-DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement)
-DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement)
-
-// Plugin object can be called as function.
-DECLARE_CALLBACK(HTMLPlugInElement)
-
-DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList)
-DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap)
-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(HTMLCollection)
-
-// Canvas and supporting classes
-DECLARE_INDEXED_PROPERTY_GETTER(CanvasPixelArray)
-DECLARE_INDEXED_PROPERTY_SETTER(CanvasPixelArray)
-
-// MessagePort
-DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage)
-DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose)
-DECLARE_CALLBACK(MessagePortStartConversation)
-DECLARE_CALLBACK(MessagePortAddEventListener)
-DECLARE_CALLBACK(MessagePortRemoveEventListener)
-
-// Database
-DECLARE_CALLBACK(DatabaseChangeVersion)
-DECLARE_CALLBACK(DatabaseTransaction)
-DECLARE_CALLBACK(SQLTransactionExecuteSql)
-DECLARE_CALLBACK(SQLResultSetRowListItem)
-
-// ClientRectList
-DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList)
-
-// SVG custom properties and callbacks
-#if ENABLE(SVG)
-DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue)
-DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits)
-DECLARE_CALLBACK(SVGMatrixInverse)
-DECLARE_CALLBACK(SVGMatrixRotateFromVector)
-DECLARE_CALLBACK(SVGElementInstanceAddEventListener)
-DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener)
-#endif
-
-// Worker
-#if ENABLE(WORKERS)
-DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage)
-DECLARE_PROPERTY_ACCESSOR(WorkerOnerror)
-DECLARE_CALLBACK(WorkerConstructor)
-DECLARE_CALLBACK(WorkerAddEventListener)
-DECLARE_CALLBACK(WorkerRemoveEventListener)
-
-DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf)
-DECLARE_PROPERTY_ACCESSOR(WorkerContextOnmessage)
-DECLARE_CALLBACK(WorkerContextImportScripts)
-DECLARE_CALLBACK(WorkerContextSetTimeout)
-DECLARE_CALLBACK(WorkerContextClearTimeout)
-DECLARE_CALLBACK(WorkerContextSetInterval)
-DECLARE_CALLBACK(WorkerContextClearInterval)
-DECLARE_CALLBACK(WorkerContextAddEventListener)
-DECLARE_CALLBACK(WorkerContextRemoveEventListener)
-#endif
-
-// AppCache
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler)
-DECLARE_CALLBACK(DOMApplicationCacheAddEventListener)
-DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener)
-#endif
-
-#undef DECLARE_INDEXED_ACCESS_CHECK
-#undef DECLARE_NAMED_ACCESS_CHECK
-
-#undef DECLARE_PROPERTY_ACCESSOR_SETTER
-#undef DECLARE_PROPERTY_ACCESSOR_GETTER
-#undef DECLARE_PROPERTY_ACCESSOR
-
-#undef DECLARE_NAMED_PROPERTY_GETTER
-#undef DECLARE_NAMED_PROPERTY_SETTER
-#undef DECLARE_NAMED_PROPERTY_DELETER
-
-#undef DECLARE_INDEXED_PROPERTY_GETTER
-#undef DECLARE_INDEXED_PROPERTY_SETTER
-#undef DECLARE_INDEXED_PROPERTY_DELETER
-
-#undef DECLARE_CALLBACK
-
-  // Returns the NPObject corresponding to an HTMLElement object.
-  static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object> object);
-
-  // Returns the owner frame pointer of a DOM wrapper object. It only works for
-  // these DOM objects requiring cross-domain access check.
-  static Frame* GetTargetFrame(v8::Local<v8::Object> host,
-                               v8::Local<v8::Value> data);
-
-  // Special case for downcasting SVG path segments
-#if ENABLE(SVG)
-  static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* path_seg);
-#endif
-
- private:
-  static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args,
-                                                    bool single_shot);
-  static void ClearTimeoutImpl(const v8::Arguments& args);
-  static void WindowSetLocation(DOMWindow*, const String&);
-};
-
-}  // namespace WebCore
-
-#endif  // V8_CUSTOM_H__
diff --git a/V8Binding/binding/v8_index.cpp b/V8Binding/binding/v8_index.cpp
index df138dc..e002dd3 100644
--- a/V8Binding/binding/v8_index.cpp
+++ b/V8Binding/binding/v8_index.cpp
@@ -202,6 +202,11 @@
 #include "V8XMLSerializer.h"
 #include "V8RGBColor.h"
 
+#if ENABLE(DOM_STORAGE)
+#include "V8Storage.h"
+#include "V8StorageEvent.h"
+#endif
+
 #if PLATFORM(CHROMIUM)
 #include "V8InspectorController.h"
 #endif
diff --git a/V8Binding/binding/v8_index.h b/V8Binding/binding/v8_index.h
index 71453c3..12efa0b 100644
--- a/V8Binding/binding/v8_index.h
+++ b/V8Binding/binding/v8_index.h
@@ -357,6 +357,14 @@
 #define DOM_OBJECT_DATABASE_TYPES(V)
 #endif
 
+#if ENABLE(DOM_STORAGE)
+#define DOM_OBJECT_STORAGE_TYPES(V)                                     \
+   V(STORAGE, Storage)                                                  \
+   V(STORAGEEVENT, StorageEvent)
+#else
+#define DOM_OBJECT_STORAGE_TYPES(V)
+#endif
+
 #if PLATFORM(CHROMIUM)
 #define DOM_OBJECT_TYPES(V)                                             \
   DOM_OBJECT_TYPES_1(V)                                                 \
@@ -372,6 +380,7 @@
   DOM_OBJECT_TYPES_1(V)                                                 \
   DOM_OBJECT_TYPES_2(V)                                                 \
   DOM_OBJECT_DATABASE_TYPES(V)                                          \
+  DOM_OBJECT_STORAGE_TYPES(V)                                           \
   V(COORDINATES, Coordinates)                                           \
   V(GEOLOCATION, Geolocation)                                           \
   V(GEOPOSITION, Geoposition)                                           \
diff --git a/V8Binding/binding/v8_proxy.cpp b/V8Binding/binding/v8_proxy.cpp
index d3c5db9..c9e7058 100644
--- a/V8Binding/binding/v8_proxy.cpp
+++ b/V8Binding/binding/v8_proxy.cpp
@@ -41,7 +41,7 @@
 #include "v8_proxy.h"
 #include "v8_index.h"
 #include "v8_binding.h"
-#include "v8_custom.h"
+#include "V8CustomBinding.h"
 #include "V8Collection.h"
 #include "V8DOMWindow.h"
 
@@ -1468,6 +1468,21 @@
           collectionIndexedPropertyEnumerator<NamedNodeMap>,
           v8::Integer::New(V8ClassIndex::NODE));
       break;
+#if ENABLE(DOM_STORAGE)
+    case V8ClassIndex::STORAGE:
+      desc->InstanceTemplate()->SetNamedPropertyHandler(
+          USE_NAMED_PROPERTY_GETTER(Storage),
+          USE_NAMED_PROPERTY_SETTER(Storage),
+          0,
+          USE_NAMED_PROPERTY_DELETER(Storage),
+          V8Custom::v8StorageNamedPropertyEnumerator);
+       desc->InstanceTemplate()->SetIndexedPropertyHandler(
+          USE_INDEXED_PROPERTY_GETTER(Storage),
+          USE_INDEXED_PROPERTY_SETTER(Storage),
+          0,
+          USE_INDEXED_PROPERTY_DELETER(Storage));
+    break;
+#endif
     case V8ClassIndex::NODELIST:
       setCollectionIndexedGetter<NodeList, Node>(desc, V8ClassIndex::NODE);
       desc->InstanceTemplate()->SetNamedPropertyHandler(
diff --git a/V8Binding/binding/v8_proxy.h b/V8Binding/binding/v8_proxy.h
index a9f871e..708f63d 100644
--- a/V8Binding/binding/v8_proxy.h
+++ b/V8Binding/binding/v8_proxy.h
@@ -7,7 +7,7 @@
 
 #include <v8.h>
 #include "v8_index.h"
-#include "v8_custom.h"
+#include "V8CustomBinding.h"
 #include "V8Utilities.h"
 #include "Node.h"
 #include "NodeFilter.h"
@@ -69,6 +69,11 @@
 class NodeFilter;
 class ScriptExecutionContext;
 
+#if ENABLE(DOM_STORAGE)
+class Storage;
+class StorageEvent;
+#endif
+
 #if ENABLE(SVG)
 class SVGElementInstance;
 #endif
diff --git a/V8Binding/scripts/CodeGeneratorV8.pm b/V8Binding/scripts/CodeGeneratorV8.pm
index 7a2f930..af288ff 100644
--- a/V8Binding/scripts/CodeGeneratorV8.pm
+++ b/V8Binding/scripts/CodeGeneratorV8.pm
@@ -1135,7 +1135,7 @@
       #   for any event getter/setters anyway.
       if ($attrType eq "EventListener") {
         $attribute->signature->extendedAttributes->{"Custom"} = 1;
-        $implIncludes{"v8_custom.h"} = 1;
+        $implIncludes{"V8CustomBinding.h"} = 1;
         next;
       }
       
@@ -1144,19 +1144,19 @@
       # implementation.
       if ($attribute->signature->extendedAttributes->{"Custom"} ||
           $attribute->signature->extendedAttributes->{"V8Custom"}) {
-        $implIncludes{"v8_custom.h"} = 1;
+        $implIncludes{"V8CustomBinding.h"} = 1;
         next;
       }
 
       # Generate the accessor.
       if ($attribute->signature->extendedAttributes->{"CustomGetter"}) {
-        $implIncludes{"v8_custom.h"} = 1;
+        $implIncludes{"V8CustomBinding.h"} = 1;
       } else {
 	    GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName);
       }
       if ($attribute->signature->extendedAttributes->{"CustomSetter"} ||
           $attribute->signature->extendedAttributes->{"V8CustomSetter"}) {
-        $implIncludes{"v8_custom.h"} = 1;
+        $implIncludes{"V8CustomBinding.h"} = 1;
       } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
         $dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!";
 #        GenerateReplaceableAttrSetter($implClassName);
@@ -1176,7 +1176,7 @@
       # TODO(fqian): avoid naming conflict
       if ($function->signature->extendedAttributes->{"Custom"} ||
           $function->signature->extendedAttributes->{"V8Custom"}) {
-        $implIncludes{"v8_custom.h"} = 1;
+        $implIncludes{"V8CustomBinding.h"} = 1;
 
       } else {
         GenerateFunctionCallback($function, $dataNode, $classIndex, $implClassName);
@@ -1777,6 +1777,7 @@
     "PositionError" => 0,
     "Range" => 0,
     "SQLResultSet" => 0,
+    "Storage" => 0,
     "SVGAngle" => 0,
     "SVGElement" => 0,
     "SVGLength" => 1,
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index c6be03c..182c0a7 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -714,7 +714,6 @@
 	platform/graphics/android/ImageAndroid.cpp \
 	platform/graphics/android/ImageBufferAndroid.cpp \
 	platform/graphics/android/ImageSourceAndroid.cpp \
-	platform/graphics/android/MediaPlayerPrivateAndroid.cpp \
 	platform/graphics/android/PathAndroid.cpp \
 	platform/graphics/android/PatternAndroid.cpp \
 	platform/graphics/android/PlatformGraphicsContext.cpp \
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.cpp b/WebCore/bindings/v8/custom/V8CustomBinding.cpp
index 037c729..7789797 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.cpp
@@ -30,15 +30,21 @@
 
 #include "config.h"
 #include "V8CustomBinding.h"
-#include "V8Proxy.h"
 
+#include "CSSHelper.h"
 #include "Element.h"
 #include "Document.h"
+#include "DOMWindow.h"
+#include "History.h"
 #include "HTMLNames.h"
 #include "HTMLFrameElementBase.h"
-#include "CSSHelper.h"
+#include "Location.h"
 #include "V8Proxy.h"
 
+#if ENABLE(SVG)
+#include "SVGPathSeg.h"
+#endif
+
 namespace WebCore {
 
 bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase* frame, String value)
@@ -58,4 +64,119 @@
     return true;
 }
 
+// DOMImplementation is a singleton in WebCore. If we use our normal
+// mapping from DOM objects to V8 wrappers, the same wrapper will be
+// shared for all frames in the same process. This is a major
+// security problem. Therefore, we generate a DOMImplementation
+// wrapper per document and store it in an internal field of the
+// document. Since the DOMImplementation object is a singleton, we do
+// not have to do anything to keep the DOMImplementation object alive
+// for the lifetime of the wrapper.
+ACCESSOR_GETTER(DocumentImplementation)
+{
+    ASSERT(info.Holder()->InternalFieldCount() >= kDocumentMinimumInternalFieldCount);
+
+    // Check if the internal field already contains a wrapper.
+    v8::Local<v8::Value> implementation = info.Holder()->GetInternalField(kDocumentImplementationIndex);
+    if (!implementation->IsUndefined())
+        return implementation;
+
+    // Generate a wrapper.
+    Document* document = V8Proxy::DOMWrapperToNative<Document>(info.Holder());
+    v8::Handle<v8::Value> wrapper = V8Proxy::DOMImplementationToV8Object(document->implementation());
+
+    // Store the wrapper in the internal field.
+    info.Holder()->SetInternalField(kDocumentImplementationIndex, wrapper);
+
+    return wrapper;
+}
+
+// --------------- Security Checks -------------------------
+INDEXED_ACCESS_CHECK(History)
+{
+    ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
+    // Only allow same origin access.
+    History* history = V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
+    return V8Proxy::CanAccessFrame(history->frame(), false);
+}
+
+NAMED_ACCESS_CHECK(History)
+{
+    ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY);
+    // Only allow same origin access.
+    History* history = V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
+    return V8Proxy::CanAccessFrame(history->frame(), false);
+}
+
+#undef INDEXED_ACCESS_CHECK
+#undef NAMED_ACCESS_CHECK
+#undef NAMED_PROPERTY_GETTER
+#undef NAMED_PROPERTY_SETTER
+
+Frame* V8Custom::GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data)
+{
+    Frame* target = 0;
+    switch (V8ClassIndex::FromInt(data->Int32Value())) {
+    case V8ClassIndex::DOMWINDOW: {
+        v8::Handle<v8::Value> window = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, host);
+        if (window.IsEmpty())
+            return target;
+
+        DOMWindow* targetWindow = V8Proxy::ToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, window);
+        target = targetWindow->frame();
+        break;
+    }
+    case V8ClassIndex::LOCATION: {
+        History* history = V8Proxy::ToNativeObject<History>(V8ClassIndex::HISTORY, host);
+        target = history->frame();
+        break;
+    }
+    case V8ClassIndex::HISTORY: {
+        Location* location = V8Proxy::ToNativeObject<Location>(V8ClassIndex::LOCATION, host);
+        target = location->frame();
+        break;
+    }
+    default:
+        break;
+    }
+    return target;
+}
+
+#if ENABLE(SVG)
+V8ClassIndex::V8WrapperType V8Custom::DowncastSVGPathSeg(void* pathSeg)
+{
+    WebCore::SVGPathSeg* realPathSeg = reinterpret_cast<WebCore::SVGPathSeg*>(pathSeg);
+
+    switch (realPathSeg->pathSegType()) {
+#define MAKE_CASE(svgValue, v8Value) case WebCore::SVGPathSeg::svgValue: return V8ClassIndex::v8Value
+
+    MAKE_CASE(PATHSEG_CLOSEPATH,                    SVGPATHSEGCLOSEPATH);
+    MAKE_CASE(PATHSEG_MOVETO_ABS,                   SVGPATHSEGMOVETOABS);
+    MAKE_CASE(PATHSEG_MOVETO_REL,                   SVGPATHSEGMOVETOREL);
+    MAKE_CASE(PATHSEG_LINETO_ABS,                   SVGPATHSEGLINETOABS);
+    MAKE_CASE(PATHSEG_LINETO_REL,                   SVGPATHSEGLINETOREL);
+    MAKE_CASE(PATHSEG_CURVETO_CUBIC_ABS,            SVGPATHSEGCURVETOCUBICABS);
+    MAKE_CASE(PATHSEG_CURVETO_CUBIC_REL,            SVGPATHSEGCURVETOCUBICREL);
+    MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_ABS,        SVGPATHSEGCURVETOQUADRATICABS);
+    MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_REL,        SVGPATHSEGCURVETOQUADRATICREL);
+    MAKE_CASE(PATHSEG_ARC_ABS,                      SVGPATHSEGARCABS);
+    MAKE_CASE(PATHSEG_ARC_REL,                      SVGPATHSEGARCREL);
+    MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_ABS,        SVGPATHSEGLINETOHORIZONTALABS);
+    MAKE_CASE(PATHSEG_LINETO_HORIZONTAL_REL,        SVGPATHSEGLINETOHORIZONTALREL);
+    MAKE_CASE(PATHSEG_LINETO_VERTICAL_ABS,          SVGPATHSEGLINETOVERTICALABS);
+    MAKE_CASE(PATHSEG_LINETO_VERTICAL_REL,          SVGPATHSEGLINETOVERTICALREL);
+    MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,     SVGPATHSEGCURVETOCUBICSMOOTHABS);
+    MAKE_CASE(PATHSEG_CURVETO_CUBIC_SMOOTH_REL,     SVGPATHSEGCURVETOCUBICSMOOTHREL);
+    MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, SVGPATHSEGCURVETOQUADRATICSMOOTHABS);
+    MAKE_CASE(PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, SVGPATHSEGCURVETOQUADRATICSMOOTHREL);
+
+#undef MAKE_CASE
+
+    default:
+        return V8ClassIndex::INVALID_CLASS_INDEX;
+    }
+}
+
+#endif // ENABLE(SVG)
+
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 20fa6a1..ae8c6ee 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -31,19 +31,512 @@
 #ifndef V8CustomBinding_h
 #define V8CustomBinding_h
 
-// FIXME: This is a temporary forwarding header until all bindings have migrated
-// over and v8_custom actually becomes V8CustomBinding.
-#include "v8_custom.h"
+#include "V8Index.h"
+#include <v8.h>
+
+struct NPObject;
+
+#define CALLBACK_FUNC_DECL(NAME) v8::Handle<v8::Value> V8Custom::v8##NAME##Callback(const v8::Arguments& args)
+
+#define ACCESSOR_GETTER(NAME) \
+    v8::Handle<v8::Value> V8Custom::v8##NAME##AccessorGetter( \
+        v8::Local<v8::String> name, const v8::AccessorInfo& info)
+
+#define ACCESSOR_SETTER(NAME) \
+    void V8Custom::v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
+        v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+
+#define INDEXED_PROPERTY_GETTER(NAME) \
+    v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertyGetter( \
+        uint32_t index, const v8::AccessorInfo& info)
+
+#define INDEXED_PROPERTY_SETTER(NAME) \
+    v8::Handle<v8::Value> V8Custom::v8##NAME##IndexedPropertySetter( \
+        uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+
+#define INDEXED_PROPERTY_DELETER(NAME) \
+    v8::Handle<v8::Boolean> V8Custom::v8##NAME##IndexedPropertyDeleter( \
+        uint32_t index, const v8::AccessorInfo& info)
+
+#define NAMED_PROPERTY_GETTER(NAME) \
+    v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertyGetter( \
+        v8::Local<v8::String> name, const v8::AccessorInfo& info)
+
+#define NAMED_PROPERTY_SETTER(NAME) \
+    v8::Handle<v8::Value> V8Custom::v8##NAME##NamedPropertySetter( \
+        v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+
+#define NAMED_PROPERTY_DELETER(NAME) \
+    v8::Handle<v8::Boolean> V8Custom::v8##NAME##NamedPropertyDeleter( \
+        v8::Local<v8::String> name, const v8::AccessorInfo& info)
+
+#define NAMED_ACCESS_CHECK(NAME) \
+    bool V8Custom::v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
+        v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
+
+#define INDEXED_ACCESS_CHECK(NAME) \
+    bool V8Custom::v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
+        uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
 
 namespace WebCore {
 
-    class HTMLFrameElementBase;
+    class DOMWindow;
     class Element;
+    class Frame;
+    class HTMLCollection;
+    class HTMLFrameElementBase;
     class String;
+    class V8Proxy;
 
     bool allowSettingFrameSrcToJavascriptUrl(HTMLFrameElementBase*, String value);
     bool allowSettingSrcToJavascriptURL(Element*, String name, String value);
 
+    class V8Custom {
+    public:
+        // Constants.
+        static const int kDOMWrapperTypeIndex = 0;
+        static const int kDOMWrapperObjectIndex = 1;
+        static const int kDefaultWrapperInternalFieldCount = 2;
+
+        static const int kNPObjectInternalFieldCount = kDefaultWrapperInternalFieldCount + 0;
+
+        static const int kDocumentImplementationIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kDocumentMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+
+        static const int kHTMLDocumentMarkerIndex = kDocumentMinimumInternalFieldCount + 0;
+        static const int kHTMLDocumentShadowIndex = kDocumentMinimumInternalFieldCount + 1;
+        static const int kHTMLDocumentInternalFieldCount = kDocumentMinimumInternalFieldCount + 2;
+
+        static const int kXMLHttpRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kXMLHttpRequestInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+
+        static const int kMessageChannelPort1Index = kDefaultWrapperInternalFieldCount + 0;
+        static const int kMessageChannelPort2Index = kDefaultWrapperInternalFieldCount + 1;
+        static const int kMessageChannelInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
+
+        static const int kMessagePortRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kMessagePortEntangledPortIndex = kDefaultWrapperInternalFieldCount + 1;
+        static const int kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 2;
+
+#if ENABLE(WORKERS)
+        static const int kWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+
+        static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kWorkerContextInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+#endif
+
+        static const int kDOMWindowConsoleIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kDOMWindowHistoryIndex = kDefaultWrapperInternalFieldCount + 1;
+        static const int kDOMWindowLocationbarIndex = kDefaultWrapperInternalFieldCount + 2;
+        static const int kDOMWindowMenubarIndex = kDefaultWrapperInternalFieldCount + 3;
+        static const int kDOMWindowNavigatorIndex = kDefaultWrapperInternalFieldCount + 4;
+        static const int kDOMWindowPersonalbarIndex = kDefaultWrapperInternalFieldCount + 5;
+        static const int kDOMWindowScreenIndex = kDefaultWrapperInternalFieldCount + 6;
+        static const int kDOMWindowScrollbarsIndex = kDefaultWrapperInternalFieldCount + 7;
+        static const int kDOMWindowSelectionIndex = kDefaultWrapperInternalFieldCount + 8;
+        static const int kDOMWindowStatusbarIndex = kDefaultWrapperInternalFieldCount + 9;
+        static const int kDOMWindowToolbarIndex = kDefaultWrapperInternalFieldCount + 10;
+        static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 11;
+        static const int kDOMWindowDOMSelectionIndex = kDefaultWrapperInternalFieldCount + 12;
+        static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 13;
+
+        static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
+        static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+  static const int kDOMApplicationCacheCacheIndex =
+                      kDefaultWrapperInternalFieldCount + 0;
+  static const int kDOMApplicationCacheFieldCount =
+                      kDefaultWrapperInternalFieldCount + 1;
+#endif
+
+#define DECLARE_PROPERTY_ACCESSOR_GETTER(NAME) \
+    static v8::Handle<v8::Value> v8##NAME##AccessorGetter( \
+        v8::Local<v8::String> name, const v8::AccessorInfo& info)
+
+#define DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)  \
+    static void v8##NAME##AccessorSetter(v8::Local<v8::String> name, \
+        v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+
+#define DECLARE_PROPERTY_ACCESSOR(NAME) DECLARE_PROPERTY_ACCESSOR_GETTER(NAME); DECLARE_PROPERTY_ACCESSOR_SETTER(NAME)
+
+#define DECLARE_NAMED_PROPERTY_GETTER(NAME)  \
+    static v8::Handle<v8::Value> v8##NAME##NamedPropertyGetter( \
+        v8::Local<v8::String> name, const v8::AccessorInfo& info)
+
+#define DECLARE_NAMED_PROPERTY_SETTER(NAME) \
+    static v8::Handle<v8::Value> v8##NAME##NamedPropertySetter( \
+        v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+
+#define DECLARE_NAMED_PROPERTY_DELETER(NAME) \
+    static v8::Handle<v8::Boolean> v8##NAME##NamedPropertyDeleter( \
+        v8::Local<v8::String> name, const v8::AccessorInfo& info)
+
+#define USE_NAMED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##NamedPropertyGetter
+
+#define USE_NAMED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##NamedPropertySetter
+
+#define USE_NAMED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##NamedPropertyDeleter
+
+#define DECLARE_INDEXED_PROPERTY_GETTER(NAME) \
+    static v8::Handle<v8::Value> v8##NAME##IndexedPropertyGetter( \
+        uint32_t index, const v8::AccessorInfo& info)
+
+#define DECLARE_INDEXED_PROPERTY_SETTER(NAME) \
+    static v8::Handle<v8::Value> v8##NAME##IndexedPropertySetter( \
+        uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+
+#define DECLARE_INDEXED_PROPERTY_DELETER(NAME) \
+    static v8::Handle<v8::Boolean> v8##NAME##IndexedPropertyDeleter( \
+        uint32_t index, const v8::AccessorInfo& info)
+
+#define USE_INDEXED_PROPERTY_GETTER(NAME) V8Custom::v8##NAME##IndexedPropertyGetter
+
+#define USE_INDEXED_PROPERTY_SETTER(NAME) V8Custom::v8##NAME##IndexedPropertySetter
+
+#define USE_INDEXED_PROPERTY_DELETER(NAME) V8Custom::v8##NAME##IndexedPropertyDeleter
+
+#define DECLARE_CALLBACK(NAME) static v8::Handle<v8::Value> v8##NAME##Callback(const v8::Arguments& args)
+
+#define USE_CALLBACK(NAME) V8Custom::v8##NAME##Callback
+
+#define DECLARE_NAMED_ACCESS_CHECK(NAME) \
+    static bool v8##NAME##NamedSecurityCheck(v8::Local<v8::Object> host, \
+        v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data)
+
+#define DECLARE_INDEXED_ACCESS_CHECK(NAME) \
+    static bool v8##NAME##IndexedSecurityCheck(v8::Local<v8::Object> host, \
+        uint32_t index, v8::AccessType type, v8::Local<v8::Value> data)
+
+        DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle);
+        DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener);
+
+        DECLARE_PROPERTY_ACCESSOR(DocumentLocation);
+        DECLARE_PROPERTY_ACCESSOR(DocumentImplementation);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(EventSrcElement);
+        DECLARE_PROPERTY_ACCESSOR(EventReturnValue);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(EventDataTransfer);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(EventClipboardData);
+
+        DECLARE_PROPERTY_ACCESSOR(DOMWindowEventHandler);
+        DECLARE_PROPERTY_ACCESSOR(ElementEventHandler);
+
+        DECLARE_CALLBACK(HTMLCanvasElementGetContext);
+
+        DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementSrc);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLFrameElementLocation);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLIFrameElementSrc);
+
+        DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue);
+
+        DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength);
+
+        DECLARE_CALLBACK(HTMLInputElementSetSelectionRange);
+
+        DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionStart);
+        DECLARE_PROPERTY_ACCESSOR(HTMLInputElementSelectionEnd);
+
+        DECLARE_NAMED_ACCESS_CHECK(Location);
+        DECLARE_INDEXED_ACCESS_CHECK(History);
+
+        DECLARE_NAMED_ACCESS_CHECK(History);
+        DECLARE_INDEXED_ACCESS_CHECK(Location);
+
+        DECLARE_CALLBACK(HTMLCollectionItem);
+        DECLARE_CALLBACK(HTMLCollectionNamedItem);
+        DECLARE_CALLBACK(HTMLCollectionCallAsFunction);
+
+        DECLARE_CALLBACK(HTMLSelectElementRemove);
+
+        DECLARE_CALLBACK(HTMLOptionsCollectionRemove);
+        DECLARE_CALLBACK(HTMLOptionsCollectionAdd);
+
+        DECLARE_CALLBACK(HTMLDocumentWrite);
+        DECLARE_CALLBACK(HTMLDocumentWriteln);
+        DECLARE_CALLBACK(HTMLDocumentOpen);
+        DECLARE_PROPERTY_ACCESSOR(HTMLDocumentAll);
+        DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument);
+        DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument);
+
+        DECLARE_CALLBACK(DocumentEvaluate);
+        DECLARE_CALLBACK(DocumentGetCSSCanvasContext);
+
+        DECLARE_CALLBACK(DOMWindowAddEventListener);
+        DECLARE_CALLBACK(DOMWindowRemoveEventListener);
+        DECLARE_CALLBACK(DOMWindowPostMessage);
+        DECLARE_CALLBACK(DOMWindowSetTimeout);
+        DECLARE_CALLBACK(DOMWindowSetInterval);
+        DECLARE_CALLBACK(DOMWindowAtob);
+        DECLARE_CALLBACK(DOMWindowBtoa);
+        DECLARE_CALLBACK(DOMWindowNOP);
+        DECLARE_CALLBACK(DOMWindowToString);
+        DECLARE_CALLBACK(DOMWindowShowModalDialog);
+        DECLARE_CALLBACK(DOMWindowOpen);
+        DECLARE_CALLBACK(DOMWindowClearTimeout);
+        DECLARE_CALLBACK(DOMWindowClearInterval);
+
+        DECLARE_CALLBACK(DOMParserConstructor);
+        DECLARE_CALLBACK(HTMLAudioElementConstructor);
+        DECLARE_CALLBACK(HTMLImageElementConstructor);
+        DECLARE_CALLBACK(HTMLOptionElementConstructor);
+        DECLARE_CALLBACK(MessageChannelConstructor);
+        DECLARE_CALLBACK(WebKitCSSMatrixConstructor);
+        DECLARE_CALLBACK(WebKitPointConstructor);
+        DECLARE_CALLBACK(XMLHttpRequestConstructor);
+        DECLARE_CALLBACK(XMLSerializerConstructor);
+        DECLARE_CALLBACK(XPathEvaluatorConstructor);
+        DECLARE_CALLBACK(XSLTProcessorConstructor);
+
+        DECLARE_CALLBACK(XSLTProcessorImportStylesheet);
+        DECLARE_CALLBACK(XSLTProcessorTransformToFragment);
+        DECLARE_CALLBACK(XSLTProcessorTransformToDocument);
+        DECLARE_CALLBACK(XSLTProcessorSetParameter);
+        DECLARE_CALLBACK(XSLTProcessorGetParameter);
+        DECLARE_CALLBACK(XSLTProcessorRemoveParameter);
+
+        DECLARE_CALLBACK(CSSPrimitiveValueGetRGBColorValue);
+
+        DECLARE_CALLBACK(CanvasRenderingContext2DSetStrokeColor);
+        DECLARE_CALLBACK(CanvasRenderingContext2DSetFillColor);
+        DECLARE_CALLBACK(CanvasRenderingContext2DStrokeRect);
+        DECLARE_CALLBACK(CanvasRenderingContext2DSetShadow);
+        DECLARE_CALLBACK(CanvasRenderingContext2DDrawImage);
+        DECLARE_CALLBACK(CanvasRenderingContext2DDrawImageFromRect);
+        DECLARE_CALLBACK(CanvasRenderingContext2DCreatePattern);
+        DECLARE_CALLBACK(CanvasRenderingContext2DFillText);
+        DECLARE_CALLBACK(CanvasRenderingContext2DStrokeText);
+        DECLARE_CALLBACK(CanvasRenderingContext2DPutImageData);
+
+        DECLARE_PROPERTY_ACCESSOR_GETTER(ClipboardTypes);
+        DECLARE_CALLBACK(ClipboardClearData);
+        DECLARE_CALLBACK(ClipboardGetData);
+        DECLARE_CALLBACK(ClipboardSetData);
+        DECLARE_CALLBACK(ClipboardSetDragImage);
+
+        DECLARE_CALLBACK(ElementQuerySelector);
+        DECLARE_CALLBACK(ElementQuerySelectorAll);
+        DECLARE_CALLBACK(ElementSetAttribute);
+        DECLARE_CALLBACK(ElementSetAttributeNode);
+        DECLARE_CALLBACK(ElementSetAttributeNS);
+        DECLARE_CALLBACK(ElementSetAttributeNodeNS);
+
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationProtocol);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHost);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHostname);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPort);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationPathname);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationSearch);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHash);
+        DECLARE_PROPERTY_ACCESSOR_SETTER(LocationHref);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(LocationAssign);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReplace);
+        DECLARE_PROPERTY_ACCESSOR_GETTER(LocationReload);
+        DECLARE_CALLBACK(LocationAssign);
+        DECLARE_CALLBACK(LocationReplace);
+        DECLARE_CALLBACK(LocationReload);
+        DECLARE_CALLBACK(LocationToString);
+        DECLARE_CALLBACK(LocationValueOf);
+
+        DECLARE_CALLBACK(NodeAddEventListener);
+        DECLARE_CALLBACK(NodeRemoveEventListener);
+        DECLARE_CALLBACK(NodeInsertBefore);
+        DECLARE_CALLBACK(NodeReplaceChild);
+        DECLARE_CALLBACK(NodeRemoveChild);
+        DECLARE_CALLBACK(NodeAppendChild);
+
+        // We actually only need this because WebKit has
+        // navigator.appVersion as custom. Our version just
+        // passes through.
+        DECLARE_PROPERTY_ACCESSOR(NavigatorAppVersion);
+
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnabort);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnerror);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnload);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnloadstart);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnprogress);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestOnreadystatechange);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestResponseText);
+        DECLARE_CALLBACK(XMLHttpRequestAddEventListener);
+        DECLARE_CALLBACK(XMLHttpRequestRemoveEventListener);
+        DECLARE_CALLBACK(XMLHttpRequestOpen);
+        DECLARE_CALLBACK(XMLHttpRequestSend);
+        DECLARE_CALLBACK(XMLHttpRequestSetRequestHeader);
+        DECLARE_CALLBACK(XMLHttpRequestGetResponseHeader);
+        DECLARE_CALLBACK(XMLHttpRequestOverrideMimeType);
+        DECLARE_CALLBACK(XMLHttpRequestDispatchEvent);
+
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnabort);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnerror);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnload);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnloadstart);
+        DECLARE_PROPERTY_ACCESSOR(XMLHttpRequestUploadOnprogress);
+        DECLARE_CALLBACK(XMLHttpRequestUploadAddEventListener);
+        DECLARE_CALLBACK(XMLHttpRequestUploadRemoveEventListener);
+        DECLARE_CALLBACK(XMLHttpRequestUploadDispatchEvent);
+
+        DECLARE_CALLBACK(TreeWalkerParentNode);
+        DECLARE_CALLBACK(TreeWalkerFirstChild);
+        DECLARE_CALLBACK(TreeWalkerLastChild);
+        DECLARE_CALLBACK(TreeWalkerNextNode);
+        DECLARE_CALLBACK(TreeWalkerPreviousNode);
+        DECLARE_CALLBACK(TreeWalkerNextSibling);
+        DECLARE_CALLBACK(TreeWalkerPreviousSibling);
+
+        DECLARE_CALLBACK(InspectorControllerProfiles);
+        DECLARE_CALLBACK(InspectorControllerHighlightDOMNode);
+        DECLARE_CALLBACK(InspectorControllerAddResourceSourceToFrame);
+        DECLARE_CALLBACK(InspectorControllerGetResourceDocumentNode);
+        DECLARE_CALLBACK(InspectorControllerAddSourceToFrame);
+        DECLARE_CALLBACK(InspectorControllerSearch);
+        DECLARE_CALLBACK(InspectorControllerSetting);
+        DECLARE_CALLBACK(InspectorControllerInspectedWindow);
+        DECLARE_CALLBACK(InspectorControllerSetSetting);
+        DECLARE_CALLBACK(InspectorControllerCurrentCallFrame);
+        DECLARE_CALLBACK(InspectorControllerDebuggerEnabled);
+        DECLARE_CALLBACK(InspectorControllerPauseOnExceptions);
+        DECLARE_CALLBACK(InspectorControllerProfilerEnabled);
+#if ENABLE(DATABASE)
+        DECLARE_CALLBACK(InspectorControllerDatabaseTableNames);
+#endif
+        DECLARE_CALLBACK(InspectorControllerWrapCallback);
+
+        DECLARE_CALLBACK(NodeIteratorNextNode);
+        DECLARE_CALLBACK(NodeIteratorPreviousNode);
+
+        DECLARE_CALLBACK(NodeFilterAcceptNode);
+
+        DECLARE_CALLBACK(HTMLFormElementSubmit);
+
+        DECLARE_INDEXED_PROPERTY_GETTER(DOMStringList);
+        DECLARE_CALLBACK(DOMStringListItem);
+
+        DECLARE_NAMED_PROPERTY_GETTER(DOMWindow);
+        DECLARE_INDEXED_PROPERTY_GETTER(DOMWindow);
+        DECLARE_NAMED_ACCESS_CHECK(DOMWindow);
+        DECLARE_INDEXED_ACCESS_CHECK(DOMWindow);
+
+        DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement);
+        DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement);
+        DECLARE_NAMED_PROPERTY_GETTER(NodeList);
+        DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap);
+        DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration);
+        DECLARE_NAMED_PROPERTY_SETTER(CSSStyleDeclaration);
+        DECLARE_NAMED_PROPERTY_GETTER(HTMLPlugInElement);
+        DECLARE_NAMED_PROPERTY_SETTER(HTMLPlugInElement);
+        DECLARE_INDEXED_PROPERTY_GETTER(HTMLPlugInElement);
+        DECLARE_INDEXED_PROPERTY_SETTER(HTMLPlugInElement);
+
+        DECLARE_CALLBACK(HTMLPlugInElement);
+
+        DECLARE_NAMED_PROPERTY_GETTER(StyleSheetList);
+        DECLARE_INDEXED_PROPERTY_GETTER(NamedNodeMap);
+        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(HTMLCollection);
+
+        DECLARE_INDEXED_PROPERTY_GETTER(CanvasPixelArray);
+        DECLARE_INDEXED_PROPERTY_SETTER(CanvasPixelArray);
+
+        DECLARE_PROPERTY_ACCESSOR(MessagePortOnmessage);
+        DECLARE_PROPERTY_ACCESSOR(MessagePortOnclose);
+        DECLARE_CALLBACK(MessagePortStartConversation);
+        DECLARE_CALLBACK(MessagePortAddEventListener);
+        DECLARE_CALLBACK(MessagePortRemoveEventListener);
+
+        DECLARE_CALLBACK(DatabaseChangeVersion);
+        DECLARE_CALLBACK(DatabaseTransaction);
+        DECLARE_CALLBACK(SQLTransactionExecuteSql);
+        DECLARE_CALLBACK(SQLResultSetRowListItem);
+
+        DECLARE_INDEXED_PROPERTY_GETTER(ClientRectList);
+
+#if ENABLE(DOM_STORAGE)
+        DECLARE_INDEXED_PROPERTY_GETTER(Storage);
+        DECLARE_INDEXED_PROPERTY_SETTER(Storage);
+        DECLARE_INDEXED_PROPERTY_DELETER(Storage);
+        DECLARE_NAMED_PROPERTY_GETTER(Storage);
+        DECLARE_NAMED_PROPERTY_SETTER(Storage);
+        DECLARE_NAMED_PROPERTY_DELETER(Storage);
+        static v8::Handle<v8::Array> v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info);
+#endif
+
+#if ENABLE(SVG)
+        DECLARE_PROPERTY_ACCESSOR_GETTER(SVGLengthValue);
+        DECLARE_CALLBACK(SVGLengthConvertToSpecifiedUnits);
+        DECLARE_CALLBACK(SVGMatrixInverse);
+        DECLARE_CALLBACK(SVGMatrixRotateFromVector);
+        DECLARE_CALLBACK(SVGElementInstanceAddEventListener);
+        DECLARE_CALLBACK(SVGElementInstanceRemoveEventListener);
+#endif
+
+#if ENABLE(WORKERS)
+        DECLARE_PROPERTY_ACCESSOR(WorkerOnmessage);
+        DECLARE_PROPERTY_ACCESSOR(WorkerOnerror);
+        DECLARE_CALLBACK(WorkerConstructor);
+        DECLARE_CALLBACK(WorkerAddEventListener);
+        DECLARE_CALLBACK(WorkerRemoveEventListener);
+
+        DECLARE_PROPERTY_ACCESSOR_GETTER(WorkerContextSelf);
+        DECLARE_PROPERTY_ACCESSOR(WorkerContextOnmessage);
+        DECLARE_CALLBACK(WorkerContextImportScripts);
+        DECLARE_CALLBACK(WorkerContextSetTimeout);
+        DECLARE_CALLBACK(WorkerContextClearTimeout);
+        DECLARE_CALLBACK(WorkerContextSetInterval);
+        DECLARE_CALLBACK(WorkerContextClearInterval);
+        DECLARE_CALLBACK(WorkerContextAddEventListener);
+        DECLARE_CALLBACK(WorkerContextRemoveEventListener);
+#endif
+
+// AppCache
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+        DECLARE_PROPERTY_ACCESSOR(DOMApplicationCacheEventHandler);
+        DECLARE_CALLBACK(DOMApplicationCacheAddEventListener);
+        DECLARE_CALLBACK(DOMApplicationCacheRemoveEventListener);
+#endif
+
+#undef DECLARE_INDEXED_ACCESS_CHECK
+#undef DECLARE_NAMED_ACCESS_CHECK
+
+#undef DECLARE_PROPERTY_ACCESSOR_SETTER
+#undef DECLARE_PROPERTY_ACCESSOR_GETTER
+#undef DECLARE_PROPERTY_ACCESSOR
+
+#undef DECLARE_NAMED_PROPERTY_GETTER
+#undef DECLARE_NAMED_PROPERTY_SETTER
+#undef DECLARE_NAMED_PROPERTY_DELETER
+
+#undef DECLARE_INDEXED_PROPERTY_GETTER
+#undef DECLARE_INDEXED_PROPERTY_SETTER
+#undef DECLARE_INDEXED_PROPERTY_DELETER
+
+#undef DECLARE_CALLBACK
+
+        // Returns the NPObject corresponding to an HTMLElement object.
+        static NPObject* GetHTMLPlugInElementNPObject(v8::Handle<v8::Object>);
+
+        // Returns the owner frame pointer of a DOM wrapper object. It only works for
+        // these DOM objects requiring cross-domain access check.
+        static Frame* GetTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data);
+
+        // Special case for downcasting SVG path segments.
+#if ENABLE(SVG)
+        static V8ClassIndex::V8WrapperType DowncastSVGPathSeg(void* pathSeg);
+#endif
+
+    private:
+        static v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments&, bool singleShot);
+        static void ClearTimeoutImpl(const v8::Arguments&);
+        static void WindowSetLocation(DOMWindow*, const String&);
+    };
+
 } // namespace WebCore
 
 #endif // V8CustomBinding_h
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
index 2581d46..6996d35 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -33,10 +33,10 @@
 #if ENABLE(DATABASE)
 
 #include "v8_binding.h"
-#include "v8_custom.h"
 #include "v8_proxy.h"
 
 #include "Database.h"
+#include "V8CustomBinding.h"
 #include "V8CustomSQLTransactionCallback.h"
 #include "V8CustomSQLTransactionErrorCallback.h"
 #include "V8CustomVoidCallback.h"
diff --git a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
index 2481a4f..eaeb26d 100644
--- a/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
@@ -33,10 +33,10 @@
 #if ENABLE(DATABASE)
 
 #include "v8_binding.h"
-#include "v8_custom.h"
 #include "v8_proxy.h"
 
 #include "SQLResultSetRowList.h"
+#include "V8CustomBinding.h"
 
 namespace WebCore {
 
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
index fca60a0..15cd379 100644
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -33,11 +33,11 @@
 #if ENABLE(DATABASE)
 
 #include "v8_binding.h"
-#include "v8_custom.h"
 #include "v8_proxy.h"
 
 #include "Database.h"
 #include "SQLValue.h"
+#include "V8CustomBinding.h"
 #include "V8CustomSQLStatementCallback.h"
 #include "V8CustomSQLStatementErrorCallback.h"
 #include <wtf/Vector.h>
diff --git a/WebCore/bindings/v8/custom/V8StorageCustom.cpp b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
new file mode 100755
index 0000000..af8b4c8
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8StorageCustom.cpp
@@ -0,0 +1,146 @@
+/*
+* 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"
+
+#if ENABLE(DOM_STORAGE)
+
+#include "Storage.h"
+#include "V8Binding.h"
+#include "V8CustomBinding.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+// Get an array containing the names of indexed properties in a collection.
+v8::Handle<v8::Array> V8Custom::v8StorageNamedPropertyEnumerator(const v8::AccessorInfo& info)
+{
+    Storage* storage = V8Proxy::ToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+    unsigned int length = storage->length();
+    v8::Handle<v8::Array> properties = v8::Array::New(length);
+    for (unsigned int i = 0; i < length; ++i) {
+        ExceptionCode ec = 0;
+        String key = storage->key(i, ec);
+        ASSERT(!ec);
+        String val = storage->getItem(key);
+        properties->Set(v8::Integer::New(i), v8String(key));
+    }
+
+    return properties;
+}
+
+static v8::Handle<v8::Value> storageGetter(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
+{
+    Storage* storage = V8Proxy::ToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+    String name = toWebCoreString(v8Name);
+
+    if (storage->contains(name))
+        return v8String(storage->getItem(name));
+
+    return notHandledByInterceptor();
+}
+
+INDEXED_PROPERTY_GETTER(Storage)
+{
+    INC_STATS("DOM.Storage.IndexedPropertyGetter");
+    v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
+    return storageGetter(indexV8->ToString(), info);
+}
+
+NAMED_PROPERTY_GETTER(Storage)
+{
+    INC_STATS("DOM.Storage.NamedPropertyGetter");
+    return storageGetter(name, info);
+}
+
+static v8::Handle<v8::Value> storageSetter(v8::Local<v8::String> v8Name, v8::Local<v8::Value> v8Value, const v8::AccessorInfo& info)
+{
+    Storage* storage = V8Proxy::ToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+    String name = toWebCoreString(v8Name);
+    String value = toWebCoreString(v8Value);
+
+    // Silently ignore length (rather than letting the bindings raise an exception).
+    if (name == "length")
+        return v8Value;
+
+    v8::Handle<v8::Value> prototypeValue = info.Holder()->GetRealNamedPropertyInPrototypeChain(v8Name);
+    if (!prototypeValue.IsEmpty())
+        return notHandledByInterceptor();
+
+    ExceptionCode ec = 0;
+    storage->setItem(name, value, ec);
+    if (ec)
+        return throwError(ec);
+
+    return v8Value;
+}
+
+INDEXED_PROPERTY_SETTER(Storage)
+{
+    INC_STATS("DOM.Storage.NamedPropertyGetter");
+    v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
+    return storageSetter(indexV8->ToString(), value, info);
+}
+
+NAMED_PROPERTY_SETTER(Storage)
+{
+    INC_STATS("DOM.Storage.NamedPropertySetter");
+    return storageSetter(name, value, info);
+}
+
+static v8::Handle<v8::Boolean> storageDeleter(v8::Local<v8::String> v8Name, const v8::AccessorInfo& info)
+{
+    Storage* storage = V8Proxy::ToNativeObject<Storage>(V8ClassIndex::STORAGE, info.Holder());
+    String name = toWebCoreString(v8Name);
+    
+    if (storage->contains(name)) {
+        storage->removeItem(name);
+        return v8::True();
+    }
+
+    return deletionNotHandledByInterceptor();
+}
+
+INDEXED_PROPERTY_DELETER(Storage)
+{
+    INC_STATS("DOM.Storage.IndexedPropertyDeleter");
+    v8::Local<v8::Integer> indexV8 = v8::Integer::New(index);
+    return storageDeleter(indexV8->ToString(), info);
+}
+
+NAMED_PROPERTY_DELETER(Storage)
+{
+    INC_STATS("DOM.Storage.NamedPropertyDeleter");
+    return storageDeleter(name, info);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
new file mode 100755
index 0000000..d70ebf1
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2007, 2008, 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 "V8CustomBinding.h"
+#include "V8Index.h"
+#include "V8Proxy.h"
+#include "WebKitPoint.h"
+
+namespace WebCore {
+
+CALLBACK_FUNC_DECL(WebKitPointConstructor)
+{
+    INC_STATS("DOM.WebKitPoint.Constructor");
+    return V8Proxy::ConstructDOMObject<V8ClassIndex::WEBKITPOINT, WebKitPoint>(args);
+}
+
+} // namespace WebCore
diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp
index 25e9adf..413050d 100644
--- a/WebCore/html/HTMLTokenizer.cpp
+++ b/WebCore/html/HTMLTokenizer.cpp
@@ -876,7 +876,9 @@
                     }
                 } else {
                     // FIXME: We should eventually colorize entities by sending them as a special token.
-                    checkBuffer(11);
+                    // 12 bytes required: up to 10 bytes in m_cBuffer plus the
+                    // leading '&' and trailing ';'
+                    checkBuffer(12);
                     *dest++ = '&';
                     for (unsigned i = 0; i < cBufferPos; i++)
                         dest[i] = m_cBuffer[i];
@@ -887,7 +889,9 @@
                     }
                 }
             } else {
-                checkBuffer(10);
+                // 11 bytes required: up to 10 bytes in m_cBuffer plus the
+                // leading '&'
+                checkBuffer(11);
                 // ignore the sequence, add it to the buffer as plaintext
                 *dest++ = '&';
                 for (unsigned i = 0; i < cBufferPos; i++)
diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp
index 09b679d..4cf7a1c 100644
--- a/WebCore/platform/android/RenderThemeAndroid.cpp
+++ b/WebCore/platform/android/RenderThemeAndroid.cpp
@@ -205,7 +205,7 @@
     // If it is a disabled button, simply paint it to the master picture.
     Node* node = obj->node();
     if (!node || !node->isElementNode()
-        || !static_cast<Element*>(node)->isEnabledFormControl()) {
+            || !static_cast<Element*>(node)->isEnabledFormControl()) {
         RenderSkinButton::Draw(getCanvasFromInfo(info), rect,
                 RenderSkinAndroid::kDisabled);
     } else {
diff --git a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.cpp b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.cpp
deleted file mode 100644
index 75bb578..0000000
--- a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2009, The Android Open Source Project
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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"
-
-#if ENABLE(VIDEO)
-
-#include "MediaPlayerPrivateAndroid.h"
-
-namespace WebCore {
-
-void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
-{
-    registrar(create, getSupportedTypes, supportsType);
-}
-
-void MediaPlayerPrivate::load(const String& url)
-{
-}
-
-void MediaPlayerPrivate::cancelLoad()
-{
-}
-
-void MediaPlayerPrivate::play()
-{
-}
-
-void MediaPlayerPrivate::pause()
-{
-}
-
-IntSize MediaPlayerPrivate::naturalSize() const
-{
-    return IntSize();
-}
-
-bool MediaPlayerPrivate::hasVideo() const
-{
-    return false;
-}
-
-void MediaPlayerPrivate::setVisible(bool)
-{
-}
-
-float MediaPlayerPrivate::duration() const
-{
-    return 0;
-}
-
-float MediaPlayerPrivate::currentTime() const
-{
-    return 0;
-}
-
-void MediaPlayerPrivate::seek(float time)
-{
-}
-
-bool MediaPlayerPrivate::seeking() const
-{
-    return false;
-}
-
-void MediaPlayerPrivate::setEndTime(float time)
-{
-}
-
-void MediaPlayerPrivate::setRate(float)
-{
-}
-
-bool MediaPlayerPrivate::paused() const
-{
-    return false;
-}
-
-void MediaPlayerPrivate::setVolume(float)
-{
-}
-
-MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const
-{
-    return MediaPlayer::Empty;
-}
-
-MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const
-{
-    return MediaPlayer::HaveNothing;
-}
-
-float MediaPlayerPrivate::maxTimeSeekable() const
-{
-    return 0;
-}
-
-float MediaPlayerPrivate::maxTimeBuffered() const
-{
-    return 0;
-}
-
-int MediaPlayerPrivate::dataRate() const
-{
-    return 0;
-}
-
-unsigned MediaPlayerPrivate::totalBytes() const
-{
-    return 0;
-}
-
-unsigned MediaPlayerPrivate::bytesLoaded() const
-{
-    return 0;
-}
-
-void MediaPlayerPrivate::setSize(const IntSize&)
-{
-}
-
-void MediaPlayerPrivate::paint(GraphicsContext*, const IntRect&)
-{
-}
-
-MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player)
-{
-    return new MediaPlayerPrivate();
-}
-
-void MediaPlayerPrivate::getSupportedTypes(HashSet<String>&)
-{
-}
-
-MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs)
-{
-    return MediaPlayer::IsNotSupported;
-}
-
-}
-
-#endif // VIDEO
diff --git a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
index 9324699..7dcb60d 100644
--- a/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
+++ b/WebCore/platform/graphics/android/MediaPlayerPrivateAndroid.h
@@ -34,6 +34,8 @@
 
 class MediaPlayerPrivate : public MediaPlayerPrivateInterface {
 public:
+    ~MediaPlayerPrivate();
+
     static void registerMediaEngine(MediaEngineRegistrar);
 
     virtual void load(const String& url);
@@ -77,9 +79,18 @@
 
     virtual void paint(GraphicsContext*, const IntRect&);
 private:
+    // Android-specific methods and fields.
     static MediaPlayerPrivateInterface* create(MediaPlayer* player);
     static void getSupportedTypes(HashSet<String>&);
     static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs);
+
+    MediaPlayerPrivate(MediaPlayer *);
+    void createJavaPlayerIfNeeded();
+
+    MediaPlayer* m_player;
+    String m_url;
+    struct JavaGlue;
+    JavaGlue* m_glue;
 };
 
 }  // namespace WebCore
diff --git a/WebKit/Android.mk b/WebKit/Android.mk
index 87bc2cd..95eb0e1 100644
--- a/WebKit/Android.mk
+++ b/WebKit/Android.mk
@@ -21,6 +21,7 @@
 	android/WebCoreSupport/DragClientAndroid.cpp \
 	android/WebCoreSupport/EditorClientAndroid.cpp \
 	android/WebCoreSupport/FrameLoaderClientAndroid.cpp \
+	android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp \
 	\
 	android/RenderSkinAndroid.cpp \
 	android/RenderSkinButton.cpp \
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
new file mode 100644
index 0000000..b815dd8
--- /dev/null
+++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -0,0 +1,265 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 APPLE COMPUTER, INC. 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"
+
+#if ENABLE(VIDEO)
+
+#include "MediaPlayerPrivateAndroid.h"
+#include "WebCoreJni.h"
+#include "WebViewCore.h"
+#include "jni_utility.h"
+
+#include <JNIHelp.h>
+
+using namespace android;
+
+namespace WebCore {
+
+static const char* g_ProxyJavaClass = "android/webkit/HTML5VideoViewProxy";
+
+struct MediaPlayerPrivate::JavaGlue
+{
+    jobject   m_javaProxy;
+    jmethodID m_getInstance;
+    jmethodID m_play;
+};
+
+MediaPlayerPrivate::~MediaPlayerPrivate()
+{
+    if (m_glue->m_javaProxy) {
+        JNIEnv* env = JSC::Bindings::getJNIEnv();
+        if (env)
+            env->DeleteGlobalRef(m_glue->m_javaProxy);
+    }
+
+    delete m_glue;
+}
+
+void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar)
+{
+    registrar(create, getSupportedTypes, supportsType);
+}
+
+void MediaPlayerPrivate::load(const String& url)
+{
+    // To be able to create our java player, we need a Context object. To get
+    // the Context object, we need a WebViewCore java object. To get a java
+    // WebViewCore object, we need a WebCore::FrameView pointer. To get
+    // the FrameView pointer, the MediaPlayer::setFrameView() must have been
+    // called. However, that method is called only after the MediaPlayerClient
+    // is called back and informed that enough data has been loaded.
+    // We therefore need to fake a readyStateChanged callback before creating
+    // the java player.
+    m_player->readyStateChanged();
+    // We now have a RenderVideo created and the MediaPlayer must have
+    // been updated with a FrameView. Create our JavaPlayer.
+    createJavaPlayerIfNeeded();
+    // Save the URl.
+    m_url = url;
+}
+
+void MediaPlayerPrivate::cancelLoad()
+{
+}
+
+void MediaPlayerPrivate::play()
+{
+    JNIEnv* env = JSC::Bindings::getJNIEnv();
+    if (!env || !m_glue->m_javaProxy || !m_url.length())
+        return;
+
+    FrameView* frameView = m_player->frameView();
+    if (!frameView)
+        return;
+
+    WebViewCore* webViewCore =  WebViewCore::getWebViewCore(frameView);
+    ASSERT(webViewCore);
+    jstring jUrl = env->NewString((unsigned short *)m_url.characters(), m_url.length());
+    env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl, webViewCore->getJavaObject().get());
+    env->DeleteLocalRef(jUrl);
+    checkException(env);
+}
+
+void MediaPlayerPrivate::pause()
+{
+}
+
+IntSize MediaPlayerPrivate::naturalSize() const
+{
+    return IntSize(20, 20);
+}
+
+bool MediaPlayerPrivate::hasVideo() const
+{
+    return false;
+}
+
+void MediaPlayerPrivate::setVisible(bool)
+{
+}
+
+float MediaPlayerPrivate::duration() const
+{
+    return 100;
+}
+
+float MediaPlayerPrivate::currentTime() const
+{
+    return 0;
+}
+
+void MediaPlayerPrivate::seek(float time)
+{
+}
+
+bool MediaPlayerPrivate::seeking() const
+{
+    return false;
+}
+
+void MediaPlayerPrivate::setEndTime(float time)
+{
+}
+
+void MediaPlayerPrivate::setRate(float)
+{
+}
+
+bool MediaPlayerPrivate::paused() const
+{
+    return true;
+}
+
+void MediaPlayerPrivate::setVolume(float)
+{
+}
+
+MediaPlayer::NetworkState MediaPlayerPrivate::networkState() const
+{
+    return MediaPlayer::Loaded;
+}
+
+MediaPlayer::ReadyState MediaPlayerPrivate::readyState() const
+{
+    return MediaPlayer::HaveEnoughData;
+}
+
+float MediaPlayerPrivate::maxTimeSeekable() const
+{
+    return 0;
+}
+
+float MediaPlayerPrivate::maxTimeBuffered() const
+{
+    return 0;
+}
+
+int MediaPlayerPrivate::dataRate() const
+{
+    return 0;
+}
+
+unsigned MediaPlayerPrivate::totalBytes() const
+{
+    return 0;
+}
+
+unsigned MediaPlayerPrivate::bytesLoaded() const
+{
+    return 0;
+}
+
+void MediaPlayerPrivate::setSize(const IntSize&)
+{
+}
+
+void MediaPlayerPrivate::paint(GraphicsContext*, const IntRect&)
+{
+}
+
+MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player)
+{
+    return new MediaPlayerPrivate(player);
+}
+
+void MediaPlayerPrivate::getSupportedTypes(HashSet<String>&)
+{
+}
+
+MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs)
+{
+    return MediaPlayer::IsNotSupported;
+}
+
+MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) : m_player(player), m_glue(NULL)
+{
+    JNIEnv* env = JSC::Bindings::getJNIEnv();
+    if (!env)
+        return;
+
+    jclass clazz = env->FindClass(g_ProxyJavaClass);
+    if (!clazz)
+        return;
+
+    m_glue = new JavaGlue;
+    m_glue->m_getInstance = env->GetStaticMethodID(clazz, "getInstance", "(Landroid/webkit/WebViewCore;)Landroid/webkit/HTML5VideoViewProxy;");
+    m_glue->m_play = env->GetMethodID(clazz, "play", "(Ljava/lang/String;Landroid/webkit/WebViewCore;)V");
+    m_glue->m_javaProxy = NULL;
+    env->DeleteLocalRef(clazz);
+    // An exception is raised if any of the above fails.
+    checkException(env);
+}
+
+void MediaPlayerPrivate::createJavaPlayerIfNeeded()
+{
+    // Check if we have been already created.
+    if (m_glue->m_javaProxy)
+        return;
+
+    FrameView* frameView = m_player->frameView();
+    if (!frameView)
+        return;
+
+    JNIEnv* env = JSC::Bindings::getJNIEnv();
+    if (!env)
+        return;
+
+    jclass clazz = env->FindClass(g_ProxyJavaClass);
+    if (!clazz)
+        return;
+
+    WebViewCore* webViewCore =  WebViewCore::getWebViewCore(frameView);
+    ASSERT(webViewCore);
+    jobject obj = env->CallStaticObjectMethod(clazz, m_glue->m_getInstance, webViewCore->getJavaObject().get());
+    m_glue->m_javaProxy = env->NewGlobalRef(obj); 
+    env->DeleteLocalRef(obj);
+    env->DeleteLocalRef(clazz);
+    checkException(env);
+}
+
+}
+
+#endif // VIDEO
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 2e545bf..f491ccb 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1108,7 +1108,7 @@
 
 void WebViewCore::invalPlugin(PluginWidgetAndroid* w)
 {
-    const double PLUGIN_INVAL_DELAY = 0;    // should this be non-zero?
+    const double PLUGIN_INVAL_DELAY = 1.0 / 60;
 
     if (!m_pluginInvalTimer.isActive()) {
         m_pluginInvalTimer.startOneShot(PLUGIN_INVAL_DELAY);
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index a6e0d37..ec33948 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -188,6 +188,7 @@
     if (!root)
         return;
     DBG_NAV_LOG("");
+    m_viewImpl->m_hasCursorBounds = false;
     root->clearCursor();
     viewInvalidate();
 }
@@ -199,6 +200,7 @@
     if (!root)
         return;
     DBG_NAV_LOG("");
+    m_viewImpl->m_hasCursorBounds = false;
     root->hideCursor();
     viewInvalidate();
 }
@@ -448,16 +450,17 @@
     }
     m_viewImpl->gButtonMutex.unlock();
     WebCore::IntRect bounds = node->bounds();
-    m_viewImpl->gCursorBoundsMutex.lock();
-    m_viewImpl->m_hasCursorBounds = true;
-    if (m_viewImpl->m_cursorBounds != bounds)
-        DBG_NAV_LOGD("new cursor bounds=(%d,%d,w=%d,h=%d)",
-            bounds.x(), bounds.y(), bounds.width(), bounds.height());
-    m_viewImpl->m_cursorBounds = bounds;
-    m_viewImpl->m_cursorFrame = frame->framePointer();
-    root->getSimulatedMousePosition(&m_viewImpl->m_cursorLocation);
-    m_viewImpl->m_cursorNode = node->nodePointer();
-    m_viewImpl->gCursorBoundsMutex.unlock();
+    updateCursorBounds(root, frame, node);
+
+    WTF::Vector<WebCore::IntRect> oneRing;
+    bool useHitBounds = node->useHitBounds();
+    if (useHitBounds) {
+        bounds = node->hitBounds();
+    }
+    if (useHitBounds || node->useBounds()) {
+        oneRing.append(bounds);
+        rings = &oneRing;
+    }
     bounds.inflate(SkScalarCeil(CURSOR_RING_OUTER_DIAMETER));
     if (canvas->quickReject(bounds, SkCanvas::kAA_EdgeType)) {
         DBG_NAV_LOGD("canvas->quickReject cursorNode=%d (nodePointer=%p)"
@@ -467,7 +470,6 @@
         return;
     }
     CursorRing::Flavor flavor = CursorRing::NORMAL_FLAVOR;
-    WTF::Vector<WebCore::IntRect> oneRing;
     if (!isButton) {
         flavor = node->type() != NORMAL_CACHEDNODETYPE ?
             CursorRing::FAKE_FLAVOR : CursorRing::NORMAL_FLAVOR;
@@ -479,11 +481,6 @@
             flavor = static_cast<CursorRing::Flavor>
                     (flavor + CursorRing::NORMAL_ANIMATING);
         }
-        bool useHitBounds = node->useHitBounds();
-        if (useHitBounds || node->useBounds()) {
-            oneRing.append(useHitBounds ? node->hitBounds() : node->bounds());
-            rings = &oneRing;
-        }
 #if DEBUG_NAV_UI
         const WebCore::IntRect& ring = (*rings)[0];
         DBG_NAV_LOGD("cursorNode=%d (nodePointer=%p) flavor=%s rings=%d"
@@ -693,6 +690,33 @@
     return false;
 }
 
+// This needs to be called each time we call CachedRoot::setCursor() with
+// non-null CachedNode/CachedFrame, since otherwise the WebViewCore's data
+// about the cursor is incorrect.  When we call setCursor(0,0), we need
+// to set m_viewImpl->hasCursorBounds to false.
+void updateCursorBounds(const CachedRoot* root, const CachedFrame* cachedFrame,
+        const CachedNode* cachedNode)
+{
+    LOG_ASSERT(root, "updateCursorBounds: root cannot be null");
+    LOG_ASSERT(cachedNode, "updateCursorBounds: cachedNode cannot be null");
+    LOG_ASSERT(cachedFrame, "updateCursorBounds: cachedFrame cannot be null");
+    m_viewImpl->gCursorBoundsMutex.lock();
+    m_viewImpl->m_hasCursorBounds = cachedNode->hasCursorRing();
+    // If m_viewImpl->m_hasCursorBounds is false, we never look at the other
+    // values, so do not bother setting them.
+    if (m_viewImpl->m_hasCursorBounds) {
+        WebCore::IntRect bounds = cachedNode->bounds();
+        if (m_viewImpl->m_cursorBounds != bounds)
+            DBG_NAV_LOGD("new cursor bounds=(%d,%d,w=%d,h=%d)",
+                bounds.x(), bounds.y(), bounds.width(), bounds.height());
+        m_viewImpl->m_cursorBounds = cachedNode->bounds();
+        m_viewImpl->m_cursorFrame = cachedFrame->framePointer();
+        root->getSimulatedMousePosition(&m_viewImpl->m_cursorLocation);
+        m_viewImpl->m_cursorNode = cachedNode->nodePointer();
+    }
+    m_viewImpl->gCursorBoundsMutex.unlock();
+}
+
 /* returns true if the key had no effect (neither scrolled nor changed cursor) */
 bool moveCursor(int keyCode, int count, bool ignoreScroll)
 {
@@ -730,15 +754,6 @@
         dx += scroll.x();
         dy += scroll.y();
     }
-    if (cachedNode) {
-        m_viewImpl->gCursorBoundsMutex.lock();
-        m_viewImpl->m_hasCursorBounds = cachedNode->hasCursorRing();
-        m_viewImpl->m_cursorBounds = cachedNode->bounds();
-        m_viewImpl->m_cursorFrame = cachedFrame->framePointer();
-        root->getSimulatedMousePosition(&m_viewImpl->m_cursorLocation);
-        m_viewImpl->m_cursorNode = cachedNode->nodePointer();
-        m_viewImpl->gCursorBoundsMutex.unlock();
-    }
     DBG_NAV_LOGD("new cursor %d (nativeNode=%p) cursorLocation={%d, %d}"
         "bounds={%d,%d,w=%d,h=%d}", cachedNode ? cachedNode->index() : 0,
         cachedNode ? cachedNode->nodePointer() : 0,
@@ -764,6 +779,7 @@
     }
     bool result = false;
     if (cachedNode) {
+        updateCursorBounds(root, cachedFrame, cachedNode);
         root->setCursor(const_cast<CachedFrame*>(cachedFrame),
                 const_cast<CachedNode*>(cachedNode));
         bool disableFocusController = cachedNode != root->currentFocus()
@@ -826,10 +842,12 @@
     if (!node) {
         DBG_NAV_LOGD("no nodes found root=%p", root);
         disableFocusController = true;
+        m_viewImpl->m_hasCursorBounds = false;
         if (root)
             root->setCursor(0, 0);
     } else {
         DBG_NAV_LOGD("CachedNode:%p (%d)", node, node->index());
+        updateCursorBounds(root, frame, node);
         root->setCursor(const_cast<CachedFrame*>(frame),
                 const_cast<CachedNode*>(node));
         if (!node->wantsKeyEvents()) {
@@ -869,13 +887,12 @@
     if (!result) {
         DBG_NAV_LOGD("no nodes found root=%p", root);
         setNavBounds(rect);
-        if (root) {
-            root->hideCursor();
-            int dx = root->checkForCenter(x, y);
-            if (dx) {
-                scrollBy(dx, 0);
-                pageScrolled = true;
-            }
+        m_viewImpl->m_hasCursorBounds = false;
+        root->hideCursor();
+        int dx = root->checkForCenter(x, y);
+        if (dx) {
+            scrollBy(dx, 0);
+            pageScrolled = true;
         }
         sendMotionUp(frame ? (WebCore::Frame*) frame->framePointer() : 0,
             0, x, y, slop);
@@ -886,6 +903,7 @@
     DBG_NAV_LOGD("CachedNode:%p (%d) x=%d y=%d rx=%d ry=%d", result,
         result->index(), x, y, rx, ry);
     setNavBounds(WebCore::IntRect(rx, ry, 1, 1));
+    updateCursorBounds(root, frame, result);
     root->setCursor(const_cast<CachedFrame*>(frame),
         const_cast<CachedNode*>(result));
     CachedNodeType type = result->type();