Set AncestorHasDirAuto on the descendants of a <bdi> having its dir attribute removed or set to an invalid value. Bug 849732, r=ehsan

This commit is contained in:
Simon Montagu 2013-03-24 11:27:03 +02:00
parent dc0b05a650
commit 9e9cb640e2

View File

@ -663,8 +663,13 @@ WalkDescendantsResetAutoDirection(Element* aElement)
void
WalkDescendantsSetDirAuto(Element* aElement, bool aNotify)
{
if (!DoesNotParticipateInAutoDirection(aElement) &&
!IsBdiWithoutDirAuto(aElement)) {
// Only test for DoesNotParticipateInAutoDirection -- in other words, if
// aElement is a <bdi> which is having its dir attribute set to auto (or
// removed or set to an invalid value, which are equivalent to dir=auto for
// <bdi>, we *do* want to set AncestorHasDirAuto on its descendants, unlike
// in SetDirOnBind where we don't propagate AncestorHasDirAuto to a <bdi>
// being bound to an existing node with dir=auto.
if (!DoesNotParticipateInAutoDirection(aElement)) {
bool setAncestorDirAutoFlag =
#ifdef DEBUG
@ -685,7 +690,7 @@ WalkDescendantsSetDirAuto(Element* aElement, bool aNotify)
MOZ_ASSERT(!aElement->AncestorHasDirAuto() ||
child->AncestorHasDirAuto(),
"AncestorHasDirAuto set on node but not its children");
child->SetHasDirAuto();
child->SetAncestorHasDirAuto();
child = child->GetNextNode(aElement);
}
}