summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authordglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 18:57:59 +0000
committerdglazkov@google.com <dglazkov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 18:57:59 +0000
commit0a14d3db1762fb2e309e5f0e07279f91ed2bb128 (patch)
treed4faf15bd6a22aa523e8b4e858d4a03becd4b68c /webkit/port
parent4ab4b0f66a346a4e48601d51693170d9adc85d96 (diff)
downloadchromium_src-0a14d3db1762fb2e309e5f0e07279f91ed2bb128.zip
chromium_src-0a14d3db1762fb2e309e5f0e07279f91ed2bb128.tar.gz
chromium_src-0a14d3db1762fb2e309e5f0e07279f91ed2bb128.tar.bz2
Reverting 9486.
Review URL: http://codereview.chromium.org/20227 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/bindings/v8/v8_custom.cpp119
1 files changed, 119 insertions, 0 deletions
diff --git a/webkit/port/bindings/v8/v8_custom.cpp b/webkit/port/bindings/v8/v8_custom.cpp
index c3899d8..914ebaf 100644
--- a/webkit/port/bindings/v8/v8_custom.cpp
+++ b/webkit/port/bindings/v8/v8_custom.cpp
@@ -79,8 +79,10 @@
#include "HTMLFrameSetElement.h"
#include "HTMLIFrameElement.h"
#include "HTMLImageElement.h"
+#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HTMLOptionElement.h"
+#include "HTMLOptionsCollection.h"
#include "HTMLSelectElement.h"
#include "History.h"
#include "JSXPathNSResolver.h"
@@ -110,6 +112,13 @@
#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"
// Horizontal and vertical offset, from the parent content area, around newly
@@ -3221,6 +3230,116 @@ ACCESSOR_GETTER(ElementEventHandler) {
return V8Proxy::EventListenerToV8Object(listener);
}
+
+ACCESSOR_GETTER(HTMLOptionsCollectionLength) {
+ INC_STATS("DOM.HTMLOptionsCollection.length._get");
+ HTMLOptionsCollection* imp =
+ V8Proxy::ToNativeObject<HTMLOptionsCollection>(
+ V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+ int v = imp->length();
+ return v8::Integer::New(v);
+}
+
+
+ACCESSOR_SETTER(HTMLOptionsCollectionLength) {
+ INC_STATS("DOM.HTMLOptionsCollection.length._set");
+ HTMLOptionsCollection* imp =
+ V8Proxy::ToNativeObject<HTMLOptionsCollection>(
+ V8ClassIndex::HTMLOPTIONSCOLLECTION, info.Holder());
+ double v = value->NumberValue();
+ unsigned newLength = 0;
+ ExceptionCode ec = 0;
+ if (!isnan(v) && !isinf(v)) {
+ if (v < 0.0) {
+ ec = INDEX_SIZE_ERR;
+ } else if (v > static_cast<double>(UINT_MAX)) {
+ newLength = UINT_MAX;
+ } else {
+ newLength = static_cast<unsigned>(v);
+ }
+ }
+ if (!ec) imp->setLength(value->Uint32Value(), ec);
+ V8Proxy::SetDOMException(ec);
+}
+
+ACCESSOR_GETTER(HTMLInputElementSelectionStart) {
+ INC_STATS("DOM.HTMLInputElement.selectionStart._get");
+ v8::Handle<v8::Object> holder = info.Holder();
+ HTMLInputElement* imp = V8Proxy::DOMWrapperToNode<HTMLInputElement>(holder);
+
+ if (!imp->canHaveSelection()) {
+ V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
+ "Accessing selectionStart on an input element that "
+ "cannot have a selection.");
+ 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()) {
+ V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
+ "Accessing selectionStart on an input element that "
+ "cannot have a selection.");
+ return;
+ }
+ 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()) {
+ V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
+ "Accessing selectionEnd on an input element that "
+ "cannot have a selection.");
+ 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()) {
+ V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
+ "Accessing selectionEnd on an input element that "
+ "cannot have a selection.");
+ return;
+ }
+ 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()) {
+ V8Proxy::ThrowError(V8Proxy::TYPE_ERROR,
+ "Calling setSelectionRange on an input element that "
+ "cannot have a selection.");
+ return v8::Undefined();
+ }
+ int start = args[0]->Int32Value();
+ int end = args[1]->Int32Value();
+
+ imp->setSelectionRange(start, end);
+ return v8::Undefined();
+}
+
// --------------- Security Checks -------------------------
NAMED_ACCESS_CHECK(DOMWindow) {
ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::DOMWINDOW);