Bug 1343078 part 6. Change nsFrame::CorrectStyleParentFrame to return null if we're dealing with a non-inheriting anon box. r?dbaron
MozReview-Commit-ID: In9U54Wsjnz
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -9169,25 +9169,32 @@ GetCorrectedParent(const nsIFrame* aFram
/* static */
nsIFrame*
nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
nsIAtom* aChildPseudo)
{
NS_PRECONDITION(aProspectiveParent, "Must have a prospective parent");
- // Anon boxes are parented to their actual parent already, except
- // for non-elements. Those should not be treated as an anon box.
- if (aChildPseudo && !nsCSSAnonBoxes::IsNonElement(aChildPseudo) &&
- nsCSSAnonBoxes::IsAnonBox(aChildPseudo)) {
- NS_ASSERTION(aChildPseudo != nsCSSAnonBoxes::mozAnonymousBlock &&
- aChildPseudo != nsCSSAnonBoxes::mozAnonymousPositionedBlock,
- "Should have dealt with kids that have "
- "NS_FRAME_PART_OF_IBSPLIT elsewhere");
- return aProspectiveParent;
+ if (aChildPseudo) {
+ // Non-inheriting anon boxes have no style parent frame at all.
+ if (nsCSSAnonBoxes::IsNonInheritingAnonBox(aChildPseudo)) {
+ return nullptr;
+ }
+
+ // Other anon boxes are parented to their actual parent already, except
+ // for non-elements. Those should not be treated as an anon box.
+ if (!nsCSSAnonBoxes::IsNonElement(aChildPseudo) &&
+ nsCSSAnonBoxes::IsAnonBox(aChildPseudo)) {
+ NS_ASSERTION(aChildPseudo != nsCSSAnonBoxes::mozAnonymousBlock &&
+ aChildPseudo != nsCSSAnonBoxes::mozAnonymousPositionedBlock,
+ "Should have dealt with kids that have "
+ "NS_FRAME_PART_OF_IBSPLIT elsewhere");
+ return aProspectiveParent;
+ }
}
// Otherwise, walk up out of all anon boxes. For placeholder frames, walk out
// of all pseudo-elements as well. Otherwise ReparentStyleContext could cause
// style data to be out of sync with the frame tree.
nsIFrame* parent = aProspectiveParent;
do {
if (parent->GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) {