void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Element* beforeChange, ChildChangeType changeType) { // FIXME: This function looks suspicious. if (document().renderView() && (changeType == ElementRemoved || changeType == TextRemoved)) { Node* node = beforeChange ? beforeChange->nextSibling() : 0; for (; node; node = node->nextSibling()) { if (elementAffectsDirectionality(node)) continue; setHasDirAutoFlagRecursively(node, false); } } if (!selfOrAncestorHasDirAutoAttribute()) return; Node* oldMarkedNode = 0; if (beforeChange) oldMarkedNode = changeType == ElementInserted ? ElementTraversal::nextSibling(beforeChange) : beforeChange->nextSibling(); while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) oldMarkedNode = oldMarkedNode->nextSibling(); if (oldMarkedNode) setHasDirAutoFlagRecursively(oldMarkedNode, false); auto lineage = lineageOfType<HTMLElement>(this); for (auto elementToAdjust = lineage.begin(), end = lineage.end(); elementToAdjust != end; ++elementToAdjust) { if (elementAffectsDirectionality(&*elementToAdjust)) { elementToAdjust->calculateAndAdjustDirectionality(); return; } } }
void HTMLTextAreaElement::subtreeHasChanged() { #if DCHECK_IS_ON() // The innerEditor should have either Text nodes or a placeholder break // element. If we see other nodes, it's a bug in editing code and we should // fix it. Element* innerEditor = innerEditorElement(); for (Node& node : NodeTraversal::descendantsOf(*innerEditor)) { if (node.isTextNode()) continue; DCHECK(isHTMLBRElement(node)); DCHECK_EQ(&node, innerEditor->lastChild()); } #endif addPlaceholderBreakElementIfNecessary(); setChangedSinceLastFormControlChangeEvent(true); m_valueIsUpToDate = false; setNeedsValidityCheck(); setAutofilled(false); updatePlaceholderVisibility(); if (!isFocused()) return; // When typing in a textarea, childrenChanged is not called, so we need to // force the directionality check. calculateAndAdjustDirectionality(); DCHECK(document().isActive()); document().frameHost()->chromeClient().didChangeValueInTextField(*this); }
void HTMLElement::dirAttributeChanged(const AtomicString& value) { Element* parent = parentElement(); if (parent && parent->isHTMLElement() && parent->selfOrAncestorHasDirAutoAttribute()) toHTMLElement(parent)->adjustDirectionalityIfNeededAfterChildAttributeChanged(this); if (equalIgnoringCase(value, "auto")) calculateAndAdjustDirectionality(); }
void HTMLElement::dirAttributeChanged(const AtomicString& value) { // If an ancestor has dir=auto, and this node has the first character, // changes to dir attribute may affect the ancestor. updateDistribution(); Element* parent = ComposedTreeTraversal::parentElement(*this); if (parent && parent->isHTMLElement() && toHTMLElement(parent)->selfOrAncestorHasDirAutoAttribute()) toHTMLElement(parent)->adjustDirectionalityIfNeededAfterChildAttributeChanged(this); if (equalIgnoringCase(value, "auto")) calculateAndAdjustDirectionality(); }
void HTMLTextAreaElement::subtreeHasChanged() { setChangedSinceLastFormControlChangeEvent(true); setFormControlValueMatchesRenderer(false); setNeedsValidityCheck(); if (!focused()) return; // When typing in a textarea, childrenChanged is not called, so we need to force the directionality check. calculateAndAdjustDirectionality(); }
void HTMLTextAreaElement::subtreeHasChanged() { setChangedSinceLastFormControlChangeEvent(true); setFormControlValueMatchesRenderer(false); updateValidity(); if (!focused()) return; if (Frame* frame = document().frame()) frame->editor().textDidChangeInTextArea(this); // When typing in a textarea, childrenChanged is not called, so we need to force the directionality check. calculateAndAdjustDirectionality(); }
void HTMLTextAreaElement::subtreeHasChanged() { setChangedSinceLastFormControlChangeEvent(true); m_valueIsUpToDate = false; setNeedsValidityCheck(); setAutofilled(false); if (!focused()) return; // When typing in a textarea, childrenChanged is not called, so we need to force the directionality check. calculateAndAdjustDirectionality(); ASSERT(document().isActive()); document().frameHost()->chrome().client().didChangeValueInTextField(*this); }