Bug 1382568: Use the flattened tree instead of the DOM tree in IsOrHasAncestorWithDisplayNone. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 30 Jul 2017 04:14:32 +0200
changeset 420550 30e92e587ea6f23e779bc812cccacb377c8090b6
parent 420549 874935d5a813753c2c2a6358415e0d99d21fa953
child 420551 4e25a724b1d42d2e6f2f3eebe2d62a5895774e53
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1382568
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382568: Use the flattened tree instead of the DOM tree in IsOrHasAncestorWithDisplayNone. r=heycam MozReview-Commit-ID: 334fnSSHN7Z
dom/html/nsGenericHTMLElement.cpp
--- 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);
   }