Пример #1
0
void HTMLTextAreaElement::updatePlaceholderText()
{
    ExceptionCode ec = 0;
    String placeholderText = strippedPlaceholder();
    if (placeholderText.isEmpty()) {
        if (m_placeholder) {
            shadowTree()->oldestShadowRoot()->removeChild(m_placeholder.get(), ec);
            ASSERT(!ec);
            m_placeholder.clear();
        }
        return;
    }
    if (!m_placeholder) {
        m_placeholder = HTMLDivElement::create(document());
        m_placeholder->setShadowPseudoId("-webkit-input-placeholder");
        shadowTree()->oldestShadowRoot()->insertBefore(m_placeholder, shadowTree()->oldestShadowRoot()->firstChild()->nextSibling(), ec);
        ASSERT(!ec);
    }
    m_placeholder->setInnerText(placeholderText, ec);
    ASSERT(!ec);
}
Пример #2
0
void SVGTRefElement::updateReferencedText()
{
    String textContent;
    if (Element* target = SVGURIReference::targetElementFromIRIString(href(), document()))
        textContent = target->textContent();

    ASSERT(hasShadowRoot());
    ShadowRoot* root = shadowTree()->oldestShadowRoot();
    if (!root->firstChild())
        root->appendChild(SVGShadowText::create(document(), textContent), ASSERT_NO_EXCEPTION);
    else
        root->firstChild()->setTextContent(textContent, ASSERT_NO_EXCEPTION);
}
Пример #3
0
void SVGTRefElement::detachTarget()
{
    // Remove active listeners and clear the text content.
    clearEventListener();

    String emptyContent;
    ExceptionCode ignore = 0;

    ASSERT(hasShadowRoot());
    Node* container = shadowTree()->oldestShadowRoot()->firstChild();
    if (container)
        container->setTextContent(emptyContent, ignore);

    // Mark the referenced ID as pending.
    String id;
    SVGURIReference::targetElementFromIRIString(href(), document(), &id);
    if (!hasPendingResources() && !id.isEmpty())
        document()->accessSVGExtensions()->addPendingResource(id, this);
}
Пример #4
0
HTMLElement* HTMLTextAreaElement::innerTextElement() const
{
    Node* node = shadowTree()->oldestShadowRoot()->firstChild();
    ASSERT(!node || node->hasTagName(divTag));
    return toHTMLElement(node);
}