void HTMLTextFormControlElement::updatePlaceholderVisibility(bool placeholderValueChanged) { if (!supportsPlaceholder()) return; if (!placeholderElement() || placeholderValueChanged) updatePlaceholderText(); HTMLElement* placeholder = placeholderElement(); if (!placeholder) return; placeholder->setInlineStyleProperty(CSSPropertyVisibility, placeholderShouldBeVisible() ? "visible" : "hidden"); }
void HTMLTextFormControlElement::updatePlaceholderVisibility(bool placeholderValueChanged) { if (!supportsPlaceholder()) return; if (!placeholderElement() || placeholderValueChanged) updatePlaceholderText(); HTMLElement* placeholder = placeholderElement(); if (!placeholder) return; ExceptionCode ec = 0; placeholder->ensureInlineStyleDecl()->setProperty(CSSPropertyVisibility, placeholderShouldBeVisible() ? "visible" : "hidden", ec); ASSERT(!ec); }
void HTMLTextFormControlElement::hidePlaceholder() { if (!supportsPlaceholder()) return; HTMLElement* placeholder = placeholderElement(); if (!placeholder) { updatePlaceholderText(); return; } placeholder->setInlineStyleProperty(CSSPropertyVisibility, ASCIILiteral("hidden")); }
void HTMLTextFormControlElement::updatePlaceholderVisibility() { bool placeHolderWasVisible = m_isPlaceholderVisible; m_isPlaceholderVisible = placeholderShouldBeVisible(); if (placeHolderWasVisible == m_isPlaceholderVisible) return; setNeedsStyleRecalc(); if (HTMLElement* placeholder = placeholderElement()) placeholder->setInlineStyleProperty(CSSPropertyDisplay, m_isPlaceholderVisible ? CSSValueBlock : CSSValueNone, true); }
void HTMLTextFormControlElement::updatePlaceholderVisibility() { HTMLElement* placeholder = placeholderElement(); if (!placeholder) { updatePlaceholderText(); return; } bool placeHolderWasVisible = isPlaceholderVisible(); setPlaceholderVisibility(placeholderShouldBeVisible()); if (placeHolderWasVisible == isPlaceholderVisible()) return; pseudoStateChanged(CSSSelector::PseudoPlaceholderShown); placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true); }
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); }
void HTMLTextAreaElement::updatePlaceholderText() { HTMLElement* placeholder = placeholderElement(); const AtomicString& placeholderText = fastGetAttribute(placeholderAttr); if (placeholderText.isEmpty()) { if (placeholder) userAgentShadowRoot()->removeChild(placeholder); return; } if (!placeholder) { RefPtrWillBeRawPtr<HTMLDivElement> newElement = HTMLDivElement::create(document()); placeholder = newElement.get(); placeholder->setShadowPseudoId(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral)); placeholder->setAttribute(idAttr, ShadowElementNames::placeholder()); userAgentShadowRoot()->insertBefore(placeholder, innerEditorElement()->nextSibling()); } placeholder->setTextContent(placeholderText); }
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 HTMLTextFormControlElement::showPlaceholderIfNecessary() { if (HTMLElement* placeholder = placeholderElement()) placeholder->setInlineStyleProperty(CSSPropertyVisibility, CSSValueVisible, true); }
void HTMLTextFormControlElement::hidePlaceholder() { if (HTMLElement* placeholder = placeholderElement()) placeholder->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidden, true); }