Bug 1315889 - stylo: don't try to restyle elements that have been removed from the document. r=emilio

MozReview-Commit-ID: EiFS1KAKAj6
This commit is contained in:
Cameron McCormack 2016-11-08 16:24:34 +08:00
Родитель 1b5c96f9f7
Коммит ff10ad8bc2
3 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -366,6 +366,15 @@ ServoRestyleManager::ProcessPendingRestyles()
ServoElementSnapshot* snapshot = iter.UserData();
Element* element = iter.Key();
// The element is no longer in the document, so don't bother computing
// a final restyle hint for it.
//
// XXXheycam RestyleTracker checks that the element's GetComposedDoc()
// matches the document we're restyling. Do we need to do that too?
if (!element->IsInComposedDoc()) {
continue;
}
// TODO: avoid the ComputeRestyleHint call if we already have the highest
// explicit restyle hint?
nsRestyleHint hint = styleSet->ComputeRestyleHint(element, snapshot);

Просмотреть файл

@ -0,0 +1,12 @@
<!DOCTYPE html>
<style>
.x { color: blue; }
</style>
<div class=x>hello</div>
<script>
document.body.offsetWidth;
var x = document.querySelector(".x");
x.className = "";
x.remove();
document.body.offsetWidth;
</script>

Просмотреть файл

@ -160,4 +160,5 @@ pref(dom.animations-api.core.enabled,true) load 1290994-2.html
pref(dom.animations-api.core.enabled,true) load 1290994-3.html
load 1290994-4.html
load 1314531.html
load 1315889-1.html
load 1315894-1.html