本文整理汇总了C++中HTMLSelectElement::computedStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLSelectElement::computedStyle方法的具体用法?C++ HTMLSelectElement::computedStyle怎么用?C++ HTMLSelectElement::computedStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLSelectElement
的用法示例。
在下文中一共展示了HTMLSelectElement::computedStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}