void PopupMenuImpl::addSeparator(HTMLHRElement& element, bool enableExtraStyling, SharedBuffer* data) { PagePopupClient::addString("{\n", data); PagePopupClient::addString("type: \"separator\",\n", data); addProperty("title", element.title(), data); addProperty("ariaLabel", element.fastGetAttribute(HTMLNames::aria_labelAttr), data); addProperty("disabled", element.isDisabledFormControl(), data); addElementStyle(element, enableExtraStyling, data); PagePopupClient::addString("},\n", data); }
void PopupMenuImpl::addSeparator(ItemIterationContext& context, HTMLHRElement& element) { SharedBuffer* data = context.m_buffer; PagePopupClient::addString("{\n", data); PagePopupClient::addString("type: \"separator\",\n", data); addProperty("title", element.title(), data); addProperty("ariaLabel", element.fastGetAttribute(HTMLNames::aria_labelAttr), data); addProperty("disabled", element.isDisabledFormControl(), data); addElementStyle(context, element); PagePopupClient::addString("},\n", data); }
void PopupMenuImpl::addOption(HTMLOptionElement& element, bool enableExtraStyling, SharedBuffer* data) { PagePopupClient::addString("{\n", data); PagePopupClient::addString("type: \"option\",\n", data); addProperty("label", element.text(), data); addProperty("title", element.title(), data); addProperty("value", element.listIndex(), data); addProperty("ariaLabel", element.fastGetAttribute(HTMLNames::aria_labelAttr), data); addProperty("disabled", element.isDisabledFormControl(), data); addElementStyle(element, enableExtraStyling, data); PagePopupClient::addString("},\n", data); }
void PopupMenuImpl::addOptGroup(ItemIterationContext& context, HTMLOptGroupElement& element) { SharedBuffer* data = context.m_buffer; PagePopupClient::addString("{\n", data); PagePopupClient::addString("type: \"optgroup\",\n", data); addProperty("label", element.groupLabelText(), data); addProperty("title", element.title(), data); addProperty("ariaLabel", element.fastGetAttribute(HTMLNames::aria_labelAttr), data); addProperty("disabled", element.isDisabledFormControl(), data); addElementStyle(context, element); context.startGroupChildren(*m_ownerElement->itemComputedStyle(element)); // We should call ItemIterationContext::finishGroupIfNecessary() later. }
void PopupMenuImpl::addOption(ItemIterationContext& context, HTMLOptionElement& element) { SharedBuffer* data = context.m_buffer; PagePopupClient::addString("{", data); addProperty("label", element.displayLabel(), data); addProperty("value", context.m_listIndex, data); if (!element.title().isEmpty()) addProperty("title", element.title(), data); const AtomicString& ariaLabel = element.fastGetAttribute(HTMLNames::aria_labelAttr); if (!ariaLabel.isEmpty()) addProperty("ariaLabel", ariaLabel, data); if (element.isDisabledFormControl()) addProperty("disabled", true, data); addElementStyle(context, element); PagePopupClient::addString("},", data); }
void PopupMenuImpl::addOptGroup(HTMLOptGroupElement& element, bool enableExtraStyling, SharedBuffer* data) { PagePopupClient::addString("{\n", data); PagePopupClient::addString("type: \"optgroup\",\n", data); addProperty("label", element.groupLabelText(), data); addProperty("title", element.title(), data); addProperty("ariaLabel", element.fastGetAttribute(HTMLNames::aria_labelAttr), data); addProperty("disabled", element.isDisabledFormControl(), data); addElementStyle(element, enableExtraStyling, data); PagePopupClient::addString("children: [", data); for (HTMLElement& child : Traversal<HTMLElement>::childrenOf(element)) { if (isHTMLOptionElement(child)) addOption(toHTMLOptionElement(child), enableExtraStyling, data); if (isHTMLOptGroupElement(child)) addOptGroup(toHTMLOptGroupElement(child), enableExtraStyling, data); if (isHTMLHRElement(child)) addSeparator(toHTMLHRElement(child), enableExtraStyling, data); } PagePopupClient::addString("],\n", data); PagePopupClient::addString("},\n", data); }
void PopupMenuImpl::addOptGroup(ItemIterationContext& context, HTMLOptGroupElement& element) { SharedBuffer* data = context.m_buffer; ++context.m_listIndex; PagePopupClient::addString("{\n", data); PagePopupClient::addString("type: \"optgroup\",\n", data); addProperty("label", element.groupLabelText(), data); addProperty("title", element.title(), data); addProperty("ariaLabel", element.fastGetAttribute(HTMLNames::aria_labelAttr), data); addProperty("disabled", element.isDisabledFormControl(), data); addElementStyle(context, element); PagePopupClient::addString("children: [", data); for (HTMLElement& child : Traversal<HTMLElement>::childrenOf(element)) { if (isHTMLOptionElement(child)) addOption(context, toHTMLOptionElement(child)); // TODO(tkent): Ignore nested OPTGROUP. crbug.com/502101. if (isHTMLOptGroupElement(child)) addOptGroup(context, toHTMLOptGroupElement(child)); if (isHTMLHRElement(child)) addSeparator(context, toHTMLHRElement(child)); } PagePopupClient::addString("],\n", data); PagePopupClient::addString("},\n", data); }