diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 72199127370a..ed658b5b7a29 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -8585,7 +8585,13 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // Get the geometric parent. Use the prev sibling if we have it; // otherwise use the next sibling - if (!prevSibling && !nextSibling) { + if (prevSibling) { + prevSibling->GetParent(&parentFrame); + } + else if (nextSibling) { + nextSibling->GetParent(&parentFrame); + } + else { // No previous or next sibling so treat this like an appended frame. isAppend = PR_TRUE; diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 72199127370a..ed658b5b7a29 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -8585,7 +8585,13 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, // Get the geometric parent. Use the prev sibling if we have it; // otherwise use the next sibling - if (!prevSibling && !nextSibling) { + if (prevSibling) { + prevSibling->GetParent(&parentFrame); + } + else if (nextSibling) { + nextSibling->GetParent(&parentFrame); + } + else { // No previous or next sibling so treat this like an appended frame. isAppend = PR_TRUE;