diff options
Diffstat (limited to 'WebCore/bindings/v8/custom/V8CustomBinding.h')
-rw-r--r-- | WebCore/bindings/v8/custom/V8CustomBinding.h | 314 |
1 files changed, 3 insertions, 311 deletions
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h index e7670b7..25f4507 100644 --- a/WebCore/bindings/v8/custom/V8CustomBinding.h +++ b/WebCore/bindings/v8/custom/V8CustomBinding.h @@ -34,308 +34,16 @@ #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) - -#define ACCESSOR_RUNTIME_ENABLER(NAME) bool V8Custom::v8##NAME##Enabled() - namespace WebCore { - - 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 kNodeEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kNodeMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; - - static const int kDocumentImplementationIndex = kNodeMinimumInternalFieldCount + 0; - static const int kDocumentMinimumInternalFieldCount = kNodeMinimumInternalFieldCount + 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 kMessagePortInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; - -#if ENABLE(WORKERS) - static const int kAbstractWorkerRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kAbstractWorkerInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; - - static const int kWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0; - static const int kWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1; - - static const int kWorkerContextRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kWorkerContextMinimumInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; - - static const int kDedicatedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0; - static const int kDedicatedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1; -#endif - -#if ENABLE(SHARED_WORKERS) - static const int kSharedWorkerRequestCacheIndex = kAbstractWorkerInternalFieldCount + 0; - static const int kSharedWorkerInternalFieldCount = kAbstractWorkerInternalFieldCount + 1; - - static const int kSharedWorkerContextRequestCacheIndex = kWorkerContextMinimumInternalFieldCount + 0; - static const int kSharedWorkerContextInternalFieldCount = kWorkerContextMinimumInternalFieldCount + 1; -#endif - -#if ENABLE(NOTIFICATIONS) - static const int kNotificationRequestCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kNotificationInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; -#endif - -#if ENABLE(SVG) - static const int kSVGElementInstanceEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kSVGElementInstanceInternalFieldCount = 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 kDOMWindowEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 13; - static const int kDOMWindowEnteredIsolatedWorldIndex = kDefaultWrapperInternalFieldCount + 14; - static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 15; - - static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; - static const int kNamedNodeMapOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kNamedNodeMapInternalFieldCount = kDefaultWrapperInternalFieldCount + 1; - -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - static const int kDOMApplicationCacheCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kDOMApplicationCacheFieldCount = kDefaultWrapperInternalFieldCount + 1; -#endif - -#if ENABLE(WEB_SOCKETS) - static const int kWebSocketCacheIndex = kDefaultWrapperInternalFieldCount + 0; - static const int kWebSocketInternalFieldCount = 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) - -#define DECLARE_ACCESSOR_RUNTIME_ENABLER(NAME) static bool v8##NAME##Enabled() - - DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle); - DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle); - DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent); - DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto); - DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation); - DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener); - -#if ENABLE(VIDEO) - DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowAudio); - DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowAudio); - DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLMediaElement); - DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLAudioElement); - DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowHTMLVideoElement); - DECLARE_ACCESSOR_RUNTIME_ENABLER(DOMWindowMediaError); -#endif - - DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowImage); - DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowOption); - - 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_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(HTMLAllCollectionItem); - DECLARE_CALLBACK(HTMLAllCollectionNamedItem); - DECLARE_CALLBACK(HTMLAllCollectionCallAsFunction); - - 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); +<<<<<<< HEAD DECLARE_CALLBACK(MessageChannelConstructor); DECLARE_CALLBACK(WebKitCSSMatrixConstructor); DECLARE_CALLBACK(WebKitPointConstructor); @@ -714,27 +422,11 @@ namespace WebCore { #undef DECLARE_INDEXED_PROPERTY_GETTER #undef DECLARE_INDEXED_PROPERTY_SETTER #undef DECLARE_INDEXED_PROPERTY_DELETER +======= +>>>>>>> webkit.org at r54127 #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 |