Ejemplo n.º 1
0
void HTMLTextFieldAccessible::Value(nsString& aValue) const {
  aValue.Truncate();
  if (NativeState() & states::PROTECTED)  // Don't return password text!
    return;

  HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
  if (textArea) {
    textArea->GetValue(aValue);
    return;
  }

  HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
  if (input) {
    // Pass NonSystem as the caller type, to be safe.  We don't expect to have a
    // file input here.
    input->GetValue(aValue, CallerType::NonSystem);
  }
}
Ejemplo n.º 2
0
already_AddRefed<nsIController>
nsXBLPrototypeHandler::GetController(EventTarget* aTarget)
{
  // XXX Fix this so there's a generic interface that describes controllers,
  // This code should have no special knowledge of what objects might have controllers.
  nsCOMPtr<nsIControllers> controllers;

  nsCOMPtr<nsIContent> targetContent(do_QueryInterface(aTarget));
  RefPtr<nsXULElement> xulElement =
    nsXULElement::FromContentOrNull(targetContent);
  if (xulElement) {
    controllers = xulElement->GetControllers(IgnoreErrors());
  }

  if (!controllers) {
    HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromContent(targetContent);
    if (htmlTextArea)
      htmlTextArea->GetControllers(getter_AddRefs(controllers));
  }

  if (!controllers) {
    nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement(do_QueryInterface(aTarget));
    if (htmlInputElement)
      htmlInputElement->GetControllers(getter_AddRefs(controllers));
  }

  if (!controllers) {
    nsCOMPtr<nsPIDOMWindowOuter> domWindow(do_QueryInterface(aTarget));
    if (domWindow) {
      domWindow->GetControllers(getter_AddRefs(controllers));
    }
  }

  // Return the first controller.
  // XXX This code should be checking the command name and using supportscommand and
  // iscommandenabled.
  nsCOMPtr<nsIController> controller;
  if (controllers) {
    controllers->GetControllerAt(0, getter_AddRefs(controller));
  }

  return controller.forget();
}
Ejemplo n.º 3
0
static v8::Handle<v8::Value> requiredAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLTextAreaElement.required._get");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(info.Holder());
    return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::requiredAttr));
}
Ejemplo n.º 4
0
void JSHTMLTextAreaElement::putValueProperty(ExecState* exec, int token, JSValue* value)
{
    switch (token) {
    case DefaultValueAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setDefaultValue(valueToStringWithNullCheck(exec, value));
        break;
    }
    case AccessKeyAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setAccessKey(valueToStringWithNullCheck(exec, value));
        break;
    }
    case ColsAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setCols(value->toInt32(exec));
        break;
    }
    case DisabledAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setDisabled(value->toBoolean(exec));
        break;
    }
    case AutofocusAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setAutofocus(value->toBoolean(exec));
        break;
    }
    case NameAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setName(valueToStringWithNullCheck(exec, value));
        break;
    }
    case ReadOnlyAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setReadOnly(value->toBoolean(exec));
        break;
    }
    case RowsAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setRows(value->toInt32(exec));
        break;
    }
    case ValueAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setValue(valueToStringWithNullCheck(exec, value));
        break;
    }
    case SelectionStartAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setSelectionStart(value->toInt32(exec));
        break;
    }
    case SelectionEndAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        imp->setSelectionEnd(value->toInt32(exec));
        break;
    }
    }
}
Ejemplo n.º 5
0
void DOMHTMLTextAreaElement::setValue(WebCore::String value)
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    textareaElement->setValue(value);
}
Ejemplo n.º 6
0
HTMLTextAreaElement* HTMLTextAreaElement::create(Document& document,
                                                 HTMLFormElement* form) {
  HTMLTextAreaElement* textArea = new HTMLTextAreaElement(document, form);
  textArea->ensureUserAgentShadowRoot();
  return textArea;
}
Ejemplo n.º 7
0
static v8::Handle<v8::Value> validityAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLTextAreaElement.validity._get");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(info.Holder());
    return toV8(imp->validity());
}
Ejemplo n.º 8
0
static v8::Handle<v8::Value> checkValidityCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLTextAreaElement.checkValidity");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(args.Holder());
    return v8Boolean(imp->checkValidity());
}
Ejemplo n.º 9
0
void setJSHTMLTextAreaElementSelectionEnd(ExecState* exec, JSObject* thisObject, JSValue value)
{
    HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(thisObject)->impl());
    imp->setSelectionEnd(value.toInt32(exec));
}
Ejemplo n.º 10
0
void setJSHTMLTextAreaElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
{
    HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(thisObject)->impl());
    imp->setValue(valueToStringWithNullCheck(exec, value));
}
Ejemplo n.º 11
0
void setJSHTMLTextAreaElementReadOnly(ExecState* exec, JSObject* thisObject, JSValue value)
{
    HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(thisObject)->impl());
    imp->setReadOnly(value.toBoolean(exec));
}
Ejemplo n.º 12
0
JSValue jsHTMLTextAreaElementSelectionEnd(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(asObject(slot.slotBase()))->impl());
    return jsNumber(exec, imp->selectionEnd());
}
Ejemplo n.º 13
0
JSValue jsHTMLTextAreaElementWillValidate(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(asObject(slot.slotBase()))->impl());
    return jsBoolean(imp->willValidate());
}
Ejemplo n.º 14
0
JSValue jsHTMLTextAreaElementType(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(static_cast<JSHTMLTextAreaElement*>(asObject(slot.slotBase()))->impl());
    return jsString(exec, imp->type());
}
Ejemplo n.º 15
0
static v8::Handle<v8::Value> textLengthAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLTextAreaElement.textLength._get");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(info.Holder());
    return v8::Integer::NewFromUnsigned(imp->textLength());
}
Ejemplo n.º 16
0
static v8::Handle<v8::Value> willValidateAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLTextAreaElement.willValidate._get");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(info.Holder());
    return v8Boolean(imp->willValidate());
}
Ejemplo n.º 17
0
const char* DOMHTMLTextAreaElement::value()
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    return strdup(textareaElement->value().utf8().data());
}
Ejemplo n.º 18
0
static v8::Handle<v8::Value> defaultValueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLTextAreaElement.defaultValue._get");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(info.Holder());
    return v8String(imp->defaultValue());
}
Ejemplo n.º 19
0
void DOMHTMLTextAreaElement::setValue(const char* value)
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    textareaElement->setValue(value);
}
Ejemplo n.º 20
0
static v8::Handle<v8::Value> colsAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLTextAreaElement.cols._get");
    HTMLTextAreaElement* imp = V8HTMLTextAreaElement::toNative(info.Holder());
    return v8::Integer::New(imp->cols());
}
Ejemplo n.º 21
0
void DOMHTMLTextAreaElement::select()
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    textareaElement->select();
}
Ejemplo n.º 22
0
JSValue* JSHTMLTextAreaElement::getValueProperty(ExecState* exec, int token) const
{
    switch (token) {
    case DefaultValueAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsString(exec, imp->defaultValue());
    }
    case FormAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return toJS(exec, WTF::getPtr(imp->form()));
    }
    case AccessKeyAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsString(exec, imp->accessKey());
    }
    case ColsAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsNumber(exec, imp->cols());
    }
    case DisabledAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsBoolean(imp->disabled());
    }
    case AutofocusAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsBoolean(imp->autofocus());
    }
    case NameAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsString(exec, imp->name());
    }
    case ReadOnlyAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsBoolean(imp->readOnly());
    }
    case RowsAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsNumber(exec, imp->rows());
    }
    case TypeAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsString(exec, imp->type());
    }
    case ValueAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsString(exec, imp->value());
    }
    case SelectionStartAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsNumber(exec, imp->selectionStart());
    }
    case SelectionEndAttrNum: {
        HTMLTextAreaElement* imp = static_cast<HTMLTextAreaElement*>(impl());
        return jsNumber(exec, imp->selectionEnd());
    }
    case ConstructorAttrNum:
        return getConstructor(exec);
    }
    return 0;
}
Ejemplo n.º 23
0
WebCore::String DOMHTMLTextAreaElement::value()
{
    ASSERT(m_element && m_element->hasTagName(textareaTag));
    HTMLTextAreaElement* textareaElement = static_cast<HTMLTextAreaElement*>(m_element);
    return textareaElement->value();
}