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


C++ FormControlState::valueSize方法代码示例

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


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

示例1: document

TEST_F(HTMLSelectElementTest, SaveRestoreSelectSingleFormControlState) {
  document().documentElement()->setInnerHTML(
      String("<!DOCTYPE HTML><select id='sel'>"
             "<option value='111' id='0'>111</option>"
             "<option value='222'>222</option>"
             "<option value='111' selected id='2'>!666</option>"
             "<option value='999'>999</option></select>"),
      ASSERT_NO_EXCEPTION);
  document().view()->updateAllLifecyclePhases();
  Element* element = document().getElementById("sel");
  HTMLFormControlElementWithState* select = toHTMLSelectElement(element);
  HTMLOptionElement* opt0 = toHTMLOptionElement(document().getElementById("0"));
  HTMLOptionElement* opt2 = toHTMLOptionElement(document().getElementById("2"));

  // Save the select element state, and then restore again.
  // Test passes if the restored state is not changed.
  EXPECT_EQ(2, toHTMLSelectElement(element)->selectedIndex());
  EXPECT_FALSE(opt0->selected());
  EXPECT_TRUE(opt2->selected());
  FormControlState selectState = select->saveFormControlState();
  EXPECT_EQ(2U, selectState.valueSize());

  // Clear the selected state, to be restored by restoreFormControlState.
  toHTMLSelectElement(select)->setSelectedIndex(-1);
  ASSERT_FALSE(opt2->selected());

  // Restore
  select->restoreFormControlState(selectState);
  EXPECT_EQ(2, toHTMLSelectElement(element)->selectedIndex());
  EXPECT_FALSE(opt0->selected());
  EXPECT_TRUE(opt2->selected());
}
开发者ID:mirror,项目名称:chromium,代码行数:32,代码来源:HTMLSelectElementTest.cpp

示例2: getNumberFromFormControlState

static unsigned getNumberFromFormControlState(const FormControlState& state, size_t index)
{
    if (index >= state.valueSize())
        return DateTimeFieldsState::emptyValue;
    bool parsed;
    unsigned const value = state[index].toUInt(&parsed);
    return parsed ? value : DateTimeFieldsState::emptyValue;
}
开发者ID:yoavweiss,项目名称:RespImg-WebKit,代码行数:8,代码来源:DateTimeFieldsState.cpp

示例3: formElementsCharacterCount

unsigned FormController::formElementsCharacterCount() const
{
    unsigned count = 0;
    for (auto& element : m_formElementsWithState) {
        FormControlState state = element->saveFormControlState();
        if (state.valueSize() && element->isTextFormControl())
            count += state[0].length();
    }
    return count;
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:10,代码来源:FormController.cpp

示例4: getAMPMFromFormControlState

static DateTimeFieldsState::AMPMValue getAMPMFromFormControlState(const FormControlState& state, size_t index)
{
    if (index >= state.valueSize())
        return DateTimeFieldsState::AMPMValueEmpty;
    const String value = state[index];
    if (value == "A")
        return DateTimeFieldsState::AMPMValueAM;
    if (value == "P")
        return DateTimeFieldsState::AMPMValuePM;
    return DateTimeFieldsState::AMPMValueEmpty;
}
开发者ID:yoavweiss,项目名称:RespImg-WebKit,代码行数:11,代码来源:DateTimeFieldsState.cpp

示例5: restoreControlStateFor

void FormController::restoreControlStateFor(HTMLFormControlElementWithState& control)
{
    // We don't save state of a control with shouldSaveAndRestoreFormControlState()
    // == false. But we need to skip restoring process too because a control in
    // another form might have the same pair of name and type and saved its state.
    if (!control.shouldSaveAndRestoreFormControlState())
        return;
    if (ownerFormForState(control))
        return;
    FormControlState state = takeStateForFormElement(control);
    if (state.valueSize() > 0)
        control.restoreFormControlState(state);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:13,代码来源:FormController.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


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