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


C++ HTMLSelectElement类代码示例

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


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

示例1: valueAttrGetter

static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLSelectElement.value._get");
    HTMLSelectElement* imp = V8HTMLSelectElement::toNative(info.Holder());
	if (!R_check(imp)) return v8::Handle<v8::Value>(v8::Undefined());
    return v8String(imp->value());
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:7,代码来源:V8HTMLSelectElement.cpp

示例2: INC_STATS

v8::Handle<v8::Value> V8HTMLSelectElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLSelectElement.NamedPropertyGetter");
    HTMLSelectElement* select = V8HTMLSelectElement::toNative(info.Holder());
    v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);

    if (!value.IsEmpty())
        return value;

    // Search local callback properties next to find IDL defined properties.
    if (info.Holder()->HasRealNamedCallbackProperty(name))
        return notHandledByInterceptor();

    PassRefPtr<HTMLOptionsCollection> collection = select->options();

    Vector<RefPtr<Node> > items;
    collection->namedItems(v8StringToAtomicWebCoreString(name), items);

    if (!items.size())
        return notHandledByInterceptor();

    if (items.size() == 1)
        return toV8(items.at(0).release());

    NodeList* list = new V8NamedNodesCollection(items);
    return toV8(list);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:27,代码来源:V8HTMLSelectElementCustom.cpp

示例3: TEST_F

TEST_F(HTMLSelectElementTest, LastSelectableOption)
{
    {
        document().documentElement()->setInnerHTML("<select></select>", ASSERT_NO_EXCEPTION);
        document().view()->updateAllLifecyclePhases();
        HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChild());
        EXPECT_EQ(nullptr, select->lastSelectableOption());
    }
    {
        document().documentElement()->setInnerHTML("<select><option id=o1></option><option id=o2></option></select>", ASSERT_NO_EXCEPTION);
        document().view()->updateAllLifecyclePhases();
        HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChild());
        EXPECT_EQ("o2", select->lastSelectableOption()->fastGetAttribute(HTMLNames::idAttr));
    }
    {
        document().documentElement()->setInnerHTML("<select><option id=o1></option><option id=o2 disabled></option></select>", ASSERT_NO_EXCEPTION);
        document().view()->updateAllLifecyclePhases();
        HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChild());
        EXPECT_EQ("o1", select->lastSelectableOption()->fastGetAttribute(HTMLNames::idAttr));
    }
    {
        document().documentElement()->setInnerHTML("<select><option id=o1></option><option id=o2 style='display:none'></option></select>", ASSERT_NO_EXCEPTION);
        document().view()->updateAllLifecyclePhases();
        HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChild());
        EXPECT_EQ("o1", select->lastSelectableOption()->fastGetAttribute(HTMLNames::idAttr));
    }
    {
        document().documentElement()->setInnerHTML("<select><optgroup><option id=o1></option><option id=o2></option></optgroup></select>", ASSERT_NO_EXCEPTION);
        document().view()->updateAllLifecyclePhases();
        HTMLSelectElement* select = toHTMLSelectElement(document().body()->firstChild());
        EXPECT_EQ("o2", select->lastSelectableOption()->fastGetAttribute(HTMLNames::idAttr));
    }
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:33,代码来源:HTMLSelectElementTest.cpp

示例4: namedItemCallback

static v8::Handle<v8::Value> namedItemCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.HTMLSelectElement.namedItem");
    HTMLSelectElement* imp = V8HTMLSelectElement::toNative(args.Holder());
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
    return toV8(imp->namedItem(name));
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:7,代码来源:V8HTMLSelectElement.cpp

示例5: ownerSelectElement

bool HTMLOptionElement::spatialNavigationFocused() const
{
    HTMLSelectElement* select = ownerSelectElement();
    if (!select || !select->focused())
        return false;
    return select->spatialNavigationFocusedOption() == this;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: ASSERT

void AXMenuListPopup::addChildren()
{
    ASSERT(!isDetached());
    if (!m_parent)
        return;

    Node* parentNode = m_parent->node();
    if (!isHTMLSelectElement(parentNode))
        return;

    HTMLSelectElement* htmlSelectElement = toHTMLSelectElement(parentNode);
    m_haveChildren = true;

    if (m_activeIndex == -1)
        m_activeIndex = getSelectedIndex();

    const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = htmlSelectElement->listItems();
    unsigned length = listItems.size();
    for (unsigned i = 0; i < length; i++) {
        AXMenuListOption* option = menuListOptionAXObject(listItems[i]);
        if (option) {
            option->setParent(this);
            m_children.append(option);
        }
    }
}
开发者ID:azureplus,项目名称:chromium,代码行数:26,代码来源:AXMenuListPopup.cpp

示例7: listBoxOptionParentNode

bool AXListBoxOption::isSelectedOptionActive() const {
  HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode();
  if (!listBoxParentNode)
    return false;

  return listBoxParentNode->activeSelectionEnd() == getNode();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例8: optionFromSelection

static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint index)
{
    // i is the ith selection as opposed to the ith child.

    AccessibilityObject* coreSelection = core(selection);
    if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0)
        return 0;

    AccessibilityObject::AccessibilityChildrenVector selectedItems;
    if (coreSelection->isListBox())
        coreSelection->selectedChildren(selectedItems);
    else if (coreSelection->isMenuList()) {
        RenderObject* renderer = coreSelection->renderer();
        if (!renderer)
            return 0;

        HTMLSelectElement* selectNode = toHTMLSelectElement(renderer->node());
        int selectedIndex = selectNode->selectedIndex();
        const Vector<HTMLElement*> listItems = selectNode->listItems();

        if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size()))
            return 0;

        return optionFromList(selection, selectedIndex);
    }

    if (index < static_cast<gint>(selectedItems.size()))
        return selectedItems.at(index).get();

    return 0;
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:31,代码来源:WebKitAccessibleInterfaceSelection.cpp

示例9: optionFromSelection

static AccessibilityObject* optionFromSelection(AtkSelection* selection, gint index)
{
    // i is the ith selection as opposed to the ith child.

    AccessibilityObject* coreSelection = core(selection);
    if (!coreSelection || !coreSelection->isAccessibilityRenderObject() || index < 0)
        return nullptr;

    int selectedIndex = index;
    if (coreSelection->isMenuList()) {
        RenderObject* renderer = coreSelection->renderer();
        if (!renderer)
            return nullptr;

        HTMLSelectElement* selectNode = downcast<HTMLSelectElement>(renderer->node());
        if (!selectNode)
            return nullptr;

        selectedIndex = selectNode->selectedIndex();
        const auto& listItems = selectNode->listItems();

        if (selectedIndex < 0 || selectedIndex >= static_cast<int>(listItems.size()))
            return nullptr;
    }

    return optionFromList(selection, selectedIndex);
}
开发者ID:ddxxyy,项目名称:webkit,代码行数:27,代码来源:WebKitAccessibleInterfaceSelection.cpp

示例10: selectElement

void LayoutListBox::stopAutoscroll()
{
    HTMLSelectElement* select = selectElement();
    if (select->isDisabledFormControl())
        return;
    select->handleMouseRelease();
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:7,代码来源:LayoutListBox.cpp

示例11: toHTMLSelectElement

void RenderListBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset)
{
    if (!isSpatialNavigationEnabled(frame()))
        return RenderBlock::addFocusRingRects(rects, additionalOffset);

    HTMLSelectElement* select = toHTMLSelectElement(node());

    // Focus the last selected item.
    int selectedItem = select->activeSelectionEndListIndex();
    if (selectedItem >= 0) {
        rects.append(itemBoundingBoxRect(additionalOffset, selectedItem));
        return;
    }

    // No selected items, find the first non-disabled item.
    int size = numItems();
    const Vector<HTMLElement*>& listItems = select->listItems();
    for (int i = 0; i < size; ++i) {
        HTMLElement* element = listItems[i];
        if (element->hasTagName(optionTag) && !toHTMLOptionElement(element)->disabled()) {
            rects.append(itemBoundingBoxRect(additionalOffset, i));
            return;
        }
    }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例12: ownerSelectElement

void HTMLOptGroupElement::accessKeyAction(bool)
{
    HTMLSelectElement* select = ownerSelectElement();
    // send to the parent to bring focus to the list box
    if (select && !select->focused())
        select->accessKeyAction(false);
}
开发者ID:fmalita,项目名称:webkit,代码行数:7,代码来源:HTMLOptGroupElement.cpp

示例13: TEST_F

TEST_F(ExternalPopupMenuTest, PopupAccountsForVisualViewportOffset)
{
    registerMockedURLLoad("select_mid_screen.html");
    loadFrame("select_mid_screen.html");

    webView()->resize(WebSize(100, 100));
    webView()->updateAllLifecyclePhases();

    HTMLSelectElement* select = toHTMLSelectElement(mainFrame()->frame()->document()->getElementById("select"));
    LayoutMenuList* menuList = toLayoutMenuList(select->layoutObject());
    ASSERT_TRUE(menuList);

    VisualViewport& visualViewport = webView()->page()->frameHost().visualViewport();

    IntRect rectInDocument = menuList->absoluteBoundingBoxRect();

    webView()->setPageScaleFactor(2);
    IntPoint scrollDelta(20, 30);
    visualViewport.move(scrollDelta);

    select->showPopup();

    EXPECT_EQ(rectInDocument.x() - scrollDelta.x(), client().shownBounds().x);
    EXPECT_EQ(rectInDocument.y() - scrollDelta.y(), client().shownBounds().y);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:25,代码来源:ExternalPopupMenuTest.cpp

示例14: createInnerBlock

void RenderMenuList::showPopup()
{
    if (m_popupIsVisible)
        return;

    if (document()->page()->chrome()->hasOpenedPopup())
        return;

    // Create m_innerBlock here so it ends up as the first child.
    // This is important because otherwise we might try to create m_innerBlock
    // inside the showPopup call and it would fail.
    createInnerBlock();
    if (!m_popup)
        m_popup = document()->page()->chrome()->createPopupMenu(this);
    m_popupIsVisible = true;

    // Compute the top left taking transforms into account, but use
    // the actual width of the element to size the popup.
    FloatPoint absTopLeft = localToAbsolute(FloatPoint(), false, true);
    IntRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
    int scale = document()->page()->settings()->defaultDeviceScaleFactor();
    if (scale && scale != 1)
        absBounds.scale(scale);
    absBounds.setLocation(roundedIntPoint(absTopLeft));
    HTMLSelectElement* select = toHTMLSelectElement(node());
    m_popup->show(absBounds, document()->view(), select->optionToListIndex(select->selectedIndex()));
}
开发者ID:Moondee,项目名称:Artemis,代码行数:27,代码来源:RenderMenuList.cpp

示例15: autofocusAttrGetter

static v8::Handle<v8::Value> autofocusAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLSelectElement.autofocus._get");
    HTMLSelectElement* imp = V8HTMLSelectElement::toNative(info.Holder());
	if (!R_check(imp)) return v8::Handle<v8::Value>(v8::Undefined());
    return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::autofocusAttr));
}
开发者ID:Treeeater,项目名称:chrome_bindings,代码行数:7,代码来源:V8HTMLSelectElement.cpp


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