| Index: webkit/port/bindings/v8/v8_custom.cpp
|
| ===================================================================
|
| --- webkit/port/bindings/v8/v8_custom.cpp (revision 10703)
|
| +++ webkit/port/bindings/v8/v8_custom.cpp (working copy)
|
| @@ -120,371 +120,12 @@
|
|
|
| namespace WebCore {
|
|
|
| -class V8ScheduledAction : public ScheduledAction {
|
| - public:
|
| - V8ScheduledAction(v8::Handle<v8::Function> func, int argc,
|
| - v8::Handle<v8::Value> argv[]);
|
| - explicit V8ScheduledAction(const WebCore::String& code) : m_argc(0),
|
| - m_argv(0), m_code(code) { }
|
| - virtual ~V8ScheduledAction();
|
| - virtual void execute(ScriptExecutionContext* window);
|
| -
|
| - private:
|
| - v8::Persistent<v8::Function> m_func;
|
| - int m_argc;
|
| - v8::Persistent<v8::Value>* m_argv;
|
| -
|
| - ScriptSourceCode m_code;
|
| -};
|
| -
|
| -V8ScheduledAction::V8ScheduledAction(v8::Handle<v8::Function> func, int argc,
|
| - v8::Handle<v8::Value> argv[])
|
| - : m_code(String(), KURL(), 0) {
|
| - m_func = v8::Persistent<v8::Function>::New(func);
|
| -
|
| -#ifndef NDEBUG
|
| - V8Proxy::RegisterGlobalHandle(SCHEDULED_ACTION, this, m_func);
|
| -#endif
|
| -
|
| - m_argc = argc;
|
| - if (argc > 0) {
|
| - m_argv = new v8::Persistent<v8::Value>[argc];
|
| - for (int i = 0; i < argc; i++) {
|
| - m_argv[i] = v8::Persistent<v8::Value>::New(argv[i]);
|
| -
|
| -#ifndef NDEBUG
|
| - V8Proxy::RegisterGlobalHandle(SCHEDULED_ACTION, this, m_argv[i]);
|
| -#endif
|
| - }
|
| - } else {
|
| - m_argv = NULL;
|
| - }
|
| -}
|
| -
|
| -
|
| -V8ScheduledAction::~V8ScheduledAction() {
|
| - if (!m_func.IsEmpty()) {
|
| -#ifndef NDEBUG
|
| - V8Proxy::UnregisterGlobalHandle(this, m_func);
|
| -#endif
|
| - m_func.Dispose();
|
| -
|
| - for (int i = 0; i < m_argc; i++) {
|
| -#ifndef NDEBUG
|
| - V8Proxy::UnregisterGlobalHandle(this, m_argv[i]);
|
| -#endif
|
| - m_argv[i].Dispose();
|
| - }
|
| - if (m_argc > 0) {
|
| - delete[] m_argv;
|
| - }
|
| - }
|
| -}
|
| -
|
| -
|
| -void V8ScheduledAction::execute(ScriptExecutionContext* script_context) {
|
| - // TODO(ager): Timeouts for running the javascript code are not set.
|
| - V8Proxy* proxy = V8Proxy::retrieve(script_context);
|
| - if (!proxy) return;
|
| -
|
| - v8::HandleScope handle_scope;
|
| - v8::Local<v8::Context> context = proxy->GetContext();
|
| - if (context.IsEmpty()) return; // JS may not be enabled.
|
| -
|
| - v8::Context::Scope scope(context);
|
| -
|
| - proxy->setTimerCallback(true);
|
| -
|
| - if (!m_func.IsEmpty() && m_func->IsFunction()) {
|
| - proxy->CallFunction(v8::Persistent<v8::Function>::Cast(m_func),
|
| - context->Global(), m_argc, m_argv);
|
| - } else {
|
| - proxy->Evaluate(m_code.url(), m_code.startLine() - 1, m_code.source(), 0);
|
| - }
|
| -
|
| - if (script_context->isDocument()) {
|
| - Document* doc = static_cast<Document*>(script_context);
|
| - doc->updateRendering();
|
| - }
|
| -
|
| - proxy->setTimerCallback(false);
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(DOMParserConstructor) {
|
| - INC_STATS("DOM.DOMParser.Contructor");
|
| - return V8Proxy::ConstructDOMObject<V8ClassIndex::DOMPARSER,
|
| - DOMParser>(args);
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(MessageChannelConstructor) {
|
| - INC_STATS("DOM.MessageChannel.Constructor");
|
| - if (!args.IsConstructCall()) {
|
| - V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
|
| - "DOM object constructor cannot be called as a function.");
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - // Get the document.
|
| - Frame* frame = V8Proxy::retrieveFrame();
|
| - if (!frame)
|
| - return v8::Undefined();
|
| - Document* document = frame->document();
|
| -
|
| - // Note: it's OK to let this RefPtr go out of scope because we also call
|
| - // SetDOMWrapper(), which effectively holds a reference to obj.
|
| - RefPtr<MessageChannel> obj = MessageChannel::create(document);
|
| -
|
| - // Create wrappers for the two associated MessagePorts.
|
| - v8::Handle<v8::Value> port1_wrapper =
|
| - V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1());
|
| - v8::Handle<v8::Value> port2_wrapper =
|
| - V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2());
|
| -
|
| - v8::Handle<v8::Object> wrapper_object = args.Holder();
|
| -
|
| - // Setup the standard wrapper object internal fields.
|
| - V8Proxy::SetDOMWrapper(
|
| - wrapper_object, V8ClassIndex::MESSAGECHANNEL, obj.get());
|
| -
|
| - obj->ref();
|
| - V8Proxy::SetJSWrapperForDOMObject(
|
| - obj.get(), v8::Persistent<v8::Object>::New(wrapper_object));
|
| -
|
| - // Create references from the MessageChannel wrapper to the two
|
| - // MessagePort wrappers to make sure that the MessagePort wrappers
|
| - // stay alive as long as the MessageChannel wrapper is around.
|
| - wrapper_object->SetInternalField(kMessageChannelPort1Index, port1_wrapper);
|
| - wrapper_object->SetInternalField(kMessageChannelPort2Index, port2_wrapper);
|
| -
|
| - // Return the wrapper object which will be the result of the call to
|
| - // new.
|
| - return wrapper_object;
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(WebKitCSSMatrixConstructor) {
|
| - INC_STATS("DOM.WebKitCSSMatrix.Constructor");
|
| - String s;
|
| - if (args.Length() >= 1)
|
| - s = ToWebCoreString(args[0]);
|
| -
|
| - // Create the matrix.
|
| - ExceptionCode ec = 0;
|
| - RefPtr<WebKitCSSMatrix> matrix = WebKitCSSMatrix::create(s, ec);
|
| - if (ec != 0) {
|
| - V8Proxy::SetDOMException(ec);
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - // Transform the holder into a wrapper object for the matrix.
|
| - V8Proxy::SetDOMWrapper(args.Holder(),
|
| - V8ClassIndex::ToInt(V8ClassIndex::WEBKITCSSMATRIX),
|
| - matrix.get());
|
| - // Add the wrapper to the DOM object map.
|
| - matrix->ref();
|
| - V8Proxy::SetJSWrapperForDOMObject(
|
| - matrix.get(),
|
| - v8::Persistent<v8::Object>::New(args.Holder()));
|
| - return args.Holder();
|
| -}
|
| -
|
| CALLBACK_FUNC_DECL(WebKitPointConstructor) {
|
| INC_STATS("DOM.WebKitPoint.Constructor");
|
| return V8Proxy::ConstructDOMObject<V8ClassIndex::WEBKITPOINT,
|
| WebKitPoint>(args);
|
| }
|
|
|
| -CALLBACK_FUNC_DECL(XMLSerializerConstructor) {
|
| - INC_STATS("DOM.XMLSerializer.Constructor");
|
| - return V8Proxy::ConstructDOMObject<V8ClassIndex::XMLSERIALIZER,
|
| - XMLSerializer>(args);
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XPathEvaluatorConstructor) {
|
| - INC_STATS("DOM.XPathEvaluator.Constructor");
|
| - return V8Proxy::ConstructDOMObject<V8ClassIndex::XPATHEVALUATOR,
|
| - XPathEvaluator>(args);
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorConstructor) {
|
| - INC_STATS("DOM.XSLTProcessor.Constructor");
|
| - return V8Proxy::ConstructDOMObject<V8ClassIndex::XSLTPROCESSOR,
|
| - XSLTProcessor>(args);
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorImportStylesheet) {
|
| - INC_STATS("DOM.XSLTProcessor.importStylesheet");
|
| - // Return undefined if argument does not have the correct type.
|
| - if (!V8Node::HasInstance(args[0]))
|
| - return v8::Undefined();
|
| -
|
| - XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
|
| - V8ClassIndex::XSLTPROCESSOR, args.Holder());
|
| -
|
| - Node* node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
|
| - imp->importStylesheet(node);
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorTransformToFragment) {
|
| - INC_STATS("DOM.XSLTProcessor.transformToFragment");
|
| - // Return undefined if arguments do not have correct types.
|
| - if (!V8Node::HasInstance(args[0]) || !V8Document::HasInstance(args[1]))
|
| - return v8::Undefined();
|
| -
|
| - XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
|
| - V8ClassIndex::XSLTPROCESSOR, args.Holder());
|
| -
|
| - Node* source = V8Proxy::DOMWrapperToNode<Node>(args[0]);
|
| - Document* owner =
|
| - V8Proxy::DOMWrapperToNode<Document>(args[1]);
|
| - RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner);
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorTransformToDocument) {
|
| - INC_STATS("DOM.XSLTProcessor.transformToDocument");
|
| - // Return undefined if argument does not have the correct type.
|
| - if (!V8Node::HasInstance(args[0]))
|
| - return v8::Undefined();
|
| -
|
| - XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
|
| - V8ClassIndex::XSLTPROCESSOR, args.Holder());
|
| -
|
| - Node* source = V8Proxy::DOMWrapperToNode<Node>(args[0]);
|
| - if (!source)
|
| - return v8::Undefined();
|
| - RefPtr<Document> result = imp->transformToDocument(source);
|
| - // Return undefined if no result was found.
|
| - if (!result)
|
| - return v8::Undefined();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorSetParameter) {
|
| - INC_STATS("DOM.XSLTProcessor.setParameter");
|
| - // Bail out if localName or value is null or undefined.
|
| - if (args[1]->IsNull() || args[1]->IsUndefined() ||
|
| - args[2]->IsNull() || args[2]->IsUndefined()) {
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
|
| - V8ClassIndex::XSLTPROCESSOR, args.Holder());
|
| -
|
| - String namespaceURI = ToWebCoreString(args[0]);
|
| - String localName = ToWebCoreString(args[1]);
|
| - String value = ToWebCoreString(args[2]);
|
| - imp->setParameter(namespaceURI, localName, value);
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorGetParameter) {
|
| - INC_STATS("DOM.XSLTProcessor.getParameter");
|
| - // Bail out if localName is null or undefined.
|
| - if (args[1]->IsNull() || args[1]->IsUndefined()) {
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
|
| - V8ClassIndex::XSLTPROCESSOR, args.Holder());
|
| -
|
| - String namespaceURI = ToWebCoreString(args[0]);
|
| - String localName = ToWebCoreString(args[1]);
|
| - String result = imp->getParameter(namespaceURI, localName);
|
| - // Return undefined if the string is null.
|
| - if (result.isNull()) return v8::Undefined();
|
| - return v8String(result);
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(XSLTProcessorRemoveParameter) {
|
| - INC_STATS("DOM.XSLTProcessor.removeParameter");
|
| - // Bail out if localName is null or undefined.
|
| - if (args[1]->IsNull() || args[1]->IsUndefined())
|
| - return v8::Undefined();
|
| -
|
| - XSLTProcessor* imp = V8Proxy::ToNativeObject<XSLTProcessor>(
|
| - V8ClassIndex::XSLTPROCESSOR, args.Holder());
|
| -
|
| - String namespaceURI = ToWebCoreString(args[0]);
|
| - String localName = ToWebCoreString(args[1]);
|
| - imp->removeParameter(namespaceURI, localName);
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -// ---- Canvas support ----
|
| -static v8::Handle<v8::Value> CanvasStyleToV8Object(CanvasStyle* style) {
|
| - if (style->canvasGradient()) {
|
| - return V8Proxy::ToV8Object(V8ClassIndex::CANVASGRADIENT,
|
| - style->canvasGradient());
|
| - }
|
| - if (style->canvasPattern()) {
|
| - return V8Proxy::ToV8Object(V8ClassIndex::CANVASPATTERN,
|
| - style->canvasPattern());
|
| - }
|
| - return v8String(style->color());
|
| -}
|
| -
|
| -static PassRefPtr<CanvasStyle> V8ObjectToCanvasStyle(v8::Handle<v8::Value> value)
|
| -{
|
| - if (value->IsString())
|
| - return CanvasStyle::create(ToWebCoreString(value));
|
| -
|
| - if (V8CanvasGradient::HasInstance(value)) {
|
| - CanvasGradient* gradient =
|
| - V8Proxy::DOMWrapperToNative<CanvasGradient>(value);
|
| - return CanvasStyle::create(gradient);
|
| - }
|
| -
|
| - if (V8CanvasPattern::HasInstance(value)) {
|
| - CanvasPattern* pattern =
|
| - V8Proxy::DOMWrapperToNative<CanvasPattern>(value);
|
| - return CanvasStyle::create(pattern);
|
| - }
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -
|
| -ACCESSOR_GETTER(CanvasRenderingContext2DStrokeStyle) {
|
| - CanvasRenderingContext2D* impl =
|
| - V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
|
| - CanvasStyle* strokeStyle = impl->strokeStyle();
|
| - return CanvasStyleToV8Object(strokeStyle);
|
| -}
|
| -
|
| -
|
| -ACCESSOR_SETTER(CanvasRenderingContext2DStrokeStyle) {
|
| - CanvasRenderingContext2D* impl =
|
| - V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
|
| - impl->setStrokeStyle(V8ObjectToCanvasStyle(value));
|
| -}
|
| -
|
| -ACCESSOR_GETTER(CanvasRenderingContext2DFillStyle) {
|
| - CanvasRenderingContext2D* impl =
|
| - V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
|
| - CanvasStyle* fillStyle = impl->fillStyle();
|
| - return CanvasStyleToV8Object(fillStyle);
|
| -}
|
| -
|
| -
|
| -ACCESSOR_SETTER(CanvasRenderingContext2DFillStyle) {
|
| - CanvasRenderingContext2D* impl =
|
| - V8Proxy::DOMWrapperToNative<CanvasRenderingContext2D>(info.Holder());
|
| - impl->setFillStyle(V8ObjectToCanvasStyle(value));
|
| -}
|
| -
|
| -
|
| // 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
|
| @@ -534,215 +175,6 @@
|
| }
|
|
|
|
|
| -ACCESSOR_GETTER(EventSrcElement) {
|
| - Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
|
| - EventTarget* target = event->target();
|
| - return V8Proxy::EventTargetToV8Object(target);
|
| -}
|
| -
|
| -
|
| -ACCESSOR_GETTER(EventReturnValue) {
|
| - Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
|
| - return event->defaultPrevented() ? v8::False() : v8::True();
|
| -}
|
| -
|
| -
|
| -ACCESSOR_SETTER(EventReturnValue) {
|
| - Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
|
| - bool v = value->BooleanValue();
|
| - event->setDefaultPrevented(!v);
|
| -}
|
| -
|
| -
|
| -ACCESSOR_GETTER(EventDataTransfer) {
|
| - Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
|
| -
|
| - if (event->isDragEvent()) {
|
| - MouseEvent* impl = static_cast<MouseEvent*>(event);
|
| - Clipboard* clipboard = impl->clipboard();
|
| - return V8Proxy::ToV8Object(V8ClassIndex::CLIPBOARD, clipboard);
|
| - }
|
| -
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -ACCESSOR_GETTER(EventClipboardData) {
|
| - Event* event = V8Proxy::DOMWrapperToNative<Event>(info.Holder());
|
| -
|
| - if (event->isClipboardEvent()) {
|
| - ClipboardEvent* impl = static_cast<ClipboardEvent*>(event);
|
| - Clipboard* clipboard = impl->clipboard();
|
| - return V8Proxy::ToV8Object(V8ClassIndex::CLIPBOARD, clipboard);
|
| - }
|
| -
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -INDEXED_PROPERTY_GETTER(DOMStringList) {
|
| - INC_STATS("DOM.DOMStringList.IndexedPropertyGetter");
|
| - DOMStringList* imp =
|
| - V8Proxy::DOMWrapperToNative<DOMStringList>(info.Holder());
|
| - return v8String(imp->item(index));
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(DOMStringListItem) {
|
| - INC_STATS("DOM.DOMStringListItem()");
|
| - if (args.Length() == 0)
|
| - return v8::Null();
|
| - uint32_t index = args[0]->Uint32Value();
|
| -
|
| - DOMStringList* imp =
|
| - V8Proxy::DOMWrapperToNative<DOMStringList>(args.Holder());
|
| - if (index >= imp->length())
|
| - return v8::Null();
|
| -
|
| - return v8String(imp->item(index));
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_DELETER(HTMLDocument) {
|
| - // Only handle document.all. Insert the marker object into the
|
| - // shadow internal field to signal that document.all is no longer
|
| - // shadowed.
|
| - String key = ToWebCoreString(name);
|
| - if (key == "all") {
|
| - ASSERT(info.Holder()->InternalFieldCount() ==
|
| - kHTMLDocumentInternalFieldCount);
|
| - v8::Local<v8::Value> marker =
|
| - info.Holder()->GetInternalField(kHTMLDocumentMarkerIndex);
|
| - info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, marker);
|
| - return v8::True();
|
| - }
|
| - return v8::Handle<v8::Boolean>();
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_SETTER(HTMLDocument)
|
| -{
|
| - INC_STATS("DOM.HTMLDocument.NamedPropertySetter");
|
| - // Only handle document.all. We insert the value into the shadow
|
| - // internal field from which the getter will retrieve it.
|
| - String key = ToWebCoreString(name);
|
| - if (key == "all") {
|
| - ASSERT(info.Holder()->InternalFieldCount() ==
|
| - kHTMLDocumentInternalFieldCount);
|
| - info.Holder()->SetInternalField(kHTMLDocumentShadowIndex, value);
|
| - }
|
| - return v8::Handle<v8::Value>();
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_GETTER(HTMLDocument)
|
| -{
|
| - INC_STATS("DOM.HTMLDocument.NamedPropertyGetter");
|
| - AtomicString key = ToWebCoreString(name);
|
| -
|
| - // Special case for document.all. If the value in the shadow
|
| - // internal field is not the marker object, then document.all has
|
| - // been temporarily shadowed and we return the value.
|
| - if (key == "all") {
|
| - ASSERT(info.Holder()->InternalFieldCount() == kHTMLDocumentInternalFieldCount);
|
| - v8::Local<v8::Value> marker = info.Holder()->GetInternalField(kHTMLDocumentMarkerIndex);
|
| - v8::Local<v8::Value> value = info.Holder()->GetInternalField(kHTMLDocumentShadowIndex);
|
| - if (marker != value)
|
| - return value;
|
| - }
|
| -
|
| - HTMLDocument* imp = V8Proxy::DOMWrapperToNode<HTMLDocument>(info.Holder());
|
| -
|
| - // Fast case for named elements that are not there.
|
| - if (!imp->hasNamedItem(key.impl()) && !imp->hasExtraNamedItem(key.impl()))
|
| - return v8::Handle<v8::Value>();
|
| -
|
| - RefPtr<HTMLCollection> items = imp->documentNamedItems(key);
|
| - if (items->length() == 0)
|
| - return v8::Handle<v8::Value>();
|
| - if (items->length() == 1) {
|
| - Node* node = items->firstItem();
|
| - Frame* frame = 0;
|
| - if (node->hasTagName(HTMLNames::iframeTag) &&
|
| - (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
|
| - return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow());
|
| - return V8Proxy::NodeToV8Object(node);
|
| - }
|
| - return V8Proxy::ToV8Object(V8ClassIndex::HTMLCOLLECTION, items.get());
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_GETTER(HTMLFrameSetElement)
|
| -{
|
| - INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
|
| - HTMLFrameSetElement* imp =
|
| - V8Proxy::DOMWrapperToNode<HTMLFrameSetElement>(info.Holder());
|
| - String key = ToWebCoreString(name);
|
| - Node* frame = imp->children()->namedItem(key);
|
| - if (frame && frame->hasTagName(HTMLNames::frameTag)) {
|
| - Document* doc = static_cast<HTMLFrameElement*>(frame)->contentDocument();
|
| - if (doc) {
|
| - Frame* content_frame = doc->frame();
|
| - if (content_frame)
|
| - return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, content_frame->domWindow());
|
| - }
|
| - return v8::Undefined();
|
| - }
|
| - return v8::Handle<v8::Value>();
|
| -}
|
| -
|
| -
|
| -INDEXED_PROPERTY_GETTER(NamedNodeMap) {
|
| - INC_STATS("DOM.NamedNodeMap.IndexedPropertyGetter");
|
| - NamedNodeMap* imp = V8Proxy::ToNativeObject<NamedNodeMap>(
|
| - V8ClassIndex::NAMEDNODEMAP, info.Holder());
|
| - RefPtr<Node> result = imp->item(index);
|
| - if (!result) return v8::Handle<v8::Value>();
|
| -
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -NAMED_PROPERTY_GETTER(NamedNodeMap) {
|
| - INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter");
|
| - // Search the prototype chain first.
|
| - v8::Handle<v8::Value> value =
|
| - info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
|
| - if (!value.IsEmpty())
|
| - return value;
|
| -
|
| - // Then look for IDL defined properties on the object itself.
|
| - if (info.Holder()->HasRealNamedCallbackProperty(name))
|
| - return v8::Handle<v8::Value>();
|
| -
|
| - // Finally, search the DOM.
|
| - NamedNodeMap* imp = V8Proxy::ToNativeObject<NamedNodeMap>(
|
| - V8ClassIndex::NAMEDNODEMAP, info.Holder());
|
| - String prop_name = ToWebCoreString(name);
|
| - RefPtr<Node> result = imp->getNamedItem(prop_name);
|
| - if (!result) return v8::Handle<v8::Value>();
|
| -
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_GETTER(NodeList) {
|
| - INC_STATS("DOM.NodeList.NamedPropertyGetter");
|
| - NodeList* list = V8Proxy::ToNativeObject<NodeList>(
|
| - V8ClassIndex::NODELIST, info.Holder());
|
| - String prop_name = ToWebCoreString(name);
|
| -
|
| - // Length property cannot be overridden.
|
| - if (prop_name == "length")
|
| - return v8::Number::New(list->length());
|
| -
|
| - RefPtr<Node> result = list->itemWithName(prop_name);
|
| - if (result)
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -
|
| - return v8::Handle<v8::Value>();
|
| -}
|
| -
|
| -
|
| INDEXED_PROPERTY_GETTER(HTMLFormElement) {
|
| INC_STATS("DOM.HTMLFormElement.IndexedPropertyGetter");
|
| HTMLFormElement* form =
|
| @@ -809,177 +241,6 @@
|
| return OptionsCollectionSetter(index, value, select);
|
| }
|
|
|
| -// Check for a CSS prefix.
|
| -// Passed prefix is all lowercase.
|
| -// First character of the prefix within the property name may be upper or lowercase.
|
| -// Other characters in the prefix within the property name must be lowercase.
|
| -// The prefix within the property name must be followed by a capital letter.
|
| -static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* prefix)
|
| -{
|
| -#ifndef NDEBUG
|
| - ASSERT(*prefix);
|
| - for (const char* p = prefix; *p; ++p)
|
| - ASSERT(WTF::isASCIILower(*p));
|
| - ASSERT(propertyName.length());
|
| -#endif
|
| -
|
| - if (WTF::toASCIILower(propertyName[0]) != prefix[0])
|
| - return false;
|
| -
|
| - unsigned length = propertyName.length();
|
| - for (unsigned i = 1; i < length; ++i) {
|
| - if (!prefix[i])
|
| - return WTF::isASCIIUpper(propertyName[i]);
|
| - if (propertyName[i] != prefix[i])
|
| - return false;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| -// When getting properties on CSSStyleDeclarations, the name used from
|
| -// Javascript and the actual name of the property are not the same, so
|
| -// we have to do the following translation. The translation turns upper
|
| -// case characters into lower case characters and inserts dashes to
|
| -// separate words.
|
| -//
|
| -// Example: 'backgroundPositionY' -> 'background-position-y'
|
| -//
|
| -// Also, certain prefixes such as 'pos', 'css-' and 'pixel-' are stripped
|
| -// and the pixel_or_pos_prefix out parameter is used to indicate whether or
|
| -// not the property name was prefixed with 'pos-' or 'pixel-'.
|
| -static String cssPropertyName(const String& propertyName, bool* hadPixelOrPosPrefix = 0)
|
| -{
|
| - if (hadPixelOrPosPrefix)
|
| - *hadPixelOrPosPrefix = false;
|
| -
|
| - unsigned length = propertyName.length();
|
| - if (!length)
|
| - return String();
|
| -
|
| - Vector<UChar> name;
|
| - name.reserveCapacity(length);
|
| -
|
| - unsigned i = 0;
|
| -
|
| - if (hasCSSPropertyNamePrefix(propertyName, "css"))
|
| - i += 3;
|
| - else if (hasCSSPropertyNamePrefix(propertyName, "pixel")) {
|
| - i += 5;
|
| - if (hadPixelOrPosPrefix)
|
| - *hadPixelOrPosPrefix = true;
|
| - } else if (hasCSSPropertyNamePrefix(propertyName, "pos")) {
|
| - i += 3;
|
| - if (hadPixelOrPosPrefix)
|
| - *hadPixelOrPosPrefix = true;
|
| - } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")
|
| - || hasCSSPropertyNamePrefix(propertyName, "khtml")
|
| - || hasCSSPropertyNamePrefix(propertyName, "apple"))
|
| - name.append('-');
|
| - else {
|
| - if (WTF::isASCIIUpper(propertyName[0]))
|
| - return String();
|
| - }
|
| -
|
| - name.append(WTF::toASCIILower(propertyName[i++]));
|
| -
|
| - for (; i < length; ++i) {
|
| - UChar c = propertyName[i];
|
| - if (!WTF::isASCIIUpper(c))
|
| - name.append(c);
|
| - else {
|
| - name.append('-');
|
| - name.append(WTF::toASCIILower(c));
|
| - }
|
| - }
|
| -
|
| - return String::adopt(name);
|
| -}
|
| -
|
| -NAMED_PROPERTY_GETTER(CSSStyleDeclaration) {
|
| - INC_STATS("DOM.CSSStyleDeclaration.NamedPropertyGetter");
|
| - // First look for API defined attributes on the style declaration
|
| - // object.
|
| - if (info.Holder()->HasRealNamedCallbackProperty(name))
|
| - return v8::Handle<v8::Value>();
|
| -
|
| - // Search the style declaration.
|
| - CSSStyleDeclaration* imp = V8Proxy::ToNativeObject<CSSStyleDeclaration>(
|
| - V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
|
| -
|
| - bool pixel_or_pos;
|
| - String p = ToWebCoreString(name);
|
| - String prop = cssPropertyName(p, &pixel_or_pos);
|
| -
|
| - // Do not handle non-property names.
|
| - if (!CSSStyleDeclaration::isPropertyName(prop)) {
|
| - return v8::Handle<v8::Value>();
|
| - }
|
| -
|
| - RefPtr<CSSValue> v = imp->getPropertyCSSValue(prop);
|
| - if (v) {
|
| - if (pixel_or_pos && v->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE) {
|
| - RefPtr<CSSPrimitiveValue> primitive_value =
|
| - static_pointer_cast<CSSPrimitiveValue>(v);
|
| - return v8::Number::New(
|
| - primitive_value->getFloatValue(CSSPrimitiveValue::CSS_PX));
|
| - }
|
| - return v8StringOrNull(v->cssText());
|
| - }
|
| -
|
| - String result = imp->getPropertyValue(prop);
|
| - if (result.isNull())
|
| - result = ""; // convert null to empty string.
|
| -
|
| - // The 'filter' attribute is made undetectable in KJS/WebKit
|
| - // to avoid confusion with IE's filter extension.
|
| - if (prop == "filter") {
|
| - return v8UndetectableString(result);
|
| - }
|
| - return v8String(result);
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_SETTER(CSSStyleDeclaration) {
|
| - INC_STATS("DOM.CSSStyleDeclaration.NamedPropertySetter");
|
| - CSSStyleDeclaration* imp = V8Proxy::ToNativeObject<CSSStyleDeclaration>(
|
| - V8ClassIndex::CSSSTYLEDECLARATION, info.Holder());
|
| - String property_name = ToWebCoreString(name);
|
| - int ec = 0;
|
| -
|
| - bool pixel_or_pos;
|
| - String prop = cssPropertyName(property_name, &pixel_or_pos);
|
| - if (!CSSStyleDeclaration::isPropertyName(prop)) {
|
| - return v8::Handle<v8::Value>(); // do not block the call
|
| - }
|
| -
|
| - String prop_value = valueToStringWithNullCheck(value);
|
| - if (pixel_or_pos) prop_value += "px";
|
| - imp->setProperty(prop, prop_value, ec);
|
| -
|
| - V8Proxy::SetDOMException(ec);
|
| - return value;
|
| -}
|
| -
|
| -
|
| -NAMED_PROPERTY_GETTER(StyleSheetList) {
|
| - INC_STATS("DOM.StyleSheetList.NamedPropertyGetter");
|
| - // Look for local properties first.
|
| - if (info.Holder()->HasRealNamedProperty(name)) {
|
| - return v8::Handle<v8::Value>();
|
| - }
|
| -
|
| - // Search style sheet.
|
| - StyleSheetList* imp = V8Proxy::ToNativeObject<StyleSheetList>(
|
| - V8ClassIndex::STYLESHEETLIST, info.Holder());
|
| - String key = ToWebCoreString(name);
|
| - HTMLStyleElement* item = imp->getNamedItem(key);
|
| - if (item) {
|
| - return V8Proxy::ToV8Object(V8ClassIndex::HTMLSTYLEELEMENT, item);
|
| - }
|
| - return v8::Handle<v8::Value>();
|
| -}
|
| -
|
| -
|
| // CanvasRenderingContext2D ----------------------------------------------------
|
|
|
| // Helper macro for converting v8 values into floats (expected by many of the
|
| @@ -1396,133 +657,6 @@
|
| return v8::Undefined();
|
| }
|
|
|
| -
|
| -// Clipboard -------------------------------------------------------------------
|
| -
|
| -
|
| -ACCESSOR_GETTER(ClipboardTypes) {
|
| - INC_STATS("DOM.Clipboard.types()");
|
| - Clipboard* imp =
|
| - V8Proxy::ToNativeObject<Clipboard>(V8ClassIndex::CLIPBOARD,
|
| - info.Holder());
|
| -
|
| - HashSet<String> types = imp->types();
|
| - if (types.isEmpty())
|
| - return v8::Null();
|
| -
|
| - v8::Local<v8::Array> result = v8::Array::New(types.size());
|
| - HashSet<String>::const_iterator end = types.end();
|
| - int index = 0;
|
| - for (HashSet<String>::const_iterator it = types.begin();
|
| - it != end;
|
| - ++it, ++index) {
|
| - result->Set(v8::Integer::New(index), v8String(*it));
|
| - }
|
| - return result;
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(ClipboardClearData) {
|
| - INC_STATS("DOM.Clipboard.clearData()");
|
| - Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
|
| - V8ClassIndex::CLIPBOARD, args.Holder());
|
| -
|
| - if (args.Length() == 0) {
|
| - imp->clearAllData();
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - if (args.Length() == 1) {
|
| - String v = ToWebCoreString(args[0]);
|
| - imp->clearData(v);
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
|
| - "clearData: Invalid number of arguments");
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(ClipboardGetData) {
|
| - INC_STATS("DOM.Clipboard.getData()");
|
| - Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
|
| - V8ClassIndex::CLIPBOARD, args.Holder());
|
| -
|
| - if (args.Length() != 1) {
|
| - V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
|
| - "getData: Invalid number of arguments");
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - bool success;
|
| - String v = ToWebCoreString(args[0]);
|
| - String result = imp->getData(v, success);
|
| - if (success) return v8String(result);
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(ClipboardSetData) {
|
| - INC_STATS("DOM.Clipboard.setData()");
|
| - Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
|
| - V8ClassIndex::CLIPBOARD, args.Holder());
|
| -
|
| - if (args.Length() != 2) {
|
| - V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
|
| - "setData: Invalid number of arguments");
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - String type = ToWebCoreString(args[0]);
|
| - String data = ToWebCoreString(args[1]);
|
| - bool result = imp->setData(type, data);
|
| - return result ? v8::True() : v8::False();
|
| -}
|
| -
|
| -
|
| -CALLBACK_FUNC_DECL(ClipboardSetDragImage) {
|
| - INC_STATS("DOM.Clipboard.setDragImage()");
|
| - Clipboard* imp = V8Proxy::ToNativeObject<Clipboard>(
|
| - V8ClassIndex::CLIPBOARD, args.Holder());
|
| -
|
| - if (!imp->isForDragging())
|
| - return v8::Undefined();
|
| -
|
| - if (args.Length() != 3) {
|
| - V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
|
| - "setDragImage: Invalid number of arguments");
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - int x = ToInt32(args[1]);
|
| - int y = ToInt32(args[2]);
|
| -
|
| - Node* node = 0;
|
| - if (V8Node::HasInstance(args[0]))
|
| - node = V8Proxy::DOMWrapperToNode<Node>(args[0]);
|
| - if (!node) {
|
| - V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
|
| - "setDragImageFromElement: Invalid first argument");
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - if (!node->isElementNode()) {
|
| - V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR,
|
| - "setDragImageFromElement: Invalid first argument");
|
| - return v8::Undefined();
|
| - }
|
| -
|
| - if (static_cast<Element*>(node)->hasLocalName(HTMLNames::imgTag) &&
|
| - !node->inDocument())
|
| - imp->setDragImage(static_cast<HTMLImageElement*>(node)->cachedImage(),
|
| - IntPoint(x, y));
|
| - else
|
| - imp->setDragImageElement(node, IntPoint(x, y));
|
| -
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| static bool AllowSettingSrcToJavascriptURL(Element* element, String name,
|
| String value) {
|
| // Need to parse value as URL first in order to check its protocol.
|
| @@ -1736,7 +870,7 @@
|
| return v8::Undefined();
|
|
|
| id = DOMTimer::install(script_context,
|
| - new V8ScheduledAction(string_function), timeout,
|
| + new ScheduledAction(string_function), timeout,
|
| single_shot);
|
| } else if (function->IsFunction()) {
|
| int param_count = num_arguments >= 2 ? num_arguments - 2 : 0;
|
| @@ -1749,7 +883,7 @@
|
| }
|
|
|
| // params is passed to action, and released in action's destructor
|
| - ScheduledAction* action = new V8ScheduledAction(
|
| + ScheduledAction* action = new ScheduledAction(
|
| v8::Handle<v8::Function>::Cast(function), param_count, params);
|
|
|
| delete[] params;
|
| @@ -1967,213 +1101,6 @@
|
| }
|
|
|
|
|
| -// Node -------------------------------------------------------------
|
| -
|
| -CALLBACK_FUNC_DECL(NodeAddEventListener) {
|
| - INC_STATS("DOM.Node.addEventListener()");
|
| - Node* node = V8Proxy::DOMWrapperToNode<Node>(args.Holder());
|
| -
|
| - V8Proxy* proxy = V8Proxy::retrieve(node->document()->frame());
|
| - if (!proxy)
|
| - return v8::Undefined();
|
| -
|
| - RefPtr<EventListener> listener =
|
| - proxy->FindOrCreateV8EventListener(args[1], false);
|
| - if (listener) {
|
| - String type = ToWebCoreString(args[0]);
|
| - bool useCapture = args[2]->BooleanValue();
|
| - node->addEventListener(type, listener, useCapture);
|
| - }
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(NodeRemoveEventListener) {
|
| - INC_STATS("DOM.Node.removeEventListener()");
|
| - Node* node = V8Proxy::DOMWrapperToNode<Node>(args.Holder());
|
| -
|
| - V8Proxy* proxy = V8Proxy::retrieve(node->document()->frame());
|
| - // It is possbile that the owner document of the node is detached
|
| - // from the frame, return immediately in this case.
|
| - // See issue 878909
|
| - if (!proxy)
|
| - return v8::Undefined();
|
| -
|
| - RefPtr<EventListener> listener =
|
| - proxy->FindV8EventListener(args[1], false);
|
| - if (listener) {
|
| - String type = ToWebCoreString(args[0]);
|
| - bool useCapture = args[2]->BooleanValue();
|
| - node->removeEventListener(type, listener.get(), useCapture);
|
| - }
|
| -
|
| - return v8::Undefined();
|
| -}
|
| -
|
| -
|
| -// Navigator ------------------------------------------------------------------
|
| -ACCESSOR_GETTER(NavigatorAppVersion) {
|
| - INC_STATS("DOM.Navigator.appVersion");
|
| - v8::Handle<v8::Object> holder = info.Holder();
|
| - Navigator* imp = V8Proxy::ToNativeObject<Navigator>(V8ClassIndex::NAVIGATOR,
|
| - holder);
|
| - String v = ToString(imp->appVersion());
|
| - return v8StringOrUndefined(v);
|
| -}
|
| -
|
| -
|
| -// TreeWalker ------------------------------------------------------------------
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerParentNode) {
|
| - INC_STATS("DOM.TreeWalker.parentNode()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->parentNode(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerFirstChild) {
|
| - INC_STATS("DOM.TreeWalker.firstChild()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->firstChild(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerLastChild) {
|
| - INC_STATS("DOM.TreeWalker.lastChild()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->lastChild(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerNextNode) {
|
| - INC_STATS("DOM.TreeWalker.nextNode()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->nextNode(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) {
|
| - INC_STATS("DOM.TreeWalker.previousNode()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->previousNode(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerNextSibling) {
|
| - INC_STATS("DOM.TreeWalker.nextSibling()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->nextSibling(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) {
|
| - INC_STATS("DOM.TreeWalker.previousSibling()");
|
| - TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>(
|
| - V8ClassIndex::TREEWALKER, args.Holder());
|
| -
|
| - ScriptState state;
|
| - RefPtr<Node> result = treeWalker->previousSibling(&state);
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(NodeIteratorNextNode) {
|
| - INC_STATS("DOM.NodeIterator.nextNode()");
|
| - NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>(
|
| - V8ClassIndex::NODEITERATOR, args.Holder());
|
| -
|
| - ExceptionCode ec = 0;
|
| - ScriptState state;
|
| - RefPtr<Node> result = nodeIterator->nextNode(&state, ec);
|
| - if (ec != 0) {
|
| - V8Proxy::SetDOMException(ec);
|
| - return v8::Null();
|
| - }
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) {
|
| - INC_STATS("DOM.NodeIterator.previousNode()");
|
| - NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>(
|
| - V8ClassIndex::NODEITERATOR, args.Holder());
|
| -
|
| - ExceptionCode ec = 0;
|
| - ScriptState state;
|
| - RefPtr<Node> result = nodeIterator->previousNode(&state, ec);
|
| - if (ec != 0) {
|
| - V8Proxy::SetDOMException(ec);
|
| - return v8::Null();
|
| - }
|
| - if (state.hadException()) {
|
| - v8::ThrowException(state.exception());
|
| - return v8::Undefined();
|
| - }
|
| - if (!result) return v8::Null();
|
| - return V8Proxy::NodeToV8Object(result.get());
|
| -}
|
| -
|
| -CALLBACK_FUNC_DECL(NodeFilterAcceptNode) {
|
| - INC_STATS("DOM.NodeFilter.acceptNode()");
|
| - V8Proxy::SetDOMException(NOT_SUPPORTED_ERR);
|
| - return v8::Undefined();
|
| -}
|
| -
|
| CALLBACK_FUNC_DECL(HTMLFormElementSubmit) {
|
| INC_STATS("DOM.HTMLFormElement.submit()");
|
|
|
|
|