Bug 1395725 - Don't add children of <area> as servo restyle root. r=emilio draft
authorXidorn Quan <me@upsuper.org>
Fri, 01 Sep 2017 15:20:41 +1000
changeset 657810 099a87c95a58d141f393f17ff27ae8f06a89d413
parent 657176 99b79910552854d2306f4d8896d8bf58737d06c6
child 729523 822971b6d4fa67f55e1e8e52b875b9edae58e7b2
push id77625
push userxquan@mozilla.com
push dateFri, 01 Sep 2017 23:52:09 +0000
reviewersemilio
bugs1395725
milestone57.0a1
Bug 1395725 - Don't add children of <area> as servo restyle root. r=emilio MozReview-Commit-ID: LI7Lv1aD3PJ
dom/base/Element.cpp
layout/style/crashtests/1395725.html
layout/style/crashtests/crashtests.list
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -4335,16 +4335,23 @@ NoteDirtyElement(Element* aElement, uint
     }
 
     // If the parent is styled but is display:none, we're done.
     //
     // We check for a frame to reduce the cases where we need the FFI call.
     if (!parent->GetPrimaryFrame() && Servo_Element_IsDisplayNone(parent)) {
       return;
     }
+
+    // The check above doesn't work for <area> element because <area> always
+    // have display:none, but before we fix bug 135040, it may have primary
+    // frame from <img>.
+    if (parent->IsHTMLElement(nsGkAtoms::area)) {
+      return;
+    }
   }
 
   nsIDocument* doc = aElement->GetComposedDoc();
   if (nsIPresShell* shell = doc->GetShell()) {
     shell->EnsureStyleFlush();
   }
 
   // If there's no existing restyle root, or if the root is already aElement,
new file mode 100644
--- /dev/null
+++ b/layout/style/crashtests/1395725.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABQCAYAAADvCdDvAAAAZElEQVR4nO3RQQ0AIBDAMPybBgu8YJe0DpatxbX9wO/GUQyJMSTGkBhDYgyJMSTGkBhDYgyJMSTGkBhDYgyJMSTGkBhDYgyJMSTGEAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAGQ4uFciajNXnVwAAAABJRU5ErkJggg==" usemap="#map">
+<map name="map"><area></map>
+<script>
+window.onload = () => {
+  let d = document.querySelector('area');
+  setTimeout(() => {
+    d.appendChild(document.createElement('div'));
+    document.body.offsetHeight;
+    document.documentElement.className = '';
+  }, 100);
+}
+</script>
+</html>
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -203,8 +203,9 @@ load 1386773.html
 load 1387481-1.html
 load 1387499.html
 load 1388234.html
 load 1391577.html
 load 1393189.html
 load 1393580.html
 load 1389645.html
 load 1393791.html
+load 1395725.html