mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Set AncestorHasDirAuto on descendants of a node being bound to an element with HasDirAuto or AncestorHasDirAuto. Bug 827190, r=ehsan
This commit is contained in:
parent
ae5048a875
commit
32d311ff83
@ -904,10 +904,26 @@ SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent)
|
||||
aParent && aParent->NodeOrAncestorHasDirAuto()) {
|
||||
aElement->SetAncestorHasDirAuto();
|
||||
|
||||
// if we are binding an element to the tree that already has descendants,
|
||||
// and the parent has NodeHasDirAuto or NodeAncestorHasDirAuto, we may
|
||||
// need to reset the direction of an ancestor with dir=auto
|
||||
if (aElement->GetFirstChild()) {
|
||||
nsIContent* child = aElement->GetFirstChild();
|
||||
if (child) {
|
||||
// If we are binding an element to the tree that already has descendants,
|
||||
// and the parent has NodeHasDirAuto or NodeAncestorHasDirAuto, we need
|
||||
// to set NodeAncestorHasDirAuto on all the element's descendants, except
|
||||
// for nodes that don't affect the direction of their ancestors.
|
||||
do {
|
||||
if (child->IsElement() &&
|
||||
(DoesNotParticipateInAutoDirection(child->AsElement()) ||
|
||||
child->NodeInfo()->Equals(nsGkAtoms::bdi) ||
|
||||
child->HasFixedDir())) {
|
||||
child = child->GetNextNonChildNode(aElement);
|
||||
continue;
|
||||
}
|
||||
|
||||
child->SetAncestorHasDirAuto();
|
||||
child = child->GetNextNode(aElement);
|
||||
} while (child);
|
||||
|
||||
// We may also need to reset the direction of an ancestor with dir=auto
|
||||
WalkAncestorsResetAutoDirection(aElement, true);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user