Exemplo n.º 1
0
void HTMLTextAreaElement::updatePlaceholderText()
{
    String placeholderText = strippedPlaceholder();
    if (placeholderText.isEmpty()) {
        if (m_placeholder) {
            userAgentShadowRoot()->removeChild(m_placeholder, ASSERT_NO_EXCEPTION);
            m_placeholder = 0;
        }
        return;
    }
    if (!m_placeholder) {
        RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
        m_placeholder = placeholder.get();
        m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
        userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling());
    }
    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
}
void HTMLTextAreaElement::updatePlaceholderText()
{
    HTMLElement* placeholder = placeholderElement();
    String placeholderText = strippedPlaceholder();
    if (placeholderText.isEmpty()) {
        if (placeholder)
            userAgentShadowRoot()->removeChild(placeholder);
        return;
    }
    if (!placeholder) {
        RefPtr<HTMLDivElement> newElement = HTMLDivElement::create(document());
        placeholder = newElement.get();
        placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
        placeholder->setAttribute(idAttr, ShadowElementNames::placeholder());
        userAgentShadowRoot()->insertBefore(placeholder, innerTextElement()->nextSibling());
    }
    placeholder->setTextContent(placeholderText, ASSERT_NO_EXCEPTION);
}
Exemplo n.º 3
0
void HTMLTextAreaElement::updatePlaceholderText()
{
    String placeholderText = strippedPlaceholder();
    if (placeholderText.isEmpty()) {
        if (m_placeholder) {
            userAgentShadowRoot()->removeChild(*m_placeholder, ASSERT_NO_EXCEPTION);
            m_placeholder = nullptr;
        }
        return;
    }
    if (!m_placeholder) {
        RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
        m_placeholder = placeholder.get();
        m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
        m_placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true);
        userAgentShadowRoot()->insertBefore(*m_placeholder, innerTextElement()->nextSibling());
    }
    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
}
Exemplo n.º 4
0
void HTMLTextAreaElement::updatePlaceholderText()
{
    ExceptionCode ec = 0;
    String placeholderText = strippedPlaceholder();
    if (placeholderText.isEmpty()) {
        if (m_placeholder) {
            shadow()->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");
        shadow()->oldestShadowRoot()->insertBefore(m_placeholder, shadow()->oldestShadowRoot()->firstChild()->nextSibling(), ec);
        ASSERT(!ec);
    }
    m_placeholder->setInnerText(placeholderText, ec);
    ASSERT(!ec);
}
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());
}