Bug 1395725 - Don't add children of <area> as servo restyle root. r=emilio
MozReview-Commit-ID: LI7Lv1aD3PJ
--- 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