diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-13 16:19:52 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-13 16:19:52 +0000 |
commit | e52d98fc38c62558baa8507c0752ada8b520055d (patch) | |
tree | b1ef792348039d06cadd2b0ad58664aec8ad0b17 /webkit | |
parent | 713d4e9d556633ec06c2e5da790e77e919ad1adc (diff) | |
download | chromium_src-e52d98fc38c62558baa8507c0752ada8b520055d.zip chromium_src-e52d98fc38c62558baa8507c0752ada8b520055d.tar.gz chromium_src-e52d98fc38c62558baa8507c0752ada8b520055d.tar.bz2 |
Move HTMLDocument functions from v8_custom to V8HTMLDocumentCustom.
Remove NAMED_PROPERTY_SETTER interceptor for HTMLDocument.
Review URL: http://codereview.chromium.org/42157
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.cpp | 76 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.h | 6 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 2 |
3 files changed, 4 insertions, 80 deletions
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index 9de743f..4b2e545 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -897,82 +897,6 @@ v8::Handle<v8::Value> V8Custom::WindowSetTimeoutImpl(const v8::Arguments& args, } -// HTMLDocument ---------------------------------------------------------------- - -// Concatenates "args" to a string. If args is empty, returns empty string. -// Firefox/Safari/IE support non-standard arguments to document.write, ex: -// document.write("a", "b", "c") --> document.write("abc") -// document.write() --> document.write("") -static String WriteHelper_GetString(const v8::Arguments& args) { - String str = ""; - for (int i = 0; i < args.Length(); ++i) { - str += ToWebCoreString(args[i]); - } - return str; -} - -CALLBACK_FUNC_DECL(HTMLDocumentWrite) { - INC_STATS("DOM.HTMLDocument.write()"); - HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder()); - Frame* frame = V8Proxy::retrieveActiveFrame(); - ASSERT(frame); - imp->write(WriteHelper_GetString(args), frame->document()); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(HTMLDocumentWriteln) { - INC_STATS("DOM.HTMLDocument.writeln()"); - HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder()); - Frame* frame = V8Proxy::retrieveActiveFrame(); - ASSERT(frame); - imp->writeln(WriteHelper_GetString(args), frame->document()); - return v8::Undefined(); -} - -CALLBACK_FUNC_DECL(HTMLDocumentOpen) { - INC_STATS("DOM.HTMLDocument.open()"); - HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(args.Holder()); - - if (args.Length() > 2) { - if (Frame* frame = imp->frame()) { - // Fetch the global object for the frame. - v8::Local<v8::Context> context = V8Proxy::GetContext(frame); - // Bail out if we cannot get the context. - if (context.IsEmpty()) return v8::Undefined(); - v8::Local<v8::Object> global = context->Global(); - // Get the open property of the global object. - v8::Local<v8::Value> function = global->Get(v8::String::New("open")); - // If the open property is not a function throw a type error. - if (!function->IsFunction()) { - V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, "open is not a function"); - return v8::Undefined(); - } - // Wrap up the arguments and call the function. - v8::Local<v8::Value>* params = new v8::Local<v8::Value>[args.Length()]; - for (int i = 0; i < args.Length(); i++) { - params[i] = args[i]; - } - - V8Proxy* proxy = V8Proxy::retrieve(frame); - ASSERT(proxy); - - v8::Local<v8::Value> result = - proxy->CallFunction(v8::Local<v8::Function>::Cast(function), - global, args.Length(), params); - delete[] params; - return result; - } - } - - Frame* frame = V8Proxy::retrieveActiveFrame(); - imp->open(frame->document()); - // Return the document. - return args.Holder(); -} - - - - // DOMWindow ------------------------------------------------------------------- static bool IsAscii(const String& str) { diff --git a/webkit/port/bindings/v8/v8_custom.h b/webkit/port/bindings/v8/v8_custom.h index d3aafb1..c72bd33 100644 --- a/webkit/port/bindings/v8/v8_custom.h +++ b/webkit/port/bindings/v8/v8_custom.h @@ -271,6 +271,9 @@ 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) // Document customized functions DECLARE_CALLBACK(DocumentEvaluate) @@ -423,9 +426,6 @@ DECLARE_INDEXED_ACCESS_CHECK(DOMWindow) DECLARE_NAMED_PROPERTY_GETTER(HTMLFrameSetElement) DECLARE_NAMED_PROPERTY_GETTER(HTMLFormElement) -DECLARE_NAMED_PROPERTY_GETTER(HTMLDocument) -DECLARE_NAMED_PROPERTY_SETTER(HTMLDocument) -DECLARE_NAMED_PROPERTY_DELETER(HTMLDocument) DECLARE_NAMED_PROPERTY_GETTER(NodeList) DECLARE_NAMED_PROPERTY_GETTER(NamedNodeMap) DECLARE_NAMED_PROPERTY_GETTER(CSSStyleDeclaration) diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index 21cec01..3ad7143 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -1619,7 +1619,7 @@ v8::Persistent<v8::FunctionTemplate> V8Proxy::GetTemplate( case V8ClassIndex::HTMLDOCUMENT: { desc->InstanceTemplate()->SetNamedPropertyHandler( USE_NAMED_PROPERTY_GETTER(HTMLDocument), - USE_NAMED_PROPERTY_SETTER(HTMLDocument), + 0, 0, USE_NAMED_PROPERTY_DELETER(HTMLDocument)); |