Bug 514300 part 2. Make nsBindingManager::ContentRemoved remove the node from all the places it needs to be removed from. Also fixes bug 415301 and bug 495354. r=sicking

This commit is contained in:
Boris Zbarsky 2010-01-13 11:30:11 -05:00
Родитель bbbe659e65
Коммит f41f7ddf72
7 изменённых файлов: 85 добавлений и 0 удалений

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

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="boom();">
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="chil"><content><children/></content></binding>
<binding id="ichil"><content>
<xul:hbox style="-moz-binding: url(#chil)"><children/></xul:hbox>
</content></binding>
</bindings>
<script type="text/javascript">
function boom()
{
document.getElementById("inner").removeChild(document.getElementById("lbb"));
document.getElementById("outer").style.MozBinding = "";
}
</script>
<hbox id="outer" style="-moz-binding: url(#chil)"><hbox id="inner" style="-moz-binding: url(#ichil)"><listboxbody id="lbb" /></hbox></hbox>
</window>

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

@ -0,0 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<bindings xmlns="http://www.mozilla.org/xbl"><binding id="x"><content><caption xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><children xmlns="http://www.mozilla.org/xbl"/></caption></content></binding></bindings>
</head>
<body onload="document.getElementById('x').innerHTML = '9';">
<span id="x" style="-moz-binding: url(#x)"><div></div></span>
</body>
</html>

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

@ -18,6 +18,7 @@ load 404125-1.xhtml
load 406900-1.xul
load 406904-1.xhtml
load 406904-2.xhtml
load 415301-1.xul
load 418133-1.xhtml
load 415192-1.xul
load 420233-1.xhtml
@ -27,3 +28,4 @@ load 460665-1.xhtml
load 464863-1.xhtml
load 472260-1.xhtml
load 492978-1.xul
load 495354-1.xhtml

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

@ -1536,6 +1536,11 @@ RemoveChildFromInsertionPoint(nsAnonymousContentList* aInsertionPointList,
// when we've hit it, but just trying to remove from all the pseudo or
// non-pseudo insertion points, depending on the value of
// aRemoveFromPseudoPoints, should work.
// XXXbz nsXBLInsertionPoint::RemoveChild could return whether it
// removed something. Wouldn't that let us short-circuit the walk?
// Or can a child be in multiple insertion points? I wouldn't think
// so...
PRInt32 count = aInsertionPointList->GetInsertionPointCount();
for (PRInt32 i = 0; i < count; i++) {
nsXBLInsertionPoint* point =
@ -1571,6 +1576,21 @@ nsBindingManager::ContentRemoved(nsIDocument* aDocument,
PR_FALSE);
SetInsertionParent(aChild, nsnull);
}
// Also remove from the list in mContentListTable, if any.
if (mContentListTable.ops) {
nsCOMPtr<nsIDOMNodeList> otherNodeList =
static_cast<nsAnonymousContentList*>
(LookupObject(mContentListTable, point));
if (otherNodeList && otherNodeList != nodeList) {
// otherNodeList is always anonymous
RemoveChildFromInsertionPoint(static_cast<nsAnonymousContentList*>
(static_cast<nsIDOMNodeList*>
(otherNodeList)),
aChild,
PR_FALSE);
}
}
}
// Whether the child has a nested insertion point or not, aContainer might

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

@ -0,0 +1,5 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<span><caption xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">9</caption></span>
</body>
</html>

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

@ -0,0 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<bindings xmlns="http://www.mozilla.org/xbl"><binding id="x"><content><caption xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><children xmlns="http://www.mozilla.org/xbl"/></caption></content></binding></bindings>
</head>
<body onload="document.getElementById('x').innerHTML = '9';">
<span id="x" style="-moz-binding: url(#x)"><div>123</div></span>
</body>
</html>

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

@ -0,0 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<bindings xmlns="http://www.mozilla.org/xbl"><binding id="x"><content><caption xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><children xmlns="http://www.mozilla.org/xbl"/></caption></content></binding></bindings>
</head>
<body onload="document.getElementById('x').innerHTML = '9';">
<span id="x" style="-moz-binding: url(#x)"><div style="border: 5px solid green">123</div></span>
</body>
</html>