本文整理汇总了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());
}
示例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);
}
示例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));
}
}
示例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));
}
示例5: ownerSelectElement
bool HTMLOptionElement::spatialNavigationFocused() const
{
HTMLSelectElement* select = ownerSelectElement();
if (!select || !select->focused())
return false;
return select->spatialNavigationFocusedOption() == this;
}
示例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);
}
}
}
示例7: listBoxOptionParentNode
bool AXListBoxOption::isSelectedOptionActive() const {
HTMLSelectElement* listBoxParentNode = listBoxOptionParentNode();
if (!listBoxParentNode)
return false;
return listBoxParentNode->activeSelectionEnd() == getNode();
}
示例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;
}
示例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);
}
示例10: selectElement
void LayoutListBox::stopAutoscroll()
{
HTMLSelectElement* select = selectElement();
if (select->isDisabledFormControl())
return;
select->handleMouseRelease();
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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()));
}
示例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));
}