Bug 1289970, ensure we don't remove valid Directionality map from textnode, r=ehsan

--HG--
extra : rebase_source : 5d784d52125daf4725cad0f0cf9fe03a8d47577a
This commit is contained in:
Olli Pettay 2016-08-11 02:54:55 +03:00
Родитель a742ff6791
Коммит ad6d094330
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -511,6 +511,12 @@ private:
oldTextNode);
}
if (newTextNode) {
nsINode* oldDirAutoSetBy =
static_cast<nsTextNode*>(rootNode->GetProperty(nsGkAtoms::dirAutoSetBy));
if (oldDirAutoSetBy == newTextNode) {
// We're already registered.
return OpNext;
}
nsTextNodeDirectionalityMap::AddEntryToMap(newTextNode, rootNode);
} else {
rootNode->ClearHasDirAutoSet();
@ -684,7 +690,9 @@ WalkDescendantsResetAutoDirection(Element* aElement)
if (child->NodeType() == nsIDOMNode::TEXT_NODE &&
child->HasTextNodeDirectionalityMap()) {
nsTextNodeDirectionalityMap::ResetTextNodeDirection(static_cast<nsTextNode*>(child), nullptr);
nsTextNodeDirectionalityMap::EnsureMapIsClearFor(child);
// Don't call nsTextNodeDirectionalityMap::EnsureMapIsClearFor(child)
// since ResetTextNodeDirection may have kept elements in child's
// DirectionalityMap.
}
child = child->GetNextNode(aElement);
}