Element* HTMLDetailsElement::findMainSummary() const { if (HTMLSummaryElement* summary = Traversal<HTMLSummaryElement>::firstChild(*this)) return summary; HTMLContentElement* content = toHTMLContentElement(closedShadowRoot()->firstChild()); ASSERT(content->firstChild() && isHTMLSummaryElement(*content->firstChild())); return toElement(content->firstChild()); }
Element* HTMLDetailsElement::findMainSummary() const { for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) { if (child->hasTagName(summaryTag)) return child; } HTMLContentElement* content = toHTMLContentElement(userAgentShadowRoot()->firstChild()); ASSERT(content->firstChild() && content->firstChild()->hasTagName(summaryTag)); return toElement(content->firstChild()); }
NodeRenderingContext::NodeRenderingContext(Node* node) : m_location(LocationNotInTree) , m_phase(AttachStraight) , m_node(node) , m_parentNodeForRenderingAndStyle(0) , m_visualParentShadowRoot(0) , m_includer(0) , m_style(0) , m_parentFlowRenderer(0) { ContainerNode* parent = m_node->parentOrHostNode(); if (!parent) return; if (parent->isShadowRoot()) { m_location = LocationShadowChild; m_parentNodeForRenderingAndStyle = parent->shadowHost(); return; } m_location = LocationLightChild; if (parent->isElementNode()) { m_visualParentShadowRoot = toElement(parent)->shadowRoot(); if (m_visualParentShadowRoot) { if ((m_includer = m_visualParentShadowRoot->includerFor(m_node)) && m_visualParentShadowRoot->isInclusionSelectorActive()) { m_phase = AttachContentForwarded; m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_includer).parentNodeForRenderingAndStyle(); return; } m_phase = AttachContentLight; m_parentNodeForRenderingAndStyle = parent; return; } if (parent->isContentElement()) { HTMLContentElement* shadowContentElement = toHTMLContentElement(parent); if (!shadowContentElement->hasInclusion()) { m_phase = AttachContentFallback; m_parentNodeForRenderingAndStyle = NodeRenderingContext(parent).parentNodeForRenderingAndStyle(); return; } } } m_parentNodeForRenderingAndStyle = parent; }
void HTMLOptGroupElement::didAddUserAgentShadowRoot(ShadowRoot& root) { DEFINE_STATIC_LOCAL(AtomicString, labelPadding, ("0 2px 1px 2px")); DEFINE_STATIC_LOCAL(AtomicString, labelMinHeight, ("1.2em")); HTMLDivElement* label = HTMLDivElement::create(document()); label->setAttribute(roleAttr, AtomicString("group")); label->setAttribute(aria_labelAttr, AtomicString()); label->setInlineStyleProperty(CSSPropertyPadding, labelPadding); label->setInlineStyleProperty(CSSPropertyMinHeight, labelMinHeight); label->setIdAttribute(ShadowElementNames::optGroupLabel()); root.appendChild(label); HTMLContentElement* content = HTMLContentElement::create(document()); content->setAttribute(selectAttr, "option,hr"); root.appendChild(content); }