Bug 1382568: Use the flattened tree instead of the DOM tree in IsOrHasAncestorWithDisplayNone. r?heycam
MozReview-Commit-ID: 334fnSSHN7Z
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -2974,17 +2974,19 @@ nsGenericHTMLElement::NewURIFromString(c
return NS_OK;
}
static bool
IsOrHasAncestorWithDisplayNone(Element* aElement, nsIPresShell* aPresShell)
{
AutoTArray<Element*, 10> elementsToCheck;
- for (Element* e = aElement; e; e = e->GetParentElement()) {
+ // Style and layout work on the flattened tree, so this is what we need to
+ // check in order to figure out whether we're in a display: none subtree.
+ for (Element* e = aElement; e; e = e->GetFlattenedTreeParentElement()) {
if (e->GetPrimaryFrame()) {
// e definitely isn't display:none and doesn't have a display:none
// ancestor.
break;
}
elementsToCheck.AppendElement(e);
}