Add a null-check to wallpaper bug 411582. b=411582 r+sr=bzbarsky a=mtschrep

This commit is contained in:
mats.palmgren@bredband.net 2008-01-15 15:29:53 -08:00
Родитель fd4b1d21b2
Коммит 1d17a19ca1
3 изменённых файлов: 37 добавлений и 28 удалений

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

@ -0,0 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"><!-- no body element, intentionally --><div style="display: table-column-group;"/><svg:symbol id="s"/><script>
document.documentElement.offsetHeight;
document.getElementById("s").style.display = "table-column-group";
</script></html>

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

@ -40,3 +40,4 @@ load 399209-1.xhtml
load 403249-1.html
load 403579-1.html
load 404301-1.xhtml
load 411582.xhtml

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

@ -2290,37 +2290,39 @@ nsTableFrame::InsertFrames(nsIAtom* aListName,
pseudoFrame = pseudoFrame->GetFirstChild(nsnull);
}
nsCOMPtr<nsIContent> container = content->GetParent();
PRInt32 newIndex = container->IndexOf(content);
nsIFrame* kidFrame;
PRBool isColGroup = (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP ==
display->mDisplay);
if (isColGroup) {
kidFrame = mColGroups.FirstChild();
}
else {
kidFrame = mFrames.FirstChild();
}
// Important: need to start at a value smaller than all valid indices
PRInt32 lastIndex = -1;
while (kidFrame) {
if (NS_LIKELY(container)) { // XXX need this null-check, see bug 411823.
PRInt32 newIndex = container->IndexOf(content);
nsIFrame* kidFrame;
PRBool isColGroup = (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP ==
display->mDisplay);
if (isColGroup) {
nsTableColGroupType groupType =
((nsTableColGroupFrame *)kidFrame)->GetColType();
if (eColGroupAnonymousCell == groupType) {
continue;
kidFrame = mColGroups.FirstChild();
}
else {
kidFrame = mFrames.FirstChild();
}
// Important: need to start at a value smaller than all valid indices
PRInt32 lastIndex = -1;
while (kidFrame) {
if (isColGroup) {
nsTableColGroupType groupType =
((nsTableColGroupFrame *)kidFrame)->GetColType();
if (eColGroupAnonymousCell == groupType) {
continue;
}
}
pseudoFrame = kidFrame;
while (pseudoFrame && (parentContent ==
(content = pseudoFrame->GetContent()))) {
pseudoFrame = pseudoFrame->GetFirstChild(nsnull);
}
PRInt32 index = container->IndexOf(content);
if (index > lastIndex && index < newIndex) {
lastIndex = index;
aPrevFrame = kidFrame;
}
kidFrame = kidFrame->GetNextSibling();
}
pseudoFrame = kidFrame;
while (pseudoFrame && (parentContent ==
(content = pseudoFrame->GetContent()))) {
pseudoFrame = pseudoFrame->GetFirstChild(nsnull);
}
PRInt32 index = container->IndexOf(content);
if (index > lastIndex && index < newIndex) {
lastIndex = index;
aPrevFrame = kidFrame;
}
kidFrame = kidFrame->GetNextSibling();
}
}
}