Don't crash in the document observer methods when the container arg is null. b=301025 r+sr=bzbarsky a=benjamin

This commit is contained in:
mats.palmgren%bredband.net 2005-07-24 01:21:17 +00:00
Родитель 57b3c45839
Коммит c573f457b3
2 изменённых файлов: 4 добавлений и 16 удалений

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

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mats Palmgren <mats.palmgren@bredband.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -955,22 +956,12 @@ nsImageMap::Draw(nsPresContext* aCX, nsIRenderingContext& aRC)
}
}
PRBool
nsImageMap::IsAncestorOf(nsIContent* aContent,
nsIContent* aAncestorContent)
{
for (nsIContent *a = aContent->GetParent(); a; a = a->GetParent())
if (a == aAncestorContent)
return PR_TRUE;
return PR_FALSE;
}
void
nsImageMap::MaybeUpdateAreas(nsIContent *aContent)
{
if (aContent == mMap ||
(mContainsBlockContents && IsAncestorOf(aContent, mMap))) {
if (aContent && (aContent == mMap ||
(mContainsBlockContents &&
nsContentUtils::ContentIsDescendantOf(aContent, mMap)))) {
UpdateAreas();
}
}

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

@ -116,9 +116,6 @@ protected:
nsresult UpdateAreas();
nsresult UpdateAreasForBlock(nsIContent* aParent, PRBool* aFoundAnchor);
static PRBool IsAncestorOf(nsIContent* aContent,
nsIContent* aAncestorContent);
nsresult AddArea(nsIContent* aArea);
nsresult ChangeFocus(nsIDOMEvent* aEvent, PRBool aFocus);