diff options
Diffstat (limited to 'webkit/port/bindings/v8')
-rw-r--r-- | webkit/port/bindings/v8/ScriptCachedFrameData.h (renamed from webkit/port/bindings/v8/ScriptCachedPageData.h) | 10 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.cpp | 51 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_custom.h | 4 |
3 files changed, 58 insertions, 7 deletions
diff --git a/webkit/port/bindings/v8/ScriptCachedPageData.h b/webkit/port/bindings/v8/ScriptCachedFrameData.h index f804d65..d6f655d 100644 --- a/webkit/port/bindings/v8/ScriptCachedPageData.h +++ b/webkit/port/bindings/v8/ScriptCachedFrameData.h @@ -34,15 +34,15 @@ // We don't use WebKit's page caching, so this implementation is just a stub. namespace WebCore { - class Page; + class Frame; class DOMWindow; - class ScriptCachedPageData { + class ScriptCachedFrameData { public: - ScriptCachedPageData(Page*) { } - ~ScriptCachedPageData() { } + ScriptCachedFrameData(Frame*) { } + ~ScriptCachedFrameData() { } - void restore(Page*) { } + void restore(Frame*) { } void clear() { } DOMWindow* domWindow() const { return 0; } }; diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp index 0b2ec6a..52d9469 100644 --- a/webkit/port/bindings/v8/v8_custom.cpp +++ b/webkit/port/bindings/v8/v8_custom.cpp @@ -3262,25 +3262,72 @@ ACCESSOR_GETTER(HTMLInputElementSelectionStart) { v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); - if (!imp->canHaveSelection()) + if (!imp->canHaveSelection()) { + // TODO(playmobil): Add a proper error string. + V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, ""); return v8::Undefined(); + } int v = imp->selectionStart(); return v8::Integer::New(v); } +ACCESSOR_SETTER(HTMLInputElementSelectionStart) { + INC_STATS("DOM.HTMLInputElement.selectionStart._set"); + v8::Handle<v8::Object> holder = info.Holder(); + HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); + + if (!imp->canHaveSelection()) { + // TODO(playmobil): Add a proper error string. + V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, ""); + } + imp->setSelectionStart(value->Int32Value()); +} + ACCESSOR_GETTER(HTMLInputElementSelectionEnd) { INC_STATS("DOM.HTMLInputElement.selectionEnd._get"); v8::Handle<v8::Object> holder = info.Holder(); HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); - if (!imp->canHaveSelection()) + if (!imp->canHaveSelection()) { + // TODO(playmobil): Add a proper error string. + V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, ""); return v8::Undefined(); + } int v = imp->selectionEnd(); return v8::Integer::New(v); } +ACCESSOR_SETTER(HTMLInputElementSelectionEnd) { + INC_STATS("DOM.HTMLInputElement.selectionEnd._set"); + v8::Handle<v8::Object> holder = info.Holder(); + HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); + + if (!imp->canHaveSelection()) { + // TODO(playmobil): Add a proper error string. + V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, ""); + } + imp->setSelectionEnd(value->Int32Value()); +} + +CALLBACK_FUNC_DECL(HTMLInputElementSetSelectionRange) { + INC_STATS("DOM.HTMLInputElement.setSelectionRange"); + v8::Handle<v8::Object> holder = args.Holder(); + HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder); + + if (!imp->canHaveSelection()) { + // TODO(playmobil): Add a proper error string. + V8Proxy::ThrowError(V8Proxy::TYPE_ERROR, ""); + return v8::Undefined(); + } + int start = args[0]->Int32Value(); + int end = args[1]->Int32Value(); + + imp->setSelectionRange(start, end); + return v8::Undefined(); +} + #if ENABLE(SVG) ACCESSOR_GETTER(SVGLengthValue) { diff --git a/webkit/port/bindings/v8/v8_custom.h b/webkit/port/bindings/v8/v8_custom.h index 3d23b26..9dcbc41 100644 --- a/webkit/port/bindings/v8/v8_custom.h +++ b/webkit/port/bindings/v8/v8_custom.h @@ -208,9 +208,13 @@ DECLARE_PROPERTY_ACCESSOR_SETTER(AttrValue) // Customized setter of HTMLOptionsCollection length DECLARE_PROPERTY_ACCESSOR(HTMLOptionsCollectionLength) +DECLARE_CALLBACK(HTMLInputElementSetSelectionRange) + // Customized accessors for HTMLInputElement DECLARE_PROPERTY_ACCESSOR_GETTER(HTMLInputElementSelectionStart) +DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLInputElementSelectionStart) DECLARE_PROPERTY_ACCESSOR_GETTER(HTMLInputElementSelectionEnd) +DECLARE_PROPERTY_ACCESSOR_SETTER(HTMLInputElementSelectionEnd) DECLARE_NAMED_ACCESS_CHECK(Location) DECLARE_INDEXED_ACCESS_CHECK(History) |