Bug 1089463 - Clear an element's restyle bits when inserting into a shadow tree. r=bzbarsky

This commit is contained in:
Cameron McCormack 2014-11-15 09:08:21 +11:00
Родитель 87e1d173f4
Коммит 2c2626a679
3 изменённых файлов: 32 добавлений и 1 удалений

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

@ -1469,7 +1469,17 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES |
// And the restyle bits
ELEMENT_ALL_RESTYLE_FLAGS);
} else if (!IsInShadowTree()) {
} else if (IsInShadowTree()) {
// We're not in a document, but we did get inserted into a shadow tree.
// Since we won't have any restyle data in the document's restyle trackers,
// don't let us get inserted with restyle bits set incorrectly.
//
// Also clear all the other flags that are cleared above when we do get
// inserted into a document.
UnsetFlags(NODE_FORCE_XBL_BINDINGS |
NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES |
ELEMENT_ALL_RESTYLE_FLAGS);
} else {
// If we're not in the doc and not in a shadow tree,
// update our subtree pointer.
SetSubtreeRootPointer(aParent->SubtreeRoot());

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<div></div>
<script>
window.onload = function() {
var div = document.querySelector("div");
var shadow = div.createShadowRoot();
shadow.innerHTML = "<p style='display: none'><span><i>x</i></span></p>";
var p = shadow.lastChild;
var span = p.firstChild;
var i = span.firstChild;
span.style.color = 'blue';
p.remove();
document.body.offsetTop;
shadow.appendChild(p);
i.style.color = 'red';
};
</script>

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

@ -109,5 +109,6 @@ pref(dom.webcomponents.enabled,true) load 1017798-1.html
load 1028514-1.html
load 1066089-1.html
load 1074651-1.html
pref(dom.webcomponents.enabled,true) load 1089463-1.html
load large_border_image_width.html
load border-image-visited-link.html