当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLFormElement类代码示例

本文整理汇总了C++中HTMLFormElement的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFormElement类的具体用法?C++ HTMLFormElement怎么用?C++ HTMLFormElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HTMLFormElement类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nameGetter

JSValue JSHTMLFormElement::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
{
    JSHTMLElement* jsForm = static_cast<JSHTMLFormElement*>(asObject(slotBase));
    HTMLFormElement* form = static_cast<HTMLFormElement*>(jsForm->impl());

    Vector<RefPtr<Node> > namedItems;
    form->getNamedElements(identifierToAtomicString(propertyName), namedItems);
    
    if (namedItems.isEmpty())
        return jsUndefined();
    if (namedItems.size() == 1)
        return toJS(exec, jsForm->globalObject(), namedItems[0].get());

    // FIXME: HTML5 specifies that this should be a RadioNodeList.
    return toJS(exec, jsForm->globalObject(), StaticNodeList::adopt(namedItems).get());
}
开发者ID:1833183060,项目名称:wke,代码行数:16,代码来源:JSHTMLFormElementCustom.cpp

示例2: TEST_F

TEST_F(HTMLSelectElementTest, DefaultToolTip) {
  document().documentElement()->setInnerHTML(
      "<select size=4><option value="
      ">Placeholder</option><optgroup><option>o2</option></optgroup></select>",
      ASSERT_NO_EXCEPTION);
  document().view()->updateAllLifecyclePhases();
  HTMLSelectElement* select =
      toHTMLSelectElement(document().body()->firstChild());
  Element* option = toElement(select->firstChild());
  Element* optgroup = toElement(option->nextSibling());

  EXPECT_EQ(String(), select->defaultToolTip())
      << "defaultToolTip for SELECT without FORM and without required "
         "attribute should return null string.";
  EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip());
  EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip());

  select->setBooleanAttribute(HTMLNames::requiredAttr, true);
  EXPECT_EQ("<<ValidationValueMissingForSelect>>", select->defaultToolTip())
      << "defaultToolTip for SELECT without FORM and with required attribute "
         "should return a valueMissing message.";
  EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip());
  EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip());

  HTMLFormElement* form = HTMLFormElement::create(document());
  document().body()->appendChild(form);
  form->appendChild(select);
  EXPECT_EQ("<<ValidationValueMissingForSelect>>", select->defaultToolTip())
      << "defaultToolTip for SELECT with FORM and required attribute should "
         "return a valueMissing message.";
  EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip());
  EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip());

  form->setBooleanAttribute(HTMLNames::novalidateAttr, true);
  EXPECT_EQ(String(), select->defaultToolTip())
      << "defaultToolTip for SELECT with FORM[novalidate] and required "
         "attribute should return null string.";
  EXPECT_EQ(select->defaultToolTip(), option->defaultToolTip());
  EXPECT_EQ(select->defaultToolTip(), optgroup->defaultToolTip());

  option->remove();
  optgroup->remove();
  EXPECT_EQ(String(), option->defaultToolTip());
  EXPECT_EQ(String(), optgroup->defaultToolTip());
}
开发者ID:mirror,项目名称:chromium,代码行数:45,代码来源:HTMLSelectElementTest.cpp

示例3: throwError

JSValue* JSHTMLFormElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
    if (!thisObj->inherits(&JSHTMLFormElement::info))
      return throwError(exec, TypeError);

    HTMLFormElement* imp = static_cast<HTMLFormElement*>(static_cast<JSHTMLFormElement*>(thisObj)->impl());

    switch (id) {
    case JSHTMLFormElement::SubmitFuncNum: {

        imp->submit();
        return jsUndefined();
    }
    case JSHTMLFormElement::ResetFuncNum: {

        imp->reset();
        return jsUndefined();
    }
    }
    return 0;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:21,代码来源:JSHTMLFormElement.cpp

示例4: formSignature

static inline String formSignature(const HTMLFormElement& form)
{
    URL actionURL = form.getURLAttribute(actionAttr);
    // Remove the query part because it might contain volatile parameters such
    // as a session key.
    actionURL.setQuery(String());
    StringBuilder builder;
    if (!actionURL.isEmpty())
        builder.append(actionURL.string());

    recordFormStructure(form, builder);
    return builder.toString();
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:13,代码来源:FormController.cpp

示例5: findFormAncestor

void HTMLImageElement::resetFormOwner()
{
    m_formWasSetByParser = false;
    HTMLFormElement* nearestForm = findFormAncestor();
    if (m_form) {
        if (nearestForm == m_form.get())
            return;
        m_form->disassociate(*this);
    }
    if (nearestForm) {
#if ENABLE(OILPAN)
        m_form = nearestForm;
#else
        m_form = nearestForm->createWeakPtr();
#endif
        m_form->associate(*this);
    } else {
#if ENABLE(OILPAN)
        m_form = nullptr;
#else
        m_form = WeakPtr<HTMLFormElement>();
#endif
    }
}
开发者ID:dstockwell,项目名称:blink,代码行数:24,代码来源:HTMLImageElement.cpp

示例6: restoreControlStateIn

void FormController::restoreControlStateIn(HTMLFormElement& form)
{
    for (auto& element : form.associatedElements()) {
        if (!element->isFormControlElementWithState())
            continue;
        HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(element);
        if (!control->shouldSaveAndRestoreFormControlState())
            continue;
        if (ownerFormForState(*control) != &form)
            continue;
        FormControlState state = takeStateForFormElement(*control);
        if (state.valueSize() > 0)
            control->restoreFormControlState(state);
    }
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:15,代码来源:FormController.cpp

示例7: restoreControlStateIn

void FormController::restoreControlStateIn(HTMLFormElement& form)
{
    const Vector<FormAssociatedElement*>& elements = form.associatedElements();
    for (size_t i = 0; i < elements.size(); ++i) {
        if (!elements[i]->isFormControlElementWithState())
            continue;
        HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(elements[i]);
        if (!control->shouldSaveAndRestoreFormControlState())
            continue;
        if (ownerFormForState(*control) != &form)
            continue;
        FormControlState state = takeStateForFormElement(*control);
        if (state.valueSize() > 0)
            control->restoreFormControlState(state);
    }
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:16,代码来源:FormController.cpp

示例8: recordFormStructure

static inline void recordFormStructure(const HTMLFormElement& form, StringBuilder& builder)
{
    // 2 is enough to distinguish forms in webkit.org/b/91209#c0
    const size_t namedControlsToBeRecorded = 2;
    const Vector<FormAssociatedElement*>& controls = form.associatedElements();
    builder.appendLiteral(" [");
    for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) {
        if (!controls[i]->isFormControlElementWithState())
            continue;
        HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(controls[i]);
        if (!ownerFormForState(*control))
            continue;
        AtomicString name = control->name();
        if (name.isEmpty())
            continue;
        namedControls++;
        builder.append(name);
        builder.append(' ');
    }
    builder.append(']');
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:21,代码来源:FormController.cpp

示例9: switch

void JSHTMLFormElement::putValueProperty(ExecState* exec, int token, JSValue* value)
{
    switch (token) {
    case NameAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setName(valueToStringWithNullCheck(exec, value));
        break;
    }
    case AcceptCharsetAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setAcceptCharset(valueToStringWithNullCheck(exec, value));
        break;
    }
    case ActionAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setAction(valueToStringWithNullCheck(exec, value));
        break;
    }
    case EncodingAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setEncoding(valueToStringWithNullCheck(exec, value));
        break;
    }
    case EnctypeAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setEnctype(valueToStringWithNullCheck(exec, value));
        break;
    }
    case MethodAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setMethod(valueToStringWithNullCheck(exec, value));
        break;
    }
    case TargetAttrNum: {
        HTMLFormElement* imp = static_cast<HTMLFormElement*>(impl());
        imp->setTarget(valueToStringWithNullCheck(exec, value));
        break;
    }
    }
}
开发者ID:achellies,项目名称:ISeeBrowser,代码行数:40,代码来源:JSHTMLFormElement.cpp

示例10: setJSHTMLFormElementTarget

void setJSHTMLFormElementTarget(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSHTMLFormElement* castedThisObj = static_cast<JSHTMLFormElement*>(thisObject);
    HTMLFormElement* imp = static_cast<HTMLFormElement*>(castedThisObj->impl());
    imp->setTarget(valueToStringWithNullCheck(exec, value));
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:6,代码来源:JSHTMLFormElement.cpp

示例11: setJSHTMLFormElementNoValidate

void setJSHTMLFormElementNoValidate(ExecState* exec, JSObject* thisObject, JSValue value)
{
    JSHTMLFormElement* castedThisObj = static_cast<JSHTMLFormElement*>(thisObject);
    HTMLFormElement* imp = static_cast<HTMLFormElement*>(castedThisObj->impl());
    imp->setNoValidate(value.toBoolean(exec));
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:6,代码来源:JSHTMLFormElement.cpp

示例12: setJSHTMLFormElementMethod

void setJSHTMLFormElementMethod(ExecState* exec, JSObject* thisObject, JSValue value)
{
    HTMLFormElement* imp = static_cast<HTMLFormElement*>(static_cast<JSHTMLFormElement*>(thisObject)->impl());
    imp->setMethod(valueToStringWithNullCheck(exec, value));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:5,代码来源:JSHTMLFormElement.cpp


注:本文中的HTMLFormElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。