void HTMLTextFormControlElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == placeholderAttr) { updatePlaceholderText(); updatePlaceholderVisibility(); } else HTMLFormControlElementWithState::parseAttribute(name, value); }
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::hidePlaceholder() { if (!supportsPlaceholder()) return; HTMLElement* placeholder = placeholderElement(); if (!placeholder) { updatePlaceholderText(); return; } placeholder->setInlineStyleProperty(CSSPropertyVisibility, ASCIILiteral("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::parseAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& value) { if (name == autocapitalizeAttr) UseCounter::count(document(), UseCounter::AutocapitalizeAttribute); if (name == placeholderAttr) { updatePlaceholderText(); updatePlaceholderVisibility(); UseCounter::count(document(), UseCounter::PlaceholderAttribute); } else { HTMLFormControlElementWithState::parseAttribute(name, oldValue, value); } }
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); }