From ffab603a47d4580cf15bc306cf6d129b936c6bb8 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 16 Nov 2009 16:00:07 -0500 Subject: [PATCH] Bug 518114 part 1. Don't force a virtual GetType call in GetFloatFromPlaceholder. r=roc --- layout/base/nsLayoutUtils.cpp | 5 ++--- layout/base/nsLayoutUtils.h | 4 ++-- layout/generic/nsBlockFrame.cpp | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 25b81b0b121..369f5b0cbe0 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -229,9 +229,8 @@ nsLayoutUtils::GetClosestFrameOfType(nsIFrame* aFrame, nsIAtom* aFrameType) nsIFrame* nsLayoutUtils::GetFloatFromPlaceholder(nsIFrame* aFrame) { - if (nsGkAtoms::placeholderFrame != aFrame->GetType()) { - return nsnull; - } + NS_ASSERTION(nsGkAtoms::placeholderFrame == aFrame->GetType(), + "Must have a placeholder here"); nsIFrame *outOfFlowFrame = nsPlaceholderFrame::GetRealFrameForPlaceholder(aFrame); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index e71e828a40f..085764ea062 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -341,9 +341,9 @@ public: /** * If this frame is a placeholder for a float, then return the float, - * otherwise return nsnull. + * otherwise return nsnull. aPlaceholder must be a placeholder frame. */ - static nsIFrame* GetFloatFromPlaceholder(nsIFrame* aPossiblePlaceholder); + static nsIFrame* GetFloatFromPlaceholder(nsIFrame* aPlaceholder); // Combine aNewBreakType with aOrigBreakType, but limit the break types // to NS_STYLE_CLEAR_LEFT, RIGHT, LEFT_AND_RIGHT. diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index cb4c1894bd1..2c2c56348c9 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -6644,7 +6644,9 @@ void nsBlockFrame::CollectFloats(nsIFrame* aFrame, nsFrameList& aList, while (aFrame) { // Don't descend into float containing blocks. if (!aFrame->IsFloatContainingBlock()) { - nsIFrame *outOfFlowFrame = nsLayoutUtils::GetFloatFromPlaceholder(aFrame); + nsIFrame *outOfFlowFrame = + aFrame->GetType() == nsGkAtoms::placeholderFrame ? + nsLayoutUtils::GetFloatFromPlaceholder(aFrame) : nsnull; if (outOfFlowFrame) { // Make sure that its parent is us. Otherwise we don't want // to mess around with it because it belongs to someone