$OpenBSD$ index 41fb634..45332d4 100644 --- content/base/src/nsGenericDOMDataNode.cpp.orig Fri Feb 20 15:40:36 2015 +++ content/base/src/nsGenericDOMDataNode.cpp Fri Feb 20 15:40:36 2015 @@ -315,9 +315,9 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount, nsNodeUtils::CharacterDataWillChange(this, &info); } - if (NodeType() == nsIDOMNode::TEXT_NODE) { - SetDirectionFromChangedTextNode(this, aOffset, aBuffer, aLength, aNotify); - } + Directionality oldDir = eDir_NotSet; + bool dirAffectsAncestor = (NodeType() == nsIDOMNode::TEXT_NODE && + TextNodeWillChangeDirection(this, &oldDir, aOffset)); if (aOffset == 0 && endOffset == textLength) { // Replacing whole text or old text was empty. Don't bother to check for @@ -364,6 +364,10 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount, document->SetBidiEnabled(); } + if (dirAffectsAncestor) { + TextNodeChangedDirection(this, oldDir, aNotify); + } + // Notify observers if (aNotify) { CharacterDataChangeInfo info = {