本文整理汇总了C++中HTMLSelectElement::itemIsDisplayNone方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLSelectElement::itemIsDisplayNone方法的具体用法?C++ HTMLSelectElement::itemIsDisplayNone怎么用?C++ HTMLSelectElement::itemIsDisplayNone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLSelectElement
的用法示例。
在下文中一共展示了HTMLSelectElement::itemIsDisplayNone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toPopupMenuItemIndex
int ExternalPopupMenu::toPopupMenuItemIndex(int externalPopupMenuItemIndex, HTMLSelectElement& ownerElement)
{
if (externalPopupMenuItemIndex < 0)
return externalPopupMenuItemIndex;
int indexTracker = 0;
const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = ownerElement.listItems();
for (int i = 0; i < static_cast<int>(items.size()); ++i) {
if (ownerElement.itemIsDisplayNone(*items[i]))
continue;
if (indexTracker++ == externalPopupMenuItemIndex)
return i;
}
return -1;
}
示例2: getPopupMenuInfo
void ExternalPopupMenu::getPopupMenuInfo(WebPopupMenuInfo& info, HTMLSelectElement& ownerElement)
{
const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = ownerElement.listItems();
size_t itemCount = listItems.size();
size_t count = 0;
Vector<WebMenuItemInfo> items(itemCount);
for (size_t i = 0; i < itemCount; ++i) {
if (ownerElement.itemIsDisplayNone(*listItems[i]))
continue;
Element& itemElement = *listItems[i];
WebMenuItemInfo& popupItem = items[count++];
popupItem.label = ownerElement.itemText(itemElement);
popupItem.toolTip = itemElement.title();
popupItem.checked = false;
if (isHTMLHRElement(itemElement)) {
popupItem.type = WebMenuItemInfo::Separator;
} else if (isHTMLOptGroupElement(itemElement)) {
popupItem.type = WebMenuItemInfo::Group;
} else {
popupItem.type = WebMenuItemInfo::Option;
popupItem.checked = toHTMLOptionElement(itemElement).selected();
}
popupItem.enabled = !itemElement.isDisabledFormControl();
const ComputedStyle& style = *ownerElement.itemComputedStyle(itemElement);
popupItem.textDirection = toWebTextDirection(style.direction());
popupItem.hasTextDirectionOverride = isOverride(style.unicodeBidi());
}
const ComputedStyle& menuStyle = ownerElement.computedStyle() ? *ownerElement.computedStyle() : *ownerElement.ensureComputedStyle();
info.itemHeight = menuStyle.font().fontMetrics().height();
info.itemFontSize = static_cast<int>(menuStyle.font().fontDescription().computedSize());
info.selectedIndex = toExternalPopupMenuItemIndex(ownerElement.optionToListIndex(ownerElement.selectedIndex()), ownerElement);
info.rightAligned = menuStyle.direction() == RTL;
info.allowMultipleSelection = ownerElement.multiple();
if (count < itemCount)
items.shrink(count);
info.items = items;
}