Bug 1682193 - Don't append null content nodes in InspectorUtils.getOverflowingChildrenOfElement. r=dholbert

And add an assertion for this to fail earlier (in debug builds at
least).

The issue is that in paginated mode canvas frames (which are not
associated to a node) might overflow their page content frame.

Differential Revision: https://phabricator.services.mozilla.com/D99630
This commit is contained in:
Emilio Cobos Álvarez 2020-12-14 11:10:10 +00:00
parent edd1803ffc
commit 5e3c951c42
2 changed files with 6 additions and 3 deletions

View File

@ -52,10 +52,13 @@ class nsBaseContentList : public nsINodeList {
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsBaseContentList)
void AppendElement(nsIContent* aContent) {
MOZ_ASSERT(aContent);
mElements.AppendElement(aContent);
}
void MaybeAppendElement(nsIContent* aContent) {
if (aContent) AppendElement(aContent);
if (aContent) {
AppendElement(aContent);
}
}
/**

View File

@ -769,7 +769,7 @@ static void AddOverflowingChildrenOfElement(const nsIFrame* aFrame,
if (FrameHasSpecifiedSize(child) &&
IsFrameOutsideOfAncestor(child, aAncestorFrame, aRect)) {
aList.AppendElement(child->GetContent());
aList.MaybeAppendElement(child->GetContent());
continue;
}
@ -780,7 +780,7 @@ static void AddOverflowingChildrenOfElement(const nsIFrame* aFrame,
// calling AddOverflowingChildrenOfElement on it.
if (currListLength == aList.Length() &&
IsFrameOutsideOfAncestor(child, aAncestorFrame, aRect)) {
aList.AppendElement(child->GetContent());
aList.MaybeAppendElement(child->GetContent());
}
}
}