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()); }
void HTMLTextAreaElement::updatePlaceholderText() { HTMLElement* placeholder = placeholderElement(); const AtomicString& placeholderText = fastGetAttribute(placeholderAttr); if (placeholderText.isEmpty()) { if (placeholder) userAgentShadowRoot()->removeChild(placeholder); return; } if (!placeholder) { HTMLDivElement* newElement = HTMLDivElement::create(document()); placeholder = newElement; placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder")); placeholder->setAttribute(idAttr, ShadowElementNames::placeholder()); placeholder->setInlineStyleProperty( CSSPropertyDisplay, isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true); userAgentShadowRoot()->insertBefore(placeholder, innerEditorElement()); } placeholder->setTextContent(placeholderText); }
void HTMLTextAreaElement::updatePlaceholderText() { ExceptionCode ec = 0; String placeholderText = strippedPlaceholder(); if (placeholderText.isEmpty()) { if (m_placeholder) { userAgentShadowRoot()->removeChild(m_placeholder, ec); ASSERT(!ec); m_placeholder = 0; } return; } if (!m_placeholder) { RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); m_placeholder = placeholder.get(); m_placeholder->setShadowPseudoId("-webkit-input-placeholder"); userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling(), ec); ASSERT(!ec); } m_placeholder->setInnerText(placeholderText, ec); ASSERT(!ec); fixPlaceholderRenderer(m_placeholder, innerTextElement()); }
void HTMLPlugInImageElement::checkSnapshotStatus() { if (!renderer()->isSnapshottedPlugIn()) { if (displayState() == Playing) checkSizeChangeForSnapshotting(); return; } ShadowRoot* root = userAgentShadowRoot(); if (!root) return; Element* shadowContainer = toElement(root->firstChild()); shadowContainer->setAttribute(classAttr, classNameForShadowRoot(this)); }
SVGGraphicsElement* SVGUseElement::targetGraphicsElementForClipping() const { Node* n = userAgentShadowRoot()->firstChild(); if (!n || !n->isSVGElement()) return nullptr; SVGElement& element = toSVGElement(*n); if (!element.isSVGGraphicsElement()) return nullptr; // Spec: "If a <use> element is a child of a clipPath element, it must directly // reference <path>, <text> or basic shapes elements. Indirect references are an // error and the clipPath element must be ignored." // http://dev.w3.org/fxtf/css-masking-1/#the-clip-path if (!isDirectReference(element)) { // Spec: Indirect references are an error (14.3.5) document().accessSVGExtensions().reportError("Not allowed to use indirect reference in <clip-path>"); return nullptr; } return &toSVGGraphicsElement(element); }
TextControlInnerTextElement* HTMLTextAreaElement::innerTextElement() const { Node* node = userAgentShadowRoot()->firstChild(); return toTextControlInnerTextElement(node); }
HTMLElement* HTMLTextFormControlElement::innerTextElement() const { return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementNames::innerEditor())); }
HTMLElement* HTMLTextFormControlElement::placeholderElement() const { return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementNames::placeholder())); }
HTMLElement* HTMLTextAreaElement::innerTextElement() const { Node* node = userAgentShadowRoot()->firstChild(); ASSERT(!node || node->hasTagName(divTag)); return toHTMLElement(node); }