gecko/layout/forms/nsFieldSetFrame.cpp
L. David Baron 822b2ca3bc Bug 781360 patch 3: Rename {nsIFrame,nsStyleContext,nsComputedDOMStyle}::GetStyle* to Style*, since they can never return null. r=dholbert
Except for the changes in:
  layout/generic/nsIFrame.h (part)
  layout/style/nsComputedDOMStyle.h (all)
  layout/style/nsRuleNode.cpp (part)
  layout/style/nsStyleContext.cpp (part)
  layout/style/nsStyleContext.h (part)
(see patch 3b in the bug), this patch was written with the sed script:
s/\<GetStyle\(Font\|Color\|List\|Text\|Visibility\|Quotes\|UserInterface\|TableBorder\|SVG\|Background\|Position\|TextReset\|Display\|Content\|UIReset\|Table\|Margin\|Padding\|Border\|Outline\|XUL\|SVGReset\|Column\)\>/Style\1/g
2013-02-16 13:51:02 -08:00

640 lines
23 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// YY need to pass isMultiple before create called
//#include "nsFormControlFrame.h"
#include "nsContainerFrame.h"
#include "nsLegendFrame.h"
#include "nsIDOMNode.h"
#include "nsIDOMHTMLFieldSetElement.h"
#include "nsIDOMHTMLLegendElement.h"
#include "nsCSSRendering.h"
#include <algorithm>
//#include "nsIDOMHTMLCollection.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsISupports.h"
#include "nsIAtom.h"
#include "nsPresContext.h"
#include "nsFrameManager.h"
#include "nsHTMLParts.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsFont.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsDisplayList.h"
#include "nsRenderingContext.h"
#include "mozilla/Likely.h"
using namespace mozilla;
using namespace mozilla::layout;
class nsLegendFrame;
class nsFieldSetFrame : public nsContainerFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
nsFieldSetFrame(nsStyleContext* aContext);
NS_IMETHOD SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList);
NS_HIDDEN_(nscoord)
GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
nsLayoutUtils::IntrinsicWidthType);
virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext);
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
uint32_t aFlags) MOZ_OVERRIDE;
virtual nscoord GetBaseline() const;
NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
void PaintBorderBackground(nsRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect, uint32_t aBGFlags);
NS_IMETHOD AppendFrames(ChildListID aListID,
nsFrameList& aFrameList);
NS_IMETHOD InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList);
NS_IMETHOD RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame);
virtual nsIAtom* GetType() const;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const {
return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
}
#endif
protected:
void ReparentFrameList(const nsFrameList& aFrameList);
// mLegendFrame is a nsLegendFrame or a nsHTMLScrollFrame with the
// nsLegendFrame as the scrolled frame (aka content insertion frame).
nsIFrame* mLegendFrame;
nsIFrame* mContentFrame;
nsRect mLegendRect;
nscoord mLegendSpace;
};
nsIFrame*
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsFieldSetFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsFieldSetFrame)
nsFieldSetFrame::nsFieldSetFrame(nsStyleContext* aContext)
: nsContainerFrame(aContext)
{
mContentFrame = nullptr;
mLegendFrame = nullptr;
mLegendSpace = 0;
}
nsIAtom*
nsFieldSetFrame::GetType() const
{
return nsGkAtoms::fieldSetFrame;
}
NS_IMETHODIMP
nsFieldSetFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
{
// Get the content and legend frames.
if (!aChildList.OnlyChild()) {
NS_ASSERTION(aChildList.GetLength() == 2, "Unexpected child list");
mContentFrame = aChildList.LastChild();
mLegendFrame = aChildList.FirstChild();
} else {
mContentFrame = aChildList.FirstChild();
mLegendFrame = nullptr;
}
// Queue up the frames for the content frame
return nsContainerFrame::SetInitialChildList(kPrincipalList, aChildList);
}
class nsDisplayFieldSetBorderBackground : public nsDisplayItem {
public:
nsDisplayFieldSetBorderBackground(nsDisplayListBuilder* aBuilder,
nsFieldSetFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayFieldSetBorderBackground);
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayFieldSetBorderBackground() {
MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
}
#endif
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx);
NS_DISPLAY_DECL_NAME("FieldSetBorderBackground", TYPE_FIELDSET_BORDER_BACKGROUND)
};
void nsDisplayFieldSetBorderBackground::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
{
// aPt is guaranteed to be in this item's bounds. We do the hit test based on the
// frame bounds even though our background doesn't cover the whole frame.
// It's not clear whether this is correct.
aOutFrames->AppendElement(mFrame);
}
void
nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
static_cast<nsFieldSetFrame*>(mFrame)->
PaintBorderBackground(*aCtx, ToReferenceFrame(),
mVisibleRect, aBuilder->GetBackgroundPaintFlags());
}
void
nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) {
// Paint our background and border in a special way.
// REVIEW: We don't really need to check frame emptiness here; if it's empty,
// the background/border display item won't do anything, and if it isn't empty,
// we need to paint the outline
if (IsVisibleForPainting(aBuilder)) {
if (StyleBorder()->mBoxShadow) {
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayBoxShadowOuter(aBuilder, this));
}
// don't bother checking to see if we really have a border or background.
// we usually will have a border.
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayFieldSetBorderBackground(aBuilder, this));
DisplayOutlineUnconditional(aBuilder, aLists);
DO_GLOBAL_REFLOW_COUNT_DSP("nsFieldSetFrame");
}
nsDisplayListCollection contentDisplayItems;
if (mContentFrame) {
// Collect mContentFrame's display items into their own collection. We need
// to be calling BuildDisplayList on mContentFrame before mLegendFrame in
// case it contains out-of-flow frames whose placeholders are under
// mLegendFrame. However, we want mContentFrame's display items to be
// after mLegendFrame's display items in z-order, so we need to save them
// and append them later.
BuildDisplayListForChild(aBuilder, mContentFrame, aDirtyRect,
contentDisplayItems);
}
if (mLegendFrame) {
// The legend's background goes on our BlockBorderBackgrounds list because
// it's a block child.
nsDisplayListSet set(aLists, aLists.BlockBorderBackgrounds());
BuildDisplayListForChild(aBuilder, mLegendFrame, aDirtyRect, set);
}
// Put mContentFrame's display items on the master list. Note that
// this moves mContentFrame's border/background display items to our
// BorderBackground() list, which isn't really correct, but it's OK because
// mContentFrame is anonymous and can't have its own border and background.
contentDisplayItems.MoveTo(aLists);
}
void
nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect, uint32_t aBGFlags)
{
const nsStyleBorder* borderStyle = StyleBorder();
nscoord topBorder = borderStyle->GetComputedBorderWidth(NS_SIDE_TOP);
nscoord yoff = 0;
nsPresContext* presContext = PresContext();
// if the border is smaller than the legend. Move the border down
// to be centered on the legend.
// FIXME: This means border-radius clamping is incorrect; we should
// override nsIFrame::GetBorderRadii.
if (topBorder < mLegendRect.height)
yoff = (mLegendRect.height - topBorder)/2;
nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
aDirtyRect, rect, aBGFlags);
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
this, rect, aDirtyRect);
if (mLegendFrame) {
// Use the rect of the legend frame, not mLegendRect, so we draw our
// border under the legend's left and right margins.
nsRect legendRect = mLegendFrame->GetRect() + aPt;
// we should probably use PaintBorderEdges to do this but for now just use clipping
// to achieve the same effect.
// draw left side
nsRect clipRect(rect);
clipRect.width = legendRect.x - rect.x;
clipRect.height = topBorder;
aRenderingContext.PushState();
aRenderingContext.IntersectClip(clipRect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
aRenderingContext.PopState();
// draw right side
clipRect = rect;
clipRect.x = legendRect.XMost();
clipRect.width = rect.XMost() - legendRect.XMost();
clipRect.height = topBorder;
aRenderingContext.PushState();
aRenderingContext.IntersectClip(clipRect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
aRenderingContext.PopState();
// draw bottom
clipRect = rect;
clipRect.y += topBorder;
clipRect.height = mRect.height - (yoff + topBorder);
aRenderingContext.PushState();
aRenderingContext.IntersectClip(clipRect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
aRenderingContext.PopState();
} else {
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect,
nsRect(aPt, mRect.Size()),
mStyleContext);
}
}
nscoord
nsFieldSetFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
nsLayoutUtils::IntrinsicWidthType aType)
{
nscoord legendWidth = 0;
nscoord contentWidth = 0;
if (mLegendFrame) {
legendWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mLegendFrame,
aType);
}
if (mContentFrame) {
contentWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mContentFrame,
aType);
}
return std::max(legendWidth, contentWidth);
}
nscoord
nsFieldSetFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
{
nscoord result = 0;
DISPLAY_MIN_WIDTH(this, result);
result = GetIntrinsicWidth(aRenderingContext, nsLayoutUtils::MIN_WIDTH);
return result;
}
nscoord
nsFieldSetFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
{
nscoord result = 0;
DISPLAY_PREF_WIDTH(this, result);
result = GetIntrinsicWidth(aRenderingContext, nsLayoutUtils::PREF_WIDTH);
return result;
}
/* virtual */ nsSize
nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
uint32_t aFlags)
{
nsSize result =
nsContainerFrame::ComputeSize(aRenderingContext, aCBSize, aAvailableWidth,
aMargin, aBorder, aPadding, aFlags);
// Fieldsets never shrink below their min width.
// If we're a container for font size inflation, then shrink
// wrapping inside of us should not apply font size inflation.
AutoMaybeDisableFontInflation an(this);
nscoord minWidth = GetMinWidth(aRenderingContext);
if (minWidth > result.width)
result.width = minWidth;
return result;
}
NS_IMETHODIMP
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
NS_PRECONDITION(aReflowState.ComputedWidth() != NS_INTRINSICSIZE,
"Should have a precomputed width!");
// Initialize OUT parameter
aStatus = NS_FRAME_COMPLETE;
//------------ Handle Incremental Reflow -----------------
bool reflowContent;
bool reflowLegend;
if (aReflowState.ShouldReflowAllKids()) {
reflowContent = mContentFrame != nullptr;
reflowLegend = mLegendFrame != nullptr;
} else {
reflowContent = mContentFrame && NS_SUBTREE_DIRTY(mContentFrame);
reflowLegend = mLegendFrame && NS_SUBTREE_DIRTY(mLegendFrame);
}
// We don't allow fieldsets to break vertically. If we did, we'd
// need logic here to push and pull overflow frames.
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
NS_ASSERTION(!mContentFrame ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
mContentFrame,
nsLayoutUtils::MIN_WIDTH) <=
availSize.width,
"Bogus availSize.width; should be bigger");
NS_ASSERTION(!mLegendFrame ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
mLegendFrame,
nsLayoutUtils::MIN_WIDTH) <=
availSize.width,
"Bogus availSize.width; should be bigger");
// get our border and padding
const nsMargin &borderPadding = aReflowState.mComputedBorderPadding;
nsMargin border = borderPadding - aReflowState.mComputedPadding;
// Figure out how big the legend is if there is one.
// get the legend's margin
nsMargin legendMargin(0,0,0,0);
// reflow the legend only if needed
if (reflowLegend) {
nsHTMLReflowState legendReflowState(aPresContext, aReflowState,
mLegendFrame, availSize);
nsHTMLReflowMetrics legendDesiredSize;
ReflowChild(mLegendFrame, aPresContext, legendDesiredSize, legendReflowState,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
#ifdef NOISY_REFLOW
printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height);
#endif
// figure out the legend's rectangle
legendMargin = mLegendFrame->GetUsedMargin();
mLegendRect.width = legendDesiredSize.width + legendMargin.left + legendMargin.right;
mLegendRect.height = legendDesiredSize.height + legendMargin.top + legendMargin.bottom;
mLegendRect.x = borderPadding.left;
mLegendRect.y = 0;
nscoord oldSpace = mLegendSpace;
mLegendSpace = 0;
if (mLegendRect.height > border.top) {
// center the border on the legend
mLegendSpace = mLegendRect.height - border.top;
} else {
mLegendRect.y = (border.top - mLegendRect.height)/2;
}
// if the legend space changes then we need to reflow the
// content area as well.
if (mLegendSpace != oldSpace && mContentFrame) {
reflowContent = true;
}
FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState,
legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
} else if (!mLegendFrame) {
mLegendRect.SetEmpty();
mLegendSpace = 0;
} else {
// mLegendSpace and mLegendRect haven't changed, but we need
// the used margin when placing the legend.
legendMargin = mLegendFrame->GetUsedMargin();
}
// reflow the content frame only if needed
if (reflowContent) {
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, mContentFrame,
availSize);
// Our child is "height:100%" but we actually want its height to be reduced
// by the amount of content-height the legend is eating up, unless our
// height is unconstrained (in which case the child's will be too).
if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE) {
kidReflowState.SetComputedHeight(std::max(0, aReflowState.ComputedHeight() - mLegendSpace));
}
kidReflowState.mComputedMinHeight =
std::max(0, aReflowState.mComputedMinHeight - mLegendSpace);
if (aReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE) {
kidReflowState.mComputedMaxHeight =
std::max(0, aReflowState.mComputedMaxHeight - mLegendSpace);
}
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mFlags);
// Reflow the frame
NS_ASSERTION(kidReflowState.mComputedMargin == nsMargin(0,0,0,0),
"Margins on anonymous fieldset child not supported!");
nsPoint pt(borderPadding.left, borderPadding.top + mLegendSpace);
ReflowChild(mContentFrame, aPresContext, kidDesiredSize, kidReflowState,
pt.x, pt.y, 0, aStatus);
FinishReflowChild(mContentFrame, aPresContext, &kidReflowState,
kidDesiredSize, pt.x, pt.y, 0);
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
}
nsRect contentRect(0,0,0,0);
if (mContentFrame) {
// We don't support margins on mContentFrame, so our "content rect" is just
// its rect.
contentRect = mContentFrame->GetRect();
}
// use the computed width if the inner content does not fill it
if (aReflowState.ComputedWidth() > contentRect.width) {
contentRect.width = aReflowState.ComputedWidth();
}
if (mLegendFrame) {
// if the content rect is larger then the legend we can align the legend
if (contentRect.width > mLegendRect.width) {
int32_t align = static_cast<nsLegendFrame*>
(mLegendFrame->GetContentInsertionFrame())->GetAlign();
switch(align) {
case NS_STYLE_TEXT_ALIGN_RIGHT:
mLegendRect.x = contentRect.width - mLegendRect.width + borderPadding.left;
break;
case NS_STYLE_TEXT_ALIGN_CENTER:
// Note: rounding removed; there doesn't seem to be any need
mLegendRect.x = contentRect.width / 2 - mLegendRect.width / 2 + borderPadding.left;
break;
}
} else {
// otherwise make place for the legend
contentRect.width = mLegendRect.width;
}
// place the legend
nsRect actualLegendRect(mLegendRect);
actualLegendRect.Deflate(legendMargin);
nsPoint curOrigin = mLegendFrame->GetPosition();
// only if the origin changed
if ((curOrigin.x != mLegendRect.x) || (curOrigin.y != mLegendRect.y)) {
mLegendFrame->SetPosition(nsPoint(actualLegendRect.x , actualLegendRect.y));
nsContainerFrame::PositionFrameView(mLegendFrame);
// We need to recursively process the legend frame's
// children since we're moving the frame after Reflow.
nsContainerFrame::PositionChildViews(mLegendFrame);
}
}
// Return our size and our result
if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
aDesiredSize.height = mLegendSpace +
borderPadding.TopBottom() +
contentRect.height;
} else {
nscoord min = borderPadding.TopBottom() + mLegendRect.height;
aDesiredSize.height =
aReflowState.ComputedHeight() + borderPadding.TopBottom();
if (aDesiredSize.height < min)
aDesiredSize.height = min;
}
aDesiredSize.width = contentRect.width + borderPadding.LeftRight();
aDesiredSize.SetOverflowAreasToDesiredBounds();
if (mLegendFrame)
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mLegendFrame);
if (mContentFrame)
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mContentFrame);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus);
InvalidateFrame();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}
NS_IMETHODIMP
nsFieldSetFrame::AppendFrames(ChildListID aListID,
nsFrameList& aFrameList)
{
// aFrameList is not allowed to contain "the legend" for this fieldset
ReparentFrameList(aFrameList);
return mContentFrame->AppendFrames(aListID, aFrameList);
}
NS_IMETHODIMP
nsFieldSetFrame::InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList)
{
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this ||
aPrevFrame->GetParent() == mContentFrame,
"inserting after sibling frame with different parent");
// aFrameList is not allowed to contain "the legend" for this fieldset
ReparentFrameList(aFrameList);
if (MOZ_UNLIKELY(aPrevFrame == mLegendFrame)) {
aPrevFrame = nullptr;
}
return mContentFrame->InsertFrames(aListID, aPrevFrame, aFrameList);
}
NS_IMETHODIMP
nsFieldSetFrame::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame)
{
// For reference, see bug 70648, bug 276104 and bug 236071.
NS_ASSERTION(aOldFrame != mLegendFrame, "Cannot remove mLegendFrame here");
return mContentFrame->RemoveFrame(aListID, aOldFrame);
}
#ifdef ACCESSIBILITY
a11y::AccType
nsFieldSetFrame::AccessibleType()
{
return a11y::eHTMLGroupboxType;
}
#endif
void
nsFieldSetFrame::ReparentFrameList(const nsFrameList& aFrameList)
{
nsFrameManager* frameManager = PresContext()->FrameManager();
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
NS_ASSERTION(mLegendFrame || e.get()->GetType() != nsGkAtoms::legendFrame,
"The fieldset's legend is not allowed in this list");
e.get()->SetParent(mContentFrame);
frameManager->ReparentStyleContext(e.get());
}
}
nscoord
nsFieldSetFrame::GetBaseline() const
{
// We know mContentFrame is a block, so calling GetBaseline() on it will do
// the right thing (that being to return the baseline of the last line).
NS_ASSERTION(nsLayoutUtils::GetAsBlock(mContentFrame),
"Unexpected mContentFrame");
return mContentFrame->GetPosition().y + mContentFrame->GetBaseline();
}