bug 113424 - mechanism for percent height frames inside table cells to receive special height reflow. sr=attinasi, r=alexsavulov

This commit is contained in:
karnaze%netscape.com 2001-12-07 14:51:12 +00:00
parent eeac1769e9
commit 748ebbcd0d
109 changed files with 743 additions and 506 deletions

View File

@ -100,6 +100,7 @@ LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content")
// Alphabetical list of frame types
LAYOUT_ATOM(areaFrame, "AreaFrame")
LAYOUT_ATOM(blockFrame, "BlockFrame")
LAYOUT_ATOM(boxFrame, "BoxFrame")
LAYOUT_ATOM(brFrame, "BRFrame")
LAYOUT_ATOM(bulletFrame, "BulletFrame")
LAYOUT_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")
@ -132,7 +133,6 @@ LAYOUT_ATOM(textFrame, "TextFrame")
LAYOUT_ATOM(viewportFrame, "ViewportFrame")
// Alphabetical list of frame property names
LAYOUT_ATOM(cellPctOverHeightProperty, "CellPctOverHeightProperty") // nscoord*
LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint*
LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL
LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize*

View File

@ -38,5 +38,24 @@
#ifndef nsIPercentHeightObserver_h___
#define nsIPercentHeightObserver_h___
struct nsHTMLReflowState;
class nsIPresContext;
// IID for the nsIPercentHeightObserver interface
#define NS_IPERCENTHEIGHTOBSERVER_IID \
{ 0x9cdc174b, 0x4f39, 0x41ad, {0xbc, 0x16, 0x5a, 0xc5, 0xa8, 0x64, 0x14, 0xa1}}
/**
* This interface is supported by frames that need to provide computed height
* values to children during reflow which would otherwise not happen. Currently only
* tables support this.
*/
class nsIPercentHeightObserver : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPERCENTHEIGHTOBSERVER_IID)
NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0;
};
#endif // nsIPercentHeightObserver_h___

View File

@ -100,6 +100,7 @@ LAYOUT_ATOM(selectScrolledContentPseudo, ":-moz-select-scrolled-content")
// Alphabetical list of frame types
LAYOUT_ATOM(areaFrame, "AreaFrame")
LAYOUT_ATOM(blockFrame, "BlockFrame")
LAYOUT_ATOM(boxFrame, "BoxFrame")
LAYOUT_ATOM(brFrame, "BRFrame")
LAYOUT_ATOM(bulletFrame, "BulletFrame")
LAYOUT_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")
@ -132,7 +133,6 @@ LAYOUT_ATOM(textFrame, "TextFrame")
LAYOUT_ATOM(viewportFrame, "ViewportFrame")
// Alphabetical list of frame property names
LAYOUT_ATOM(cellPctOverHeightProperty, "CellPctOverHeightProperty") // nscoord*
LAYOUT_ATOM(collapseOffsetProperty, "CollapseOffsetProperty") // nsPoint*
LAYOUT_ATOM(inlineFrameAnnotation, "InlineFrameAnnotation") // BOOL
LAYOUT_ATOM(maxElementSizeProperty, "MaxElementSizeProperty") // nsSize*

View File

@ -2686,7 +2686,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
@ -2823,7 +2823,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
nsIFrameDebug* frameDebug;
@ -3366,7 +3366,7 @@ PresShell::StyleChangeReflow()
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
nsIFrameDebug* frameDebug;

View File

@ -22,6 +22,7 @@ nsILayoutHistoryState.h
nsIMutableStyleContext.h
nsIObjectFrame.h
nsIPageSequenceFrame.h
nsIPercentHeightObserver.h
nsIPresContext.h
nsIPresShell.h
nsIPresState.h

View File

@ -51,6 +51,7 @@ nsILayoutHistoryState.h \
nsIMutableStyleContext.h \
nsIObjectFrame.h \
nsIPageSequenceFrame.h \
nsIPercentHeightObserver.h \
nsIPresContext.h \
nsIPresShell.h \
nsIPresState.h \

View File

@ -46,11 +46,12 @@ EXPORTS = \
nsIMutableStyleContext.h \
nsIObjectFrame.h \
nsIPageSequenceFrame.h \
nsIPercentHeightObserver.h \
nsIPresContext.h \
nsIPresShell.h \
nsIPresState.h \
nsIPrintContext.h \
nsIPrintPreviewContext.h \
nsIPrintPreviewContext.h \
nsIReflowCallback.h \
nsIReflowCommand.h \
nsIScrollableFrame.h \

View File

@ -46,6 +46,7 @@ class nsIReflowCommand;
class nsIRenderingContext;
class nsSpaceManager;
class nsLineLayout;
class nsIPercentHeightObserver;
struct nsStyleDisplay;
struct nsStyleVisibility;
@ -153,9 +154,6 @@ struct nsHTMLReflowState {
// rendering context to use for measurement
nsIRenderingContext* rendContext;
// is the current context at the top of a page?
PRPackedBool isTopOfPage;
// The type of frame, from css's perspective. This value is
// initialized by the Init method below.
nsCSSFrameType mFrameType;
@ -214,38 +212,29 @@ struct nsHTMLReflowState {
// Compact margin available space
nscoord mCompactMarginWidth;
// The following data members are relevant if nsStyleText.mTextAlign
// == NS_STYLE_TEXT_ALIGN_CHAR
// distance from reference edge (as specified in nsStyleDisplay.mDirection)
// to the align character (which will be specified in nsStyleTable)
nscoord mAlignCharOffset;
// if true, the reflow honors alignCharOffset and does not
// set it. if false, the reflow sets alignCharOffset
PRPackedBool mUseAlignCharOffset;
// Keep track of text-decoration: blink
PRPackedBool mBlinks;
// Cached pointers to the various style structs used during intialization
const nsStyleDisplay* mStyleDisplay;
const nsStyleDisplay* mStyleDisplay;
const nsStyleVisibility* mStyleVisibility;
const nsStylePosition* mStylePosition;
const nsStyleBorder* mStyleBorder;
const nsStyleMargin* mStyleMargin;
const nsStylePadding* mStylePadding;
const nsStyleText* mStyleText;
const nsStylePosition* mStylePosition;
const nsStyleBorder* mStyleBorder;
const nsStyleMargin* mStyleMargin;
const nsStylePadding* mStylePadding;
const nsStyleText* mStyleText;
// a frame (e.g. nsTableCellFrame) which may need to generate a special
// reflow for percent height calculations
nsIPercentHeightObserver* mPercentHeightObserver;
// This value keeps track of how deeply nested a given reflow state
// is from the top of the frame tree.
PRInt16 mReflowDepth;
struct ReflowStateFlags {
//unsigned mUseAlignCharOffset:1; // ditto
//unsigned isTopOfPage:1; // ditto
PRUint16 mSpecialTableReflow:1; // used by tables to communicate special reflow in process
PRUint16 mUnused:15;
PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle
// percent height frames inside cells which may not have computed heights
PRUint16 mIsTopOfPage:1; // is the current context at the top of a page?
PRUint16 mBlinks:1; // Keep track of text-decoration: blink
PRUint16 mUnused:13; // for future use
} mFlags;
#ifdef IBMBIDI

View File

@ -80,6 +80,7 @@ class nsIView;
class nsIWidget;
class nsIDOMRange;
class nsISelectionController;
class nsIPercentHeightObserver;
#ifdef ACCESSIBILITY
class nsIAccessible;
#endif
@ -908,8 +909,9 @@ public:
* XXX Don't we want the semantics to dictate that we only call this once for
* a given reflow?
*/
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus) = 0;
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus) = 0;
// XXX Maybe these three should be a separate interface?

View File

@ -38,5 +38,24 @@
#ifndef nsIPercentHeightObserver_h___
#define nsIPercentHeightObserver_h___
struct nsHTMLReflowState;
class nsIPresContext;
// IID for the nsIPercentHeightObserver interface
#define NS_IPERCENTHEIGHTOBSERVER_IID \
{ 0x9cdc174b, 0x4f39, 0x41ad, {0xbc, 0x16, 0x5a, 0xc5, 0xa8, 0x64, 0x14, 0xa1}}
/**
* This interface is supported by frames that need to provide computed height
* values to children during reflow which would otherwise not happen. Currently only
* tables support this.
*/
class nsIPercentHeightObserver : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPERCENTHEIGHTOBSERVER_IID)
NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0;
};
#endif // nsIPercentHeightObserver_h___

View File

@ -672,7 +672,8 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus);
// Set the child's width and height to it's desired size
FinishReflowChild(aFrame, aPresContext, aDesiredSize, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
FinishReflowChild(aFrame, aPresContext, &kidReflowState, aDesiredSize,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
return rv;
}

View File

@ -425,7 +425,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
availSize.width = mLegendRect.width;
}
FinishReflowChild(mLegendFrame, aPresContext, legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState,
legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
}
}
@ -480,7 +481,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace);
}
FinishReflowChild(mContentFrame, aPresContext, kidDesiredSize, contentRect.x, contentRect.y, 0);
FinishReflowChild(mContentFrame, aPresContext, &kidReflowState,
kidDesiredSize, contentRect.x, contentRect.y, 0);
nsFrameState kidState;
mContentFrame->GetFrameState(&kidState);

View File

@ -400,7 +400,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus status;
rv = mTextFrame->Reflow(aPresContext, txtKidSize, txtKidReflowState, status);
if (NS_FAILED(rv)) return rv;
rv = mTextFrame->DidReflow(aPresContext, aStatus);
rv = mTextFrame->DidReflow(aPresContext, &txtKidReflowState, aStatus);
if (NS_FAILED(rv)) return rv;
// now adjust the frame positions

View File

@ -501,10 +501,11 @@ nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aReflowState, aStatus);
// The view is created hidden; once we have reflowed it and it has been

View File

@ -126,8 +126,9 @@ public:
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
/**
* Respond to the request to resize and/or reflow

View File

@ -637,7 +637,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
}
// Place the child
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
FinishReflowChild(firstKid, aPresContext, &reflowState, aDesiredSize,
focusPadding.left + aReflowState.mComputedBorderPadding.right,
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);

View File

@ -2411,19 +2411,20 @@ nsListControlFrame::GetScrollingParentView(nsIPresContext* aPresContext,
//---------------------------------------------------------
NS_IMETHODIMP
nsListControlFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsListControlFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
if (PR_TRUE == IsInDropDownMode())
{
//SyncViewWithFrame();
mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
mState |= NS_FRAME_SYNC_FRAME_AND_VIEW;
SyncViewWithFrame(aPresContext);
return rv;
} else {
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
PRInt32 selectedIndex = mEndSelectionIndex;
if (selectedIndex == kNothingSelected) {
GetSelectedIndex(&selectedIndex);

View File

@ -206,7 +206,9 @@ public:
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext, nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD Destroy(nsIPresContext *aPresContext);

View File

@ -477,7 +477,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
aKidFrame->GetView(aPresContext, &kidView);
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView,
&kidDesiredSize.mOverflowArea);
aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
// If the frame has visible overflow, then store it as a property on the
// frame. This allows us to be able to recover it without having to reflow

View File

@ -3211,9 +3211,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();
nsCollapsingMargin collapsedBottomMargin;
nsRect combinedArea(0,0,0,0);
*aKeepReflowGoing = brc.PlaceBlock(isAdjacentWithTop, computedOffsets,
collapsedBottomMargin,
aLine->mBounds, combinedArea);
*aKeepReflowGoing = brc.PlaceBlock(aState.mReflowState, isAdjacentWithTop, computedOffsets,
collapsedBottomMargin, aLine->mBounds, combinedArea);
aLine->SetCarriedOutBottomMargin(collapsedBottomMargin);
if (aState.GetFlag(BRS_SHRINKWRAPWIDTH)) {
@ -5153,7 +5152,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
&metrics.mOverflowArea,
NS_FRAME_NO_MOVE_VIEW);
}
floater->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
floater->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED);
// If we computed it, then stash away the max-element-size for later
if (computeMaxElementSize) {
@ -6300,7 +6299,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
const nsMargin& bp = aState.BorderPadding();
nscoord y = bp.top;
mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height));
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
mBullet->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED);
}
//XXX get rid of this -- its slow

View File

@ -432,7 +432,7 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState,
aComputedOffsets = aReflowState.mComputedOffsets;
aReflowState.mLineLayout = nsnull;
if (!aIsAdjacentWithTop) {
aReflowState.isTopOfPage = PR_FALSE; // make sure this is cleared
aReflowState.mFlags.mIsTopOfPage = PR_FALSE; // make sure this is cleared
}
mIsTable = NS_STYLE_DISPLAY_TABLE == aReflowState.mStyleDisplay->mDisplay;
mComputedWidth = aReflowState.mComputedWidth;
@ -688,11 +688,12 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState,
* margins (CSS2 8.3.1). Also apply relative positioning.
*/
PRBool
nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult,
nsRect& aInFlowBounds,
nsRect& aCombinedRect)
nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult,
nsRect& aInFlowBounds,
nsRect& aCombinedRect)
{
// Compute collapsed bottom margin value
aBottomMarginResult = mMetrics.mCarriedOutBottomMargin;
@ -731,7 +732,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
nsRect r(x, y, mMetrics.width, 0);
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0);
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
aInFlowBounds = r;
// Retain combined area information in case we contain a floater
@ -781,7 +782,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
}
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0);
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
// Adjust the max-element-size in the metrics to take into
// account the margins around the block element. Note that we
@ -817,7 +818,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
else {
// Send the DidReflow() notification, but don't bother placing
// the frame
mFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
mFrame->DidReflow(mPresContext, &aReflowState, NS_FRAME_REFLOW_FINISHED);
fits = PR_FALSE;
}
}

View File

@ -76,11 +76,12 @@ public:
nsMargin& aComputedOffsets,
nsReflowStatus& aReflowStatus);
PRBool PlaceBlock(PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult /* out */,
nsRect& aInFlowBounds,
nsRect& aCombinedRect);
PRBool PlaceBlock(const nsHTMLReflowState& aReflowState,
PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult /* out */,
nsRect& aInFlowBounds,
nsRect& aCombinedRect);
void AlignBlockHorizontally(nscoord aWidth, nsBlockHorizontalAlign&);

View File

@ -834,12 +834,13 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
*/
nsresult
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags)
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags)
{
nsPoint curOrigin;
nsRect bounds(aX, aY, aDesiredSize.width, aDesiredSize.height);
@ -863,7 +864,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
PositionChildViews(aPresContext, aKidFrame);
}
return aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
return aKidFrame->DidReflow(aPresContext, aReflowState, NS_FRAME_REFLOW_FINISHED);
}
/**

View File

@ -156,12 +156,13 @@ public:
* don't want to automatically sync the frame and view
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
*/
static nsresult FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags);
static nsresult FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags);
static void PositionChildViews(nsIPresContext* aPresContext,

View File

@ -269,7 +269,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
// Place and size the child and update the output metrics
kid->MoveTo(aPresContext, bp.left, bp.top);
kid->SizeTo(aPresContext, aMetrics.width, aMetrics.height);
kid->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
aMetrics.width += lr;
aMetrics.height += tb;
aMetrics.ascent += bp.top;

View File

@ -84,6 +84,7 @@
#include "nsITableCellLayout.h"// "
#include "nsIGfxTextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPercentHeightObserver.h"
// For triple-click pref
#include "nsIPref.h"
@ -1767,8 +1768,9 @@ nsFrame::WillReflow(nsIPresContext* aPresContext)
}
NS_IMETHODIMP
nsFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("nsFrame::DidReflow: aStatus=%d", aStatus));
@ -1777,6 +1779,22 @@ nsFrame::DidReflow(nsIPresContext* aPresContext,
NS_FRAME_HAS_DIRTY_CHILDREN);
}
// Notify the percent height observer if this is an initial or resize constrained reflow
// and there is a percent height but no computed height. The observer may be able to
// initiate another reflow with a computed height. This happens in the case where a table
// cell has no computed height but can fabricate one when the cell height is known.
if (aReflowState && (aReflowState->mPercentHeightObserver) && // an observer
((eReflowReason_Initial == aReflowState->reason) || // initial or resize reflow
(eReflowReason_Resize == aReflowState->reason)) &&
(NS_UNCONSTRAINEDSIZE != aReflowState->availableWidth) && // constrained width reflow
((NS_UNCONSTRAINEDSIZE == aReflowState->mComputedHeight) || // no computed height
(0 == aReflowState->mComputedHeight)) &&
aReflowState->mStylePosition && // percent height
(eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) {
aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState);
}
return NS_OK;
}

View File

@ -301,8 +301,9 @@ public:
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,

View File

@ -238,8 +238,9 @@ public:
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD Init(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -532,7 +533,8 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
}
// Place and size the child
FinishReflowChild(firstChild, aPresContext, kidMetrics, offset.x, offset.y, 0);
FinishReflowChild(firstChild, aPresContext, nsnull,
kidMetrics, offset.x, offset.y, 0);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsHTMLFrameOuterFrame::Reflow: size=%d,%d status=%x",
@ -962,10 +964,11 @@ nsHTMLFrameInnerFrame::GetParentContent(nsIContent*& aContent)
}
NS_IMETHODIMP
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsLeafFrame::DidReflow(aPresContext, nsnull, aStatus);
// The view is created hidden; once we have reflowed it and it has been

View File

@ -1013,7 +1013,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
// Place and size the child
metrics.width = aSize.width;
metrics.height = aSize.height;
FinishReflowChild(aChild, aPresContext, metrics, aOffset.x, aOffset.y, 0);
FinishReflowChild(aChild, aPresContext, nsnull, metrics, aOffset.x, aOffset.y, 0);
}
static

View File

@ -603,7 +603,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
// Complete the reflow and position and size the child frame
nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
kidDesiredSize.width, kidDesiredSize.height);
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, rect.x, rect.y, 0);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, rect.x, rect.y, 0);
// If the child frame was just inserted, then we're responsible for making sure
// it repaints

View File

@ -223,7 +223,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext* aPresContext,
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, root, view,
nsnull);
}
root->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
root->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
return NS_OK;

View File

@ -86,7 +86,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
: mReflowDepth(0)
{
NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context");
mFlags.mSpecialTableReflow = mFlags.mUnused = 0;
mFlags.mSpecialHeightReflow = mFlags.mUnused = 0;
parentReflowState = nsnull;
frame = aFrame;
reason = aReason;
@ -96,7 +96,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aRenderingContext;
mSpaceManager = nsnull;
mLineLayout = nsnull;
isTopOfPage = PR_FALSE;
mFlags.mIsTopOfPage = PR_FALSE;
mPercentHeightObserver = nsnull;
Init(aPresContext);
#ifdef IBMBIDI
mRightEdge = NS_UNCONSTRAINEDSIZE;
@ -114,7 +115,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
{
NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context");
mFlags.mSpecialTableReflow = mFlags.mUnused = 0;
mFlags.mSpecialHeightReflow = mFlags.mUnused = 0;
reason = eReflowReason_Incremental;
parentReflowState = nsnull;
frame = aFrame;
@ -124,7 +125,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aRenderingContext;
mSpaceManager = nsnull;
mLineLayout = nsnull;
isTopOfPage = PR_FALSE;
mFlags.mIsTopOfPage = PR_FALSE;
mPercentHeightObserver = nsnull;
Init(aPresContext);
#ifdef IBMBIDI
mRightEdge = NS_UNCONSTRAINEDSIZE;
@ -154,7 +156,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aParentReflowState.rendContext;
mSpaceManager = aParentReflowState.mSpaceManager;
mLineLayout = aParentReflowState.mLineLayout;
isTopOfPage = aParentReflowState.isTopOfPage;
mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage;
mPercentHeightObserver = aParentReflowState.mPercentHeightObserver;
Init(aPresContext);
@ -182,7 +185,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aParentReflowState.rendContext;
mSpaceManager = aParentReflowState.mSpaceManager;
mLineLayout = aParentReflowState.mLineLayout;
isTopOfPage = aParentReflowState.isTopOfPage;
mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage;
mPercentHeightObserver = aParentReflowState.mPercentHeightObserver;
Init(aPresContext);
@ -211,7 +215,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aParentReflowState.rendContext;
mSpaceManager = aParentReflowState.mSpaceManager;
mLineLayout = aParentReflowState.mLineLayout;
isTopOfPage = aParentReflowState.isTopOfPage;
mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage;
mPercentHeightObserver = aParentReflowState.mPercentHeightObserver;
Init(aPresContext, aContainingBlockWidth, aContainingBlockHeight);
@ -226,8 +231,6 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext,
nscoord aContainingBlockHeight)
{
mCompactMarginWidth = 0;
mAlignCharOffset = 0;
mUseAlignCharOffset = 0;
#ifdef DEBUG
mDebugHook = nsnull;
#endif
@ -1871,12 +1874,12 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
}
}
// Check for blinking text and permission to display it
mBlinks = (parentReflowState && parentReflowState->mBlinks);
if (!mBlinks && BlinkIsAllowed()) {
mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks);
if (!mFlags.mBlinks && BlinkIsAllowed()) {
const nsStyleTextReset* st;
frame->GetStyleData(eStyleStruct_TextReset,
(const nsStyleStruct*&)st);
mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK);
mFlags.mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK);
}
}

View File

@ -46,6 +46,7 @@ class nsIReflowCommand;
class nsIRenderingContext;
class nsSpaceManager;
class nsLineLayout;
class nsIPercentHeightObserver;
struct nsStyleDisplay;
struct nsStyleVisibility;
@ -153,9 +154,6 @@ struct nsHTMLReflowState {
// rendering context to use for measurement
nsIRenderingContext* rendContext;
// is the current context at the top of a page?
PRPackedBool isTopOfPage;
// The type of frame, from css's perspective. This value is
// initialized by the Init method below.
nsCSSFrameType mFrameType;
@ -214,38 +212,29 @@ struct nsHTMLReflowState {
// Compact margin available space
nscoord mCompactMarginWidth;
// The following data members are relevant if nsStyleText.mTextAlign
// == NS_STYLE_TEXT_ALIGN_CHAR
// distance from reference edge (as specified in nsStyleDisplay.mDirection)
// to the align character (which will be specified in nsStyleTable)
nscoord mAlignCharOffset;
// if true, the reflow honors alignCharOffset and does not
// set it. if false, the reflow sets alignCharOffset
PRPackedBool mUseAlignCharOffset;
// Keep track of text-decoration: blink
PRPackedBool mBlinks;
// Cached pointers to the various style structs used during intialization
const nsStyleDisplay* mStyleDisplay;
const nsStyleDisplay* mStyleDisplay;
const nsStyleVisibility* mStyleVisibility;
const nsStylePosition* mStylePosition;
const nsStyleBorder* mStyleBorder;
const nsStyleMargin* mStyleMargin;
const nsStylePadding* mStylePadding;
const nsStyleText* mStyleText;
const nsStylePosition* mStylePosition;
const nsStyleBorder* mStyleBorder;
const nsStyleMargin* mStyleMargin;
const nsStylePadding* mStylePadding;
const nsStyleText* mStyleText;
// a frame (e.g. nsTableCellFrame) which may need to generate a special
// reflow for percent height calculations
nsIPercentHeightObserver* mPercentHeightObserver;
// This value keeps track of how deeply nested a given reflow state
// is from the top of the frame tree.
PRInt16 mReflowDepth;
struct ReflowStateFlags {
//unsigned mUseAlignCharOffset:1; // ditto
//unsigned isTopOfPage:1; // ditto
PRUint16 mSpecialTableReflow:1; // used by tables to communicate special reflow in process
PRUint16 mUnused:15;
PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle
// percent height frames inside cells which may not have computed heights
PRUint16 mIsTopOfPage:1; // is the current context at the top of a page?
PRUint16 mBlinks:1; // Keep track of text-decoration: blink
PRUint16 mUnused:13; // for future use
} mFlags;
#ifdef IBMBIDI

View File

@ -80,6 +80,7 @@ class nsIView;
class nsIWidget;
class nsIDOMRange;
class nsISelectionController;
class nsIPercentHeightObserver;
#ifdef ACCESSIBILITY
class nsIAccessible;
#endif
@ -908,8 +909,9 @@ public:
* XXX Don't we want the semantics to dictate that we only call this once for
* a given reflow?
*/
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus) = 0;
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus) = 0;
// XXX Maybe these three should be a separate interface?

View File

@ -948,7 +948,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
psd->mReflowState->availableHeight);
reflowState.reason = reason;
reflowState.mLineLayout = this;
reflowState.isTopOfPage = GetFlag(LL_ISTOPOFPAGE);
reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE);
SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE);
SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE);
mTextJustificationNumSpaces = 0;
@ -1273,7 +1273,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
// Tell the frame that we're done reflowing it
aFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
aFrame->DidReflow(mPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED);
if (aMetrics) {
*aMetrics = metrics;

View File

@ -1374,7 +1374,7 @@ nsObjectFrame::HandleChild(nsIPresContext* aPresContext,
}
ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, 0, 0, 0, status);
FinishReflowChild(child, aPresContext, kidDesiredSize, 0, 0, 0);
FinishReflowChild(child, aPresContext, &kidReflowState, kidDesiredSize, 0, 0, 0);
aMetrics.width = kidDesiredSize.width;
aMetrics.height = kidDesiredSize.height;
@ -1465,10 +1465,11 @@ nsObjectFrame::ContentChanged(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsObjectFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsObjectFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aStatus);
nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aReflowState, aStatus);
// The view is created hidden; once we have reflowed it and it has been
// positioned then we show it.
@ -1708,7 +1709,7 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresContext> screenPcx;
shell->GetPresContext(getter_AddRefs(screenPcx));
nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status?
frame->DidReflow(screenPcx, status); // DidReflow will take care of it
frame->DidReflow(screenPcx, nsnull, status); // DidReflow will take care of it
return rv; // done with printing
}

View File

@ -66,8 +66,9 @@ public:
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,

View File

@ -183,7 +183,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
nsSize maxSize(mPD->mReflowRect.width - mPD->mReflowMargin.right - mPD->mReflowMargin.left,
mPD->mReflowRect.height - mPD->mReflowMargin.top - mPD->mReflowMargin.bottom);
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);
kidReflowState.isTopOfPage = PR_TRUE;
kidReflowState.mFlags.mIsTopOfPage = PR_TRUE;
kidReflowState.availableWidth = maxSize.width;
kidReflowState.availableHeight = maxSize.height;
@ -196,7 +196,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
// Place and size the child
FinishReflowChild(frame, aPresContext, aDesiredSize, xc, yc, 0);
FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, xc, yc, 0);
// Make sure the child is at least as tall as our max size (the containing window)
if (aDesiredSize.height < aReflowState.availableHeight) {

View File

@ -391,7 +391,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
// max width then center it horizontally
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, x, y, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, x, y, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
y += kidSize.height;
// Leave a slight gap between the pages

View File

@ -5050,7 +5050,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
// the TEXT_BLINK_ON bit).
PRBool lastTimeWeSkippedLeadingWS = 0 != (mState & TEXT_SKIP_LEADING_WS);
mState &= ~TEXT_REFLOW_FLAGS;
if (aReflowState.mBlinks) {
if (aReflowState.mFlags.mBlinks) {
if (0 == (mState & TEXT_BLINK_ON)) {
mState |= TEXT_BLINK_ON;
nsBlinkTimer::AddBlinkFrame(aPresContext, this);

View File

@ -417,7 +417,7 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext* aPresContext,
aKidFrame->GetView(aPresContext, &kidView);
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView,
&kidDesiredSize.mOverflowArea);
aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aKidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
return rv;
}
@ -576,7 +576,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
kidRect.width = kidDesiredSize.width;
kidRect.height = kidDesiredSize.height;
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, 0, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
}
// If it's a 'initial', 'resize', or 'style change' reflow command (anything

View File

@ -477,7 +477,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
aKidFrame->GetView(aPresContext, &kidView);
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView,
&kidDesiredSize.mOverflowArea);
aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aKidFrame->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
// If the frame has visible overflow, then store it as a property on the
// frame. This allows us to be able to recover it without having to reflow

View File

@ -3211,9 +3211,8 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
PRBool isAdjacentWithTop = aState.IsAdjacentWithTop();
nsCollapsingMargin collapsedBottomMargin;
nsRect combinedArea(0,0,0,0);
*aKeepReflowGoing = brc.PlaceBlock(isAdjacentWithTop, computedOffsets,
collapsedBottomMargin,
aLine->mBounds, combinedArea);
*aKeepReflowGoing = brc.PlaceBlock(aState.mReflowState, isAdjacentWithTop, computedOffsets,
collapsedBottomMargin, aLine->mBounds, combinedArea);
aLine->SetCarriedOutBottomMargin(collapsedBottomMargin);
if (aState.GetFlag(BRS_SHRINKWRAPWIDTH)) {
@ -5153,7 +5152,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState,
&metrics.mOverflowArea,
NS_FRAME_NO_MOVE_VIEW);
}
floater->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
floater->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED);
// If we computed it, then stash away the max-element-size for later
if (computeMaxElementSize) {
@ -6300,7 +6299,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState,
const nsMargin& bp = aState.BorderPadding();
nscoord y = bp.top;
mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height));
mBullet->DidReflow(aState.mPresContext, NS_FRAME_REFLOW_FINISHED);
mBullet->DidReflow(aState.mPresContext, &aState.mReflowState, NS_FRAME_REFLOW_FINISHED);
}
//XXX get rid of this -- its slow

View File

@ -432,7 +432,7 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState,
aComputedOffsets = aReflowState.mComputedOffsets;
aReflowState.mLineLayout = nsnull;
if (!aIsAdjacentWithTop) {
aReflowState.isTopOfPage = PR_FALSE; // make sure this is cleared
aReflowState.mFlags.mIsTopOfPage = PR_FALSE; // make sure this is cleared
}
mIsTable = NS_STYLE_DISPLAY_TABLE == aReflowState.mStyleDisplay->mDisplay;
mComputedWidth = aReflowState.mComputedWidth;
@ -688,11 +688,12 @@ nsBlockReflowContext::DoReflowBlock(nsHTMLReflowState &aReflowState,
* margins (CSS2 8.3.1). Also apply relative positioning.
*/
PRBool
nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult,
nsRect& aInFlowBounds,
nsRect& aCombinedRect)
nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult,
nsRect& aInFlowBounds,
nsRect& aCombinedRect)
{
// Compute collapsed bottom margin value
aBottomMarginResult = mMetrics.mCarriedOutBottomMargin;
@ -731,7 +732,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
nsRect r(x, y, mMetrics.width, 0);
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0);
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
aInFlowBounds = r;
// Retain combined area information in case we contain a floater
@ -781,7 +782,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
}
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics, x, y, 0);
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
// Adjust the max-element-size in the metrics to take into
// account the margins around the block element. Note that we
@ -817,7 +818,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit,
else {
// Send the DidReflow() notification, but don't bother placing
// the frame
mFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
mFrame->DidReflow(mPresContext, &aReflowState, NS_FRAME_REFLOW_FINISHED);
fits = PR_FALSE;
}
}

View File

@ -76,11 +76,12 @@ public:
nsMargin& aComputedOffsets,
nsReflowStatus& aReflowStatus);
PRBool PlaceBlock(PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult /* out */,
nsRect& aInFlowBounds,
nsRect& aCombinedRect);
PRBool PlaceBlock(const nsHTMLReflowState& aReflowState,
PRBool aForceFit,
const nsMargin& aComputedOffsets,
nsCollapsingMargin& aBottomMarginResult /* out */,
nsRect& aInFlowBounds,
nsRect& aCombinedRect);
void AlignBlockHorizontally(nscoord aWidth, nsBlockHorizontalAlign&);

View File

@ -834,12 +834,13 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
*/
nsresult
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags)
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags)
{
nsPoint curOrigin;
nsRect bounds(aX, aY, aDesiredSize.width, aDesiredSize.height);
@ -863,7 +864,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
PositionChildViews(aPresContext, aKidFrame);
}
return aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
return aKidFrame->DidReflow(aPresContext, aReflowState, NS_FRAME_REFLOW_FINISHED);
}
/**

View File

@ -156,12 +156,13 @@ public:
* don't want to automatically sync the frame and view
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
*/
static nsresult FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags);
static nsresult FinishReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsHTMLReflowMetrics& aDesiredSize,
nscoord aX,
nscoord aY,
PRUint32 aFlags);
static void PositionChildViews(nsIPresContext* aPresContext,

View File

@ -269,7 +269,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
// Place and size the child and update the output metrics
kid->MoveTo(aPresContext, bp.left, bp.top);
kid->SizeTo(aPresContext, aMetrics.width, aMetrics.height);
kid->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
kid->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
aMetrics.width += lr;
aMetrics.height += tb;
aMetrics.ascent += bp.top;

View File

@ -84,6 +84,7 @@
#include "nsITableCellLayout.h"// "
#include "nsIGfxTextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPercentHeightObserver.h"
// For triple-click pref
#include "nsIPref.h"
@ -1767,8 +1768,9 @@ nsFrame::WillReflow(nsIPresContext* aPresContext)
}
NS_IMETHODIMP
nsFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("nsFrame::DidReflow: aStatus=%d", aStatus));
@ -1777,6 +1779,22 @@ nsFrame::DidReflow(nsIPresContext* aPresContext,
NS_FRAME_HAS_DIRTY_CHILDREN);
}
// Notify the percent height observer if this is an initial or resize constrained reflow
// and there is a percent height but no computed height. The observer may be able to
// initiate another reflow with a computed height. This happens in the case where a table
// cell has no computed height but can fabricate one when the cell height is known.
if (aReflowState && (aReflowState->mPercentHeightObserver) && // an observer
((eReflowReason_Initial == aReflowState->reason) || // initial or resize reflow
(eReflowReason_Resize == aReflowState->reason)) &&
(NS_UNCONSTRAINEDSIZE != aReflowState->availableWidth) && // constrained width reflow
((NS_UNCONSTRAINEDSIZE == aReflowState->mComputedHeight) || // no computed height
(0 == aReflowState->mComputedHeight)) &&
aReflowState->mStylePosition && // percent height
(eStyleUnit_Percent == aReflowState->mStylePosition->mHeight.GetUnit())) {
aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState);
}
return NS_OK;
}

View File

@ -301,8 +301,9 @@ public:
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,

View File

@ -603,7 +603,7 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
// Complete the reflow and position and size the child frame
nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
kidDesiredSize.width, kidDesiredSize.height);
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, rect.x, rect.y, 0);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize, rect.x, rect.y, 0);
// If the child frame was just inserted, then we're responsible for making sure
// it repaints

View File

@ -223,7 +223,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext* aPresContext,
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, root, view,
nsnull);
}
root->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
root->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
return NS_OK;

View File

@ -86,7 +86,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
: mReflowDepth(0)
{
NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context");
mFlags.mSpecialTableReflow = mFlags.mUnused = 0;
mFlags.mSpecialHeightReflow = mFlags.mUnused = 0;
parentReflowState = nsnull;
frame = aFrame;
reason = aReason;
@ -96,7 +96,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aRenderingContext;
mSpaceManager = nsnull;
mLineLayout = nsnull;
isTopOfPage = PR_FALSE;
mFlags.mIsTopOfPage = PR_FALSE;
mPercentHeightObserver = nsnull;
Init(aPresContext);
#ifdef IBMBIDI
mRightEdge = NS_UNCONSTRAINEDSIZE;
@ -114,7 +115,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
{
NS_PRECONDITION(nsnull != aRenderingContext, "no rendering context");
mFlags.mSpecialTableReflow = mFlags.mUnused = 0;
mFlags.mSpecialHeightReflow = mFlags.mUnused = 0;
reason = eReflowReason_Incremental;
parentReflowState = nsnull;
frame = aFrame;
@ -124,7 +125,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aRenderingContext;
mSpaceManager = nsnull;
mLineLayout = nsnull;
isTopOfPage = PR_FALSE;
mFlags.mIsTopOfPage = PR_FALSE;
mPercentHeightObserver = nsnull;
Init(aPresContext);
#ifdef IBMBIDI
mRightEdge = NS_UNCONSTRAINEDSIZE;
@ -154,7 +156,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aParentReflowState.rendContext;
mSpaceManager = aParentReflowState.mSpaceManager;
mLineLayout = aParentReflowState.mLineLayout;
isTopOfPage = aParentReflowState.isTopOfPage;
mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage;
mPercentHeightObserver = aParentReflowState.mPercentHeightObserver;
Init(aPresContext);
@ -182,7 +185,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aParentReflowState.rendContext;
mSpaceManager = aParentReflowState.mSpaceManager;
mLineLayout = aParentReflowState.mLineLayout;
isTopOfPage = aParentReflowState.isTopOfPage;
mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage;
mPercentHeightObserver = aParentReflowState.mPercentHeightObserver;
Init(aPresContext);
@ -211,7 +215,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
rendContext = aParentReflowState.rendContext;
mSpaceManager = aParentReflowState.mSpaceManager;
mLineLayout = aParentReflowState.mLineLayout;
isTopOfPage = aParentReflowState.isTopOfPage;
mFlags.mIsTopOfPage = aParentReflowState.mFlags.mIsTopOfPage;
mPercentHeightObserver = aParentReflowState.mPercentHeightObserver;
Init(aPresContext, aContainingBlockWidth, aContainingBlockHeight);
@ -226,8 +231,6 @@ nsHTMLReflowState::Init(nsIPresContext* aPresContext,
nscoord aContainingBlockHeight)
{
mCompactMarginWidth = 0;
mAlignCharOffset = 0;
mUseAlignCharOffset = 0;
#ifdef DEBUG
mDebugHook = nsnull;
#endif
@ -1871,12 +1874,12 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
}
}
// Check for blinking text and permission to display it
mBlinks = (parentReflowState && parentReflowState->mBlinks);
if (!mBlinks && BlinkIsAllowed()) {
mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks);
if (!mFlags.mBlinks && BlinkIsAllowed()) {
const nsStyleTextReset* st;
frame->GetStyleData(eStyleStruct_TextReset,
(const nsStyleStruct*&)st);
mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK);
mFlags.mBlinks = (st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK);
}
}

View File

@ -948,7 +948,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
psd->mReflowState->availableHeight);
reflowState.reason = reason;
reflowState.mLineLayout = this;
reflowState.isTopOfPage = GetFlag(LL_ISTOPOFPAGE);
reflowState.mFlags.mIsTopOfPage = GetFlag(LL_ISTOPOFPAGE);
SetFlag(LL_UNDERSTANDSNWHITESPACE, PR_FALSE);
SetFlag(LL_TEXTSTARTSWITHNBSP, PR_FALSE);
mTextJustificationNumSpaces = 0;
@ -1273,7 +1273,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
}
// Tell the frame that we're done reflowing it
aFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
aFrame->DidReflow(mPresContext, &reflowState, NS_FRAME_REFLOW_FINISHED);
if (aMetrics) {
*aMetrics = metrics;

View File

@ -1374,7 +1374,7 @@ nsObjectFrame::HandleChild(nsIPresContext* aPresContext,
}
ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, 0, 0, 0, status);
FinishReflowChild(child, aPresContext, kidDesiredSize, 0, 0, 0);
FinishReflowChild(child, aPresContext, &kidReflowState, kidDesiredSize, 0, 0, 0);
aMetrics.width = kidDesiredSize.width;
aMetrics.height = kidDesiredSize.height;
@ -1465,10 +1465,11 @@ nsObjectFrame::ContentChanged(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsObjectFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsObjectFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aStatus);
nsresult rv = nsObjectFrameSuper::DidReflow(aPresContext, aReflowState, aStatus);
// The view is created hidden; once we have reflowed it and it has been
// positioned then we show it.
@ -1708,7 +1709,7 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresContext> screenPcx;
shell->GetPresContext(getter_AddRefs(screenPcx));
nsDidReflowStatus status = NS_FRAME_REFLOW_FINISHED; // should we use a special status?
frame->DidReflow(screenPcx, status); // DidReflow will take care of it
frame->DidReflow(screenPcx, nsnull, status); // DidReflow will take care of it
return rv; // done with printing
}

View File

@ -66,8 +66,9 @@ public:
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,

View File

@ -183,7 +183,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
nsSize maxSize(mPD->mReflowRect.width - mPD->mReflowMargin.right - mPD->mReflowMargin.left,
mPD->mReflowRect.height - mPD->mReflowMargin.top - mPD->mReflowMargin.bottom);
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);
kidReflowState.isTopOfPage = PR_TRUE;
kidReflowState.mFlags.mIsTopOfPage = PR_TRUE;
kidReflowState.availableWidth = maxSize.width;
kidReflowState.availableHeight = maxSize.height;
@ -196,7 +196,7 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsIPresContext* aPresContext,
// Place and size the child
FinishReflowChild(frame, aPresContext, aDesiredSize, xc, yc, 0);
FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, xc, yc, 0);
// Make sure the child is at least as tall as our max size (the containing window)
if (aDesiredSize.height < aReflowState.availableHeight) {

View File

@ -2686,7 +2686,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
@ -2823,7 +2823,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
nsIFrameDebug* frameDebug;
@ -3366,7 +3366,7 @@ PresShell::StyleChangeReflow()
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, view,
nsnull);
}
rootFrame->DidReflow(mPresContext, NS_FRAME_REFLOW_FINISHED);
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
#ifdef NS_DEBUG
if (nsIFrameDebug::GetVerifyTreeEnable()) {
nsIFrameDebug* frameDebug;

View File

@ -352,15 +352,16 @@ nsScrollFrame::RemoveFrame(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsScrollFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsScrollFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = NS_OK;
if (NS_FRAME_REFLOW_FINISHED == aStatus) {
// Let the default nsFrame implementation clear the state flags
// and size and position our view
rv = nsFrame::DidReflow(aPresContext, aStatus);
rv = nsFrame::DidReflow(aPresContext, aReflowState, aStatus);
// Have the scrolling view layout
nsIScrollableView* scrollingView;
@ -939,8 +940,8 @@ nsScrollFrame::Reflow(nsIPresContext* aPresContext,
}
// Place and size the child.
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, border.left,
border.top, NS_FRAME_NO_MOVE_VIEW);
FinishReflowChild(kidFrame, aPresContext, &kidReflowState, kidDesiredSize,
border.left, border.top, NS_FRAME_NO_MOVE_VIEW);
// Compute our desired size
aDesiredSize.width = scrollAreaSize.width;

View File

@ -88,8 +88,9 @@ public:
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

View File

@ -391,7 +391,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
// max width then center it horizontally
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, x, y, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, x, y, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, x, y, 0);
y += kidSize.height;
// Leave a slight gap between the pages

View File

@ -5050,7 +5050,7 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
// the TEXT_BLINK_ON bit).
PRBool lastTimeWeSkippedLeadingWS = 0 != (mState & TEXT_SKIP_LEADING_WS);
mState &= ~TEXT_REFLOW_FLAGS;
if (aReflowState.mBlinks) {
if (aReflowState.mFlags.mBlinks) {
if (0 == (mState & TEXT_BLINK_ON)) {
mState |= TEXT_BLINK_ON;
nsBlinkTimer::AddBlinkFrame(aPresContext, this);

View File

@ -417,7 +417,7 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext* aPresContext,
aKidFrame->GetView(aPresContext, &kidView);
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame, kidView,
&kidDesiredSize.mOverflowArea);
aKidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aKidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
return rv;
}
@ -576,7 +576,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
kidRect.width = kidDesiredSize.width;
kidRect.height = kidDesiredSize.height;
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, 0, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidDesiredSize, 0, 0, 0);
}
// If it's a 'initial', 'resize', or 'style change' reflow command (anything

View File

@ -238,8 +238,9 @@ public:
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD Init(nsIPresContext* aPresContext,
nsIContent* aContent,
@ -532,7 +533,8 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
}
// Place and size the child
FinishReflowChild(firstChild, aPresContext, kidMetrics, offset.x, offset.y, 0);
FinishReflowChild(firstChild, aPresContext, nsnull,
kidMetrics, offset.x, offset.y, 0);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsHTMLFrameOuterFrame::Reflow: size=%d,%d status=%x",
@ -962,10 +964,11 @@ nsHTMLFrameInnerFrame::GetParentContent(nsIContent*& aContent)
}
NS_IMETHODIMP
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsHTMLFrameInnerFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsLeafFrame::DidReflow(aPresContext, nsnull, aStatus);
// The view is created hidden; once we have reflowed it and it has been

View File

@ -1013,7 +1013,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
// Place and size the child
metrics.width = aSize.width;
metrics.height = aSize.height;
FinishReflowChild(aChild, aPresContext, metrics, aOffset.x, aOffset.y, 0);
FinishReflowChild(aChild, aPresContext, nsnull, metrics, aOffset.x, aOffset.y, 0);
}
static

View File

@ -672,7 +672,8 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY, aStatus);
// Set the child's width and height to it's desired size
FinishReflowChild(aFrame, aPresContext, aDesiredSize, rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
FinishReflowChild(aFrame, aPresContext, &kidReflowState, aDesiredSize,
rect.x, rect.y, NS_FRAME_NO_MOVE_VIEW |NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
return rv;
}

View File

@ -425,7 +425,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
availSize.width = mLegendRect.width;
}
FinishReflowChild(mLegendFrame, aPresContext, legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState,
legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
}
}
@ -480,7 +481,8 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace);
}
FinishReflowChild(mContentFrame, aPresContext, kidDesiredSize, contentRect.x, contentRect.y, 0);
FinishReflowChild(mContentFrame, aPresContext, &kidReflowState,
kidDesiredSize, contentRect.x, contentRect.y, 0);
nsFrameState kidState;
mContentFrame->GetFrameState(&kidState);

View File

@ -400,7 +400,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus status;
rv = mTextFrame->Reflow(aPresContext, txtKidSize, txtKidReflowState, status);
if (NS_FAILED(rv)) return rv;
rv = mTextFrame->DidReflow(aPresContext, aStatus);
rv = mTextFrame->DidReflow(aPresContext, &txtKidReflowState, aStatus);
if (NS_FAILED(rv)) return rv;
// now adjust the frame positions

View File

@ -501,10 +501,11 @@ nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsFormControlFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsLeafFrame::DidReflow(aPresContext, aReflowState, aStatus);
// The view is created hidden; once we have reflowed it and it has been

View File

@ -126,8 +126,9 @@ public:
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
/**
* Respond to the request to resize and/or reflow

View File

@ -637,7 +637,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
}
// Place the child
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
FinishReflowChild(firstKid, aPresContext, &reflowState, aDesiredSize,
focusPadding.left + aReflowState.mComputedBorderPadding.right,
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);

View File

@ -2411,19 +2411,20 @@ nsListControlFrame::GetScrollingParentView(nsIPresContext* aPresContext,
//---------------------------------------------------------
NS_IMETHODIMP
nsListControlFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsListControlFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
if (PR_TRUE == IsInDropDownMode())
{
//SyncViewWithFrame();
mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW;
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
mState |= NS_FRAME_SYNC_FRAME_AND_VIEW;
SyncViewWithFrame(aPresContext);
return rv;
} else {
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
PRInt32 selectedIndex = mEndSelectionIndex;
if (selectedIndex == kNothingSelected) {
GetSelectedIndex(&selectedIndex);

View File

@ -206,7 +206,9 @@ public:
nsIStyleContext* aContext,
nsIFrame* aPrevInFlow);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext, nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD Destroy(nsIPresContext *aPresContext);

View File

@ -77,7 +77,7 @@
nsTableCellFrame::nsTableCellFrame()
{
mColIndex = 0;
mBits.mColIndex = 0;
mPriorAvailWidth = 0;
#ifdef DEBUG_TABLE_REFLOW_TIMING
mTimer = new nsReflowTimer(this);
@ -131,6 +131,48 @@ nsTableCellFrame::Init(nsIPresContext* aPresContext,
return rv;
}
static PRBool
NoComputedHeightBetween(const nsHTMLReflowState& aReflowState,
nsIFrame* aCellFrame)
{
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) {
if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) || (0 != rs->mComputedHeight)) {
return PR_FALSE;
}
// stop when we hit the cell frame
if (rs->frame == aCellFrame) {
return PR_TRUE;
}
}
NS_ASSERTION(PR_FALSE, "program error in NoComputedHeightBetween");
return PR_FALSE;
}
// nsIPercentHeightObserver methods
nsresult
nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
{
if (!HadSpecialReflow()) {
// Only initiate a special reflow if we will be able to construct a computed height
// on the cell that will result in the frame getting a computed height. This can only
// happen (but not sufficient) if there no computed height already set between the
// initiating frame and the cell.
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) {
if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) && (0 != rs->mComputedHeight)) {
return NS_OK;
}
// stop when we reach the cell frame
if (rs->frame == this) {
nsTableFrame::NotifyAncestorsOfSpecialReflow((nsIFrame&)*this);
SetNeedSpecialReflow(PR_TRUE);
return NS_OK;
}
}
NS_ASSERTION(PR_FALSE, "program error in NotifyPercentHeight");
}
return NS_OK;
}
nsresult
nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex) const
@ -156,7 +198,7 @@ nsTableCellFrame::GetColIndex(PRInt32 &aColIndex) const
return ((nsTableCellFrame*)GetFirstInFlow())->GetColIndex(aColIndex);
}
else {
aColIndex = mColIndex;
aColIndex = mBits.mColIndex;
return NS_OK;
}
}
@ -246,7 +288,7 @@ void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
nsresult nsTableCellFrame::SetColIndex(PRInt32 aColIndex)
{
mColIndex = aColIndex;
mBits.mColIndex = aColIndex;
// for style context optimization, set the content's column index if possible.
// this can only be done if we really have an nsTableCell.
// other tags mapped to table cell display won't benefit from this optimization
@ -766,7 +808,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
(0 == aReflowState.mComputedHeight)) &&
!mPrevInFlow &&
nsTableFrame::IsPctHeight(mStyleContext)) {
nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState);
nsTableFrame::NotifyAncestorsOfSpecialReflow(*this);
SetNeedSpecialReflow(PR_TRUE);
}
// this should probably be cached somewhere
@ -851,7 +893,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
aPresContext->IsPaginated(&isPaginated);
nscoord computedPaginatedHeight = 0;
if (aReflowState.mFlags.mSpecialTableReflow || (eReflowReason_Incremental == aReflowState.reason)) {
if (aReflowState.mFlags.mSpecialHeightReflow ||
(HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) {
((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
DISPLAY_REFLOW_CHANGE();
}
@ -866,6 +909,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
SetHasPctOverHeight(PR_FALSE);
}
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize);
// mIPercentHeightObserver is for non table related frames inside cells
kidReflowState.mPercentHeightObserver = (nsIPercentHeightObserver *)this;
// If it was a style change targeted at us, then reflow the child using
// the special reflow reason
@ -899,8 +944,10 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState);
#endif
nscoord priorBlockHeight = GetLastBlockHeight();
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
kidOrigin.x, kidOrigin.y, 0, aStatus);
SetLastBlockHeight(kidSize.height);
if (isStyleChanged) {
Invalidate(aPresContext, mRect);
}
@ -990,7 +1037,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
// NS_ASSERTION(kidSize.width <= availSize.width, "child needed more space during resize reflow");
//}
// Place the child
FinishReflowChild(firstKid, aPresContext, kidSize,
FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize,
kidOrigin.x, kidOrigin.y, 0);
// first, compute the height which can be set w/o being restricted by aMaxSize.height
@ -1041,26 +1088,21 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
}
}
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
if (aDesiredSize.height > mRect.height) {
// set a bit and frame property indicating that the pct height contents exceeded
// set a bit indicating that the pct height contents exceeded
// the height that they could honor in the pass 2 reflow
SetHasPctOverHeight(PR_TRUE);
SetPctOverHeightValue(aPresContext, aDesiredSize.height);
}
aDesiredSize.height = mRect.height;
SetNeedSpecialReflow(PR_FALSE);
SetHadSpecialReflow(PR_TRUE);
}
else if ((eReflowReason_Incremental == aReflowState.reason) && HasPctOverHeight()) {
nscoord overValue;
GetPctOverHeightValue(aPresContext, overValue);
// if the pct over height value hasn't changed, use the last height of the cell, otherwise ignore it
if (aDesiredSize.height == overValue) {
else if (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason)) {
// if the block height value hasn't changed, use the last height of the cell, otherwise ignore it
if (GetLastBlockHeight() == priorBlockHeight) {
aDesiredSize.height = mRect.height;
}
else {
SetHasPctOverHeight(PR_FALSE);
}
}
else if (computedPaginatedHeight > 0) {
nscoord height = computedPaginatedHeight + topInset + bottomInset - CalcHeightOfPrevInFlows(*this);
@ -1277,6 +1319,10 @@ nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr
*aInstancePtr = (void*) (nsITableCellLayout *)this;
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) {
*aInstancePtr = (void*) (nsIPercentHeightObserver *)this;
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
@ -1305,7 +1351,7 @@ nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)
aColIndex = 0;
return res;
}
aColIndex = mColIndex;
aColIndex = mBits.mColIndex;
return NS_OK;
}
@ -1447,27 +1493,6 @@ void nsTableCellFrame::GetCollapseOffset(nsIPresContext* aPresContext,
}
}
void nsTableCellFrame::SetPctOverHeightValue(nsIPresContext* aPresContext,
nscoord aValue)
{
// Get the property
nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty, PR_TRUE);
if (value) {
*value = aValue;
}
}
void nsTableCellFrame::GetPctOverHeightValue(nsIPresContext* aPresContext,
nscoord& aValue)
{
aValue = 0;
// See if the property is set
nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty);
if (value) {
aValue = *value;
}
}
#ifdef DEBUG
NS_IMETHODIMP
nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const

View File

@ -42,6 +42,7 @@
#include "nsHTMLContainerFrame.h"
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
#include "nsIStyleContext.h"
#include "nsIPercentHeightObserver.h"
class nsTableFrame;
class nsHTMLValue;
@ -51,7 +52,8 @@ class nsHTMLValue;
*/
#define NS_TABLE_CELL_CONTENT_EMPTY 0x80000000
#define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000
#define NS_TABLE_CELL_PCT_OVER_HEIGHT 0x20000000
#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000
#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000
/**
* nsTableCellFrame
@ -64,7 +66,9 @@ class nsHTMLValue;
*
* @author sclark
*/
class nsTableCellFrame : public nsHTMLContainerFrame, public nsITableCellLayout
class nsTableCellFrame : public nsHTMLContainerFrame,
public nsITableCellLayout,
public nsIPercentHeightObserver
{
public:
@ -111,6 +115,8 @@ public:
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState);
void InitCellFrame(PRInt32 aColIndex);
@ -244,17 +250,20 @@ public:
PRBool NeedSpecialReflow();
void SetNeedSpecialReflow(PRBool aContentEmpty);
PRBool HadSpecialReflow();
void SetHadSpecialReflow(PRBool aValue);
PRBool HasPctOverHeight();
void SetHasPctOverHeight(PRBool aValue);
nscoord GetLastBlockHeight();
void SetLastBlockHeight(nscoord aValue);
// The collapse offset is (0,0) except for cells originating in a row/col which is collapsed
void SetCollapseOffsetX(nsIPresContext* aPresContext, nscoord aXOffset);
void SetCollapseOffsetY(nsIPresContext* aPresContext, nscoord aYOffset);
void GetCollapseOffset(nsIPresContext* aPresContext, nsPoint& aOffset);
void SetPctOverHeightValue(nsIPresContext* aPresContext, nscoord aValue);
void GetPctOverHeightValue(nsIPresContext* aPresContext, nscoord& aValue);
nsTableCellFrame* GetNextCell() const;
protected:
@ -291,6 +300,10 @@ protected:
protected:
struct Bits {
PRUint32 mColIndex:15;
PRUint32 mLastBlockHeight:17;
} mBits;
PRInt32 mColIndex; // the starting column for this cell
// XXX these could be stored as pixels for a savings of 6 x 2 bytes
@ -369,21 +382,45 @@ inline void nsTableCellFrame::SetNeedSpecialReflow(PRBool aValue)
}
}
inline PRBool nsTableCellFrame::HadSpecialReflow()
{
return (mState & NS_TABLE_CELL_HAD_SPECIAL_REFLOW) ==
NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
}
inline void nsTableCellFrame::SetHadSpecialReflow(PRBool aValue)
{
if (aValue) {
mState |= NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
} else {
mState &= ~NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
}
}
inline PRBool nsTableCellFrame::HasPctOverHeight()
{
return (mState & NS_TABLE_CELL_PCT_OVER_HEIGHT) ==
NS_TABLE_CELL_PCT_OVER_HEIGHT;
return (mState & NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT) ==
NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
}
inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue)
{
if (aValue) {
mState |= NS_TABLE_CELL_PCT_OVER_HEIGHT;
mState |= NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
} else {
mState &= ~NS_TABLE_CELL_PCT_OVER_HEIGHT;
mState &= ~NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
}
}
inline nscoord nsTableCellFrame::GetLastBlockHeight()
{
return (nscoord)mBits.mLastBlockHeight;
}
inline void nsTableCellFrame::SetLastBlockHeight(nscoord aValue)
{
mBits.mLastBlockHeight = aValue;
}
#endif

View File

@ -503,7 +503,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, 0, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, 0, 0, 0);
}
aDesiredSize.width=0;
@ -608,7 +608,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext* aPresC
nsSize(aReflowState.availableWidth,
aReflowState.availableHeight));
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, aStatus);
aNextFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aNextFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
if (NS_FAILED(rv))
return rv;

View File

@ -1580,7 +1580,7 @@ PRBool nsTableFrame::NeedsReflow(const nsHTMLReflowState& aReflowState)
{
PRBool result = PR_TRUE;
if (eReflowReason_Resize == aReflowState.reason) {
if (aReflowState.mFlags.mSpecialTableReflow &&
if (aReflowState.mFlags.mSpecialHeightReflow &&
!NeedSpecialReflow() &&
!NeedToInitiateSpecialReflow()) {
result = PR_FALSE;
@ -1816,26 +1816,25 @@ ProcessRowInserted(nsIPresContext* aPresContext,
}
void
nsTableFrame::NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState)
nsTableFrame::NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame)
{
const nsHTMLReflowState* rs = aReflowState.parentReflowState;
while (rs) {
nsIFrame* parent;
for (aFrame.GetParent(&parent); parent; parent->GetParent(&parent)) {
nsCOMPtr<nsIAtom> frameType;
rs->frame->GetFrameType(getter_AddRefs(frameType));
parent->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::tableCellFrame == frameType.get()) {
((nsTableCellFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE);
((nsTableCellFrame*)parent)->SetNeedSpecialReflow(PR_TRUE);
}
else if (nsLayoutAtoms::tableRowFrame == frameType.get()) {
((nsTableRowFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE);
((nsTableRowFrame*)parent)->SetNeedSpecialReflow(PR_TRUE);
}
else if (nsLayoutAtoms::tableRowGroupFrame == frameType.get()) {
((nsTableRowGroupFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE);
((nsTableRowGroupFrame*)parent)->SetNeedSpecialReflow(PR_TRUE);
}
else if (nsLayoutAtoms::tableFrame == frameType.get()) {
((nsTableFrame*)rs->frame)->SetNeedToInitiateSpecialReflow(PR_TRUE);
((nsTableFrame*)parent)->SetNeedToInitiateSpecialReflow(PR_TRUE);
break;
}
rs = rs->parentReflowState;
}
}
@ -1969,7 +1968,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if ( ((NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) ||
(0 == aReflowState.mComputedHeight)) &&
IsPctHeight(mStyleContext) && IsSpecialNested(aReflowState)) {
NotifyAncestorsOfSpecialReflow(aReflowState);
NotifyAncestorsOfSpecialReflow(*this);
SetNeedSpecialReflow(PR_TRUE);
}
// see if an extra reflow will be necessary in pagination mode when there is a specified table height
@ -1982,21 +1981,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
}
// if we need to reflow the table an extra time, then don't constrain the height of the previous reflow
nscoord availHeight = !aReflowState.mFlags.mSpecialTableReflow &&
nscoord availHeight = !aReflowState.mFlags.mSpecialHeightReflow &&
(NeedSpecialReflow() | NeedToInitiateSpecialReflow())
? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight;
ReflowTable(aPresContext, aDesiredSize, aReflowState, availHeight, nextReason, doCollapse, balanced, aStatus);
if (!aReflowState.mFlags.mSpecialTableReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) {
if (!aReflowState.mFlags.mSpecialHeightReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) {
aDesiredSize.height = CalcDesiredHeight(aPresContext, aReflowState); // distributes extra vertical space to rows
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_TRUE;
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_TRUE;
ReflowTable(aPresContext, aDesiredSize, aReflowState, aReflowState.availableHeight,
nextReason, doCollapse, balanced, aStatus);
haveDesiredHeight = PR_TRUE;
}
}
else if (aReflowState.mFlags.mSpecialTableReflow) {
else if (aReflowState.mFlags.mSpecialHeightReflow) {
aDesiredSize.width = mRect.width;
aDesiredSize.height = mRect.height;
#if defined DEBUG_TABLE_REFLOW_TIMING
@ -2060,7 +2059,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
}
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
SetNeedSpecialReflow(PR_FALSE);
SetNeedToInitiateSpecialReflow(PR_FALSE);
}
@ -2846,7 +2845,7 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// the footer frame as well. We'll adjust the footer frame later on in
// AdjustSiblingsAfterReflow()
nsRect kidRect(aReflowState.x, aReflowState.y, desiredSize.width, desiredSize.height);
FinishReflowChild(aNextFrame, aPresContext, desiredSize, aReflowState.x, aReflowState.y, 0);
FinishReflowChild(aNextFrame, aPresContext, nsnull, desiredSize, aReflowState.x, aReflowState.y, 0);
#ifndef TABLE_REFLOW_COALESCING_OFF
// update the descendant reflow counts and determine if we need to request a timeout reflow
@ -2923,7 +2922,7 @@ void nsTableFrame::PlaceChild(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize)
{
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState.x, aReflowState.y, 0);
FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, aReflowState.x, aReflowState.y, 0);
// Adjust the running y-offset
aReflowState.y += aDesiredSize.height;
@ -3188,7 +3187,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, unusedDesiredSize, kidReflowState,
0, 0, 0, status);
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
}
else if (childX < numRowGroups) { // it is a row group but isn't being reflowed
@ -3214,7 +3213,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
aReflowState.availSize, aReflowState.reason);
nsReflowStatus cgStatus;
ReflowChild(kidFrame, aPresContext, kidMet, kidReflowState, 0, 0, 0, cgStatus);
FinishReflowChild(kidFrame, aPresContext, kidMet, 0, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidMet, 0, 0, 0);
}
SetHaveReflowedColGroups(PR_TRUE);
}
@ -4662,7 +4661,7 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame,
PrettyUC(aState.availableWidth, width);
PrettyUC(aState.availableHeight, height);
printf("r=%d ", aState.reason);
if (aState.mFlags.mSpecialTableReflow) {
if (aState.mFlags.mSpecialHeightReflow) {
printf("special ");
}
printf("a=%s,%s ", width, height);
@ -5086,10 +5085,6 @@ nsTableFrame::GetProperty(nsIPresContext* aPresContext,
value = new nsPoint(0, 0);
dtorFunc = DestroyPointFunc;
}
else if (aPropertyName == nsLayoutAtoms::cellPctOverHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;
}
else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;

View File

@ -212,7 +212,7 @@ public:
float aPixelToTwips,
nsPixelRound aRound= eAlwaysRoundUp);
static void NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState);
static void NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame);
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;

View File

@ -955,6 +955,8 @@ nsTableOuterFrame::OuterReflowChild(nsIPresContext* aPresContext,
nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame,
nsSize(availWidth, availHeight));
childRS.reason = aReflowReason;
childRS.mPercentHeightObserver = nsnull; // the observer is for non table related frames inside cells
// If mComputedWidth > availWidth and availWidth >= minWidth for a nested percent table
// then adjust mComputedWidth based on availableWidth if this isn't the intial reflow
@ -1137,7 +1139,7 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex
GetInnerOrigin(aPresContext, captionSide, containSize, captionSize,
captionMargin, innerSize, innerMargin, innerOrigin);
rv = FinishReflowChild(mInnerTableFrame, aPresContext, innerMet,
rv = FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet,
innerOrigin.x, innerOrigin.y, 0);
if (NS_FAILED(rv)) return rv;
@ -1156,7 +1158,7 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex
MoveFrameTo(aPresContext, mInnerTableFrame, innerOrigin.x, innerOrigin.y);
}
rv = FinishReflowChild(mCaptionFrame, aPresContext, captionMet,
rv = FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet,
captionOrigin.x, captionOrigin.y, 0);
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto,
@ -1328,7 +1330,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext,
GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize,
innerMargin, captionSize, captionMargin, captionOrigin);
FinishReflowChild(mCaptionFrame, aPresContext, captionMet,
FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet,
captionOrigin.x, captionOrigin.y, 0);
GetInnerOrigin(aPresContext, captionSide, containSize, captionSize,
@ -1358,7 +1360,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext,
captionMargin, innerSize, innerMargin, innerOrigin);
}
FinishReflowChild(mInnerTableFrame, aPresContext, innerMet,
FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet,
innerOrigin.x, innerOrigin.y, 0);
UpdateReflowMetrics(captionSide, aOuterMet, innerMargin, innerMarginNoAuto,
@ -1418,7 +1420,7 @@ nsTableOuterFrame::IR_CaptionInserted(nsIPresContext* aPresContext,
GetInnerOrigin(aPresContext, captionSide, containSize, captionSize,
captionMargin, innerSize, innerMargin, innerOrigin);
rv = FinishReflowChild(mInnerTableFrame, aPresContext, innerMet,
rv = FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet,
innerOrigin.x, innerOrigin.y, 0);
if (NS_FAILED(rv)) return rv;
GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize,
@ -1436,7 +1438,7 @@ nsTableOuterFrame::IR_CaptionInserted(nsIPresContext* aPresContext,
MoveFrameTo(aPresContext, mInnerTableFrame, innerOrigin.x, innerOrigin.y);
}
rv = FinishReflowChild(mCaptionFrame, aPresContext, captionMet,
rv = FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet,
captionOrigin.x, captionOrigin.y, 0);
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto,
@ -1548,7 +1550,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
mCaptionFrame->WillReflow(aPresContext);
rv = mCaptionFrame->Reflow(aPresContext, captionMet, captionReflowState, aStatus);
mCaptionFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
mCaptionFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
mMinCaptionWidth = maxElementSize.width;
}
}
@ -1586,7 +1588,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
GetCaptionOrigin(aPresContext, captionSide, containSize, innerSize,
innerMargin, captionSize, captionMargin, captionOrigin);
FinishReflowChild(mCaptionFrame, aPresContext, captionMet,
FinishReflowChild(mCaptionFrame, aPresContext, nsnull, captionMet,
captionOrigin.x, captionOrigin.y, 0);
GetInnerOrigin(aPresContext, captionSide, containSize, captionSize,
@ -1599,7 +1601,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
captionMargin, innerSize, innerMargin, innerOrigin);
}
FinishReflowChild(mInnerTableFrame, aPresContext, innerMet,
FinishReflowChild(mInnerTableFrame, aPresContext, nsnull, innerMet,
innerOrigin.x, innerOrigin.y, 0);
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, innerMarginNoAuto,

View File

@ -936,7 +936,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
if (aDirtyOnly && ((frameState & NS_FRAME_IS_DIRTY) == 0)) {
doReflowChild = PR_FALSE;
}
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
if (!isPaginated && (nsLayoutAtoms::tableCellFrame == frameType.get() &&
!((nsTableCellFrame*)kidFrame)->NeedSpecialReflow())) {
kidFrame = iter.Next();
@ -981,7 +981,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
(cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) ||
(eReflowReason_StyleChange == aReflowState.reason) ||
isPaginated ||
(aReflowState.mFlags.mSpecialTableReflow && cellFrame->NeedSpecialReflow()) ||
(aReflowState.mFlags.mSpecialHeightReflow && cellFrame->NeedSpecialReflow()) ||
HasPctHeight() ||
notifyStyleChange ){
// Reflow the cell to fit the available width, height
@ -1088,7 +1088,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
desiredSize.width = PR_MAX(availCellWidth, availColWidth);
}
FinishReflowChild(kidFrame, aPresContext, desiredSize, x, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, desiredSize, x, 0, 0);
x += desiredSize.width;
}
else {// it's an unknown frame type, give it a generic reflow and ignore the results
@ -1097,7 +1097,7 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status);
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
}
else if (nsLayoutAtoms::tableCellFrame == frameType.get()) {
@ -1323,7 +1323,7 @@ nsTableRowFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// Now place the child
cellMet.width = colAvailWidth;
FinishReflowChild(aNextFrame, aPresContext, cellMet, cellOrigin.x, 0, 0);
FinishReflowChild(aNextFrame, aPresContext, nsnull, cellMet, cellOrigin.x, 0, 0);
// Notify the table if the cell width changed so it can decide whether to rebalance
if (!aDesiredSize.mNothingChanged) {
@ -1399,7 +1399,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
if (nsLayoutAtoms::tableRowGroupFrame == fType.get()) {
nscoord pctBasis = ((nsTableRowGroupFrame*)parentRS->frame)->GetHeightBasis(*parentRS);
if (0 == pctBasis) {
nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState);
nsTableFrame::NotifyAncestorsOfSpecialReflow(*this);
SetNeedSpecialReflow(PR_TRUE);
}
}
@ -1430,7 +1430,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
// just set our width to what was available. The table will calculate the width and not use our value.
aDesiredSize.width = aReflowState.availableWidth;
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
SetNeedSpecialReflow(PR_FALSE);
}
@ -1500,7 +1500,7 @@ nsTableRowFrame::ReflowCellFrame(nsIPresContext* aPresContext,
// XXX What happens if this cell has 'vertical-align: baseline' ?
// XXX Why is it assumed that the cell's ascent hasn't changed ?
aCellFrame->VerticallyAlignChild(aPresContext, aReflowState, mMaxCellAscent);
aCellFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aCellFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
return desiredSize.height;
}

View File

@ -341,7 +341,7 @@ nsTableRowGroupFrame::PlaceChild(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize)
{
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, 0, aReflowState.y, 0);
FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, 0, aReflowState.y, 0);
// Adjust the running y-offset
aReflowState.y += aDesiredSize.height;
@ -392,7 +392,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext,
if (aDirtyOnly && ((frameState & NS_FRAME_IS_DIRTY) == 0)) {
doReflowChild = PR_FALSE;
}
if (aReflowState.reflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.reflowState.mFlags.mSpecialHeightReflow) {
if (!isPaginated && (nsLayoutAtoms::tableRowFrame == kidType.get() &&
!((nsTableRowFrame*)kidFrame)->NeedSpecialReflow())) {
doReflowChild = PR_FALSE;
@ -436,7 +436,7 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext,
// If this isn't the first row frame, then we can't be at the top of
// the page anymore...
if (kidFrame != GetFirstFrame()) {
kidReflowState.isTopOfPage = PR_FALSE;
kidReflowState.mFlags.mIsTopOfPage = PR_FALSE;
}
rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
@ -1024,7 +1024,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext* aPresContext,
rv = ReflowChild(rowFrame, aPresContext, desiredSize, rowReflowState,
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
rowFrame->SizeTo(aPresContext, desiredSize.width, desiredSize.height);
rowFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
rowFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
rowFrame->DidResize(aPresContext, aReflowState);
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
@ -1137,7 +1137,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
// Check for an overflow list
MoveOverflowToChildList(aPresContext);
if (isPaginated && aReflowState.mFlags.mSpecialTableReflow) {
if (isPaginated && aReflowState.mFlags.mSpecialHeightReflow) {
// cache row height info for printing, now that row heights are known.
CacheRowHeightsForPrinting(aPresContext, GetFirstRow());
}
@ -1158,7 +1158,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
// reflow, then we need to do this because the table will skip the pass 2 reflow,
// but we need to correctly calculate the row group height and we can't if there
// are row spans unless we do this step
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
DidResizeRows(*aPresContext, aReflowState);
}
else if ((eReflowReason_Initial != aReflowState.reason) ||
@ -1171,18 +1171,18 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
// See if all the frames fit
if (aDesiredSize.height > aReflowState.availableHeight) {
// Nope, find a place to split the row group
PRBool specialReflow = (PRBool)aReflowState.mFlags.mSpecialTableReflow;
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_FALSE;
PRBool specialReflow = (PRBool)aReflowState.mFlags.mSpecialHeightReflow;
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_FALSE;
SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus);
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = specialReflow;
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = specialReflow;
}
}
SetHasStyleHeight((NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) &&
(aReflowState.mComputedHeight > 0));
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
SetNeedSpecialReflow(PR_FALSE);
}

View File

@ -1198,7 +1198,7 @@ nsMathMLContainerFrame::PlaceTokenFor(nsIFrame* aFrame,
// place and size the child
dy = aDesiredSize.ascent - rect.y;
NS_STATIC_CAST(nsMathMLContainerFrame*,
aFrame)->FinishReflowChild(childFrame, aPresContext,
aFrame)->FinishReflowChild(childFrame, aPresContext, nsnull,
childSize, dx, dy, 0);
dx += rect.width;
childFrame->GetNextSibling(&childFrame);
@ -1537,7 +1537,7 @@ nsMathMLContainerFrame::Place(nsIPresContext* aPresContext,
GetItalicCorrection(bmChild, leftCorrection, italicCorrection);
// add left correction
dx += leftCorrection;
FinishReflowChild(childFrame, aPresContext, childSize, dx, dy, 0);
FinishReflowChild(childFrame, aPresContext, nsnull, childSize, dx, dy, 0);
// add child size + italic correction
dx += bmChild.width + italicCorrection;
childFrame->GetNextSibling(&childFrame);

View File

@ -123,12 +123,13 @@ public:
nsReflowStatus& aStatus);
NS_IMETHOD
DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
mEmbellishData.flags &= ~NS_MATHML_STRETCH_DONE;
return nsHTMLContainerFrame::DidReflow(aPresContext, aStatus);
return nsHTMLContainerFrame::DidReflow(aPresContext, aReflowState, aStatus);
}
NS_IMETHOD

View File

@ -386,7 +386,7 @@ nsMathMLmactionFrame::Place(nsIPresContext* aPresContext,
if (childFrame) {
GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics);
if (aPlaceOrigin) {
FinishReflowChild(childFrame, aPresContext, aDesiredSize, 0, 0, 0);
FinishReflowChild(childFrame, aPresContext, nsnull, aDesiredSize, 0, 0, 0);
}
mReference.x = 0;
mReference.y = aDesiredSize.ascent;

View File

@ -388,7 +388,7 @@ nsMathMLmfencedFrame::Reflow(nsIPresContext* aPresContext,
else
mBoundingMetrics += bm;
FinishReflowChild(childFrame, aPresContext, childSize,
FinishReflowChild(childFrame, aPresContext, nsnull, childSize,
dx, aDesiredSize.ascent - childSize.ascent, 0);
dx += childSize.width;

View File

@ -372,10 +372,10 @@ nsMathMLmfracFrame::Place(nsIPresContext* aPresContext,
nscoord dy;
// place numerator
dy = 0;
FinishReflowChild(frameNum, aPresContext, sizeNum, dxNum, dy, 0);
FinishReflowChild(frameNum, aPresContext, nsnull, sizeNum, dxNum, dy, 0);
// place denominator
dy = aDesiredSize.height - sizeDen.height;
FinishReflowChild(frameDen, aPresContext, sizeDen, dxDen, dy, 0);
FinishReflowChild(frameDen, aPresContext, nsnull, sizeDen, dxDen, dy, 0);
// place the fraction bar - dy is top of bar
dy = aDesiredSize.ascent - (axisHeight + actualRuleThickness/2);
mLineRect.SetRect(onePixel, dy, width - 2*onePixel, actualRuleThickness);

View File

@ -392,7 +392,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext,
// place the base ...
childFrame = baseFrame;
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, baseSize, dx, dy, 0);
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
dx += bmBase.width + mScriptSpace + italicCorrection;
}
else if (mprescriptsFrame != childFrame) {
@ -415,12 +415,12 @@ nsMathMLmmultiscriptsFrame::Place(nsIPresContext* aPresContext,
dy = aDesiredSize.ascent - subScriptSize.ascent +
maxSubScriptShift;
FinishReflowChild (subScriptFrame, aPresContext, subScriptSize,
FinishReflowChild (subScriptFrame, aPresContext, nsnull, subScriptSize,
dx + (width-subScriptSize.width)/2, dy, 0);
dy = aDesiredSize.ascent - supScriptSize.ascent -
maxSupScriptShift;
FinishReflowChild (supScriptFrame, aPresContext, supScriptSize,
FinishReflowChild (supScriptFrame, aPresContext, nsnull, supScriptSize,
dx + (width-supScriptSize.width)/2, dy, 0);
dx += mScriptSpace + width;

View File

@ -414,9 +414,9 @@ nsMathMLmoverFrame::Place(nsIPresContext* aPresContext,
if (aPlaceOrigin) {
// place base
FinishReflowChild (baseFrame, aPresContext, baseSize, dxBase, dyBase, 0);
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dxBase, dyBase, 0);
// place overscript
FinishReflowChild (overFrame, aPresContext, overSize, dxOver, dyOver, 0);
FinishReflowChild (overFrame, aPresContext, nsnull, overSize, dxOver, dyOver, 0);
}
return NS_OK;
}

View File

@ -338,7 +338,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext,
// place the index
dx = dxIndex;
dy = aDesiredSize.ascent - (indexRaisedAscent + indexSize.ascent - bmIndex.ascent);
FinishReflowChild(indexFrame, aPresContext, indexSize, dx, dy, 0);
FinishReflowChild(indexFrame, aPresContext, nsnull, indexSize, dx, dy, 0);
// place the radical symbol and the radical bar
dx = dxSqr;
@ -349,7 +349,7 @@ nsMathMLmrootFrame::Reflow(nsIPresContext* aPresContext,
// place the base
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild(baseFrame, aPresContext, baseSize, dx, dy, 0);
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
mReference.x = 0;
mReference.y = aDesiredSize.ascent;

View File

@ -246,13 +246,13 @@ nsMathMLmsubFrame::PlaceSubScript (nsIPresContext* aPresContext,
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, baseSize, dx, dy, 0);
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
// ... and subscript
// XXX adding mScriptSpace seems to add more space than i like
// may want to remove later.
dx = bmBase.width + aScriptSpace;
dy = aDesiredSize.ascent - (subScriptSize.ascent - actualSubScriptShift);
FinishReflowChild (subScriptFrame, aPresContext, subScriptSize, dx, dy, 0);
FinishReflowChild (subScriptFrame, aPresContext, nsnull, subScriptSize, dx, dy, 0);
}
return NS_OK;

View File

@ -369,15 +369,15 @@ nsMathMLmsubsupFrame::PlaceSubSupScript (nsIPresContext* aPresContext,
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild(baseFrame, aPresContext, baseSize, dx, dy, 0);
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
// ... and subscript
dx = bmBase.width + aScriptSpace;
dy = aDesiredSize.ascent - (subScriptSize.ascent - subScriptShift);
FinishReflowChild(subScriptFrame, aPresContext, subScriptSize, dx, dy, 0);
FinishReflowChild(subScriptFrame, aPresContext, nsnull, subScriptSize, dx, dy, 0);
// ... and the superscript
dx = bmBase.width + aScriptSpace + italicCorrection;
dy = aDesiredSize.ascent - (supScriptSize.ascent + supScriptShift);
FinishReflowChild(supScriptFrame, aPresContext, supScriptSize, dx, dy, 0);
FinishReflowChild(supScriptFrame, aPresContext, nsnull, supScriptSize, dx, dy, 0);
}
return NS_OK;

View File

@ -275,11 +275,11 @@ nsMathMLmsupFrame::PlaceSuperScript(nsIPresContext* aPresContext,
nscoord dx, dy;
// now place the base ...
dx = 0; dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, baseSize, dx, dy, 0);
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dx, dy, 0);
// ... and supscript
dx = bmBase.width + aScriptSpace + italicCorrection;
dy = aDesiredSize.ascent - (supScriptSize.ascent + actualSupScriptShift);
FinishReflowChild (supScriptFrame, aPresContext, supScriptSize, dx, dy, 0);
FinishReflowChild (supScriptFrame, aPresContext, nsnull, supScriptSize, dx, dy, 0);
}
return NS_OK;

View File

@ -347,10 +347,10 @@ nsMathMLmunderFrame::Place(nsIPresContext* aPresContext,
if (aPlaceOrigin) {
nscoord dy = 0;
// place base
FinishReflowChild(baseFrame, aPresContext, baseSize, dxBase, dy, 0);
FinishReflowChild(baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0);
// place underscript
dy = aDesiredSize.ascent + mBoundingMetrics.descent - bmUnder.descent - underSize.ascent;
FinishReflowChild(underFrame, aPresContext, underSize, dxUnder, dy, 0);
FinishReflowChild(underFrame, aPresContext, nsnull, underSize, dxUnder, dy, 0);
}
return NS_OK;

View File

@ -448,13 +448,13 @@ nsMathMLmunderoverFrame::Place(nsIPresContext* aPresContext,
nscoord dy;
// place overscript
dy = aDesiredSize.ascent - mBoundingMetrics.ascent + bmOver.ascent - overSize.ascent;
FinishReflowChild (overFrame, aPresContext, overSize, dxOver, dy, 0);
FinishReflowChild (overFrame, aPresContext, nsnull, overSize, dxOver, dy, 0);
// place base
dy = aDesiredSize.ascent - baseSize.ascent;
FinishReflowChild (baseFrame, aPresContext, baseSize, dxBase, dy, 0);
FinishReflowChild (baseFrame, aPresContext, nsnull, baseSize, dxBase, dy, 0);
// place underscript
dy = aDesiredSize.ascent + mBoundingMetrics.descent - bmUnder.descent - underSize.ascent;
FinishReflowChild (underFrame, aPresContext, underSize, dxUnder, dy, 0);
FinishReflowChild (underFrame, aPresContext, nsnull, underSize, dxUnder, dy, 0);
}
return NS_OK;
}

View File

@ -185,7 +185,7 @@ nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext,
incrementalChild->SetRect(aPresContext, rect);
if (NS_FAILED(rv)) return rv;
rv = incrementalChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
rv = incrementalChild->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
if (NS_FAILED(rv)) return rv;
nsIFrame * child = mFrames.FirstChild();
@ -241,7 +241,7 @@ nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext,
child->SetRect(aPresContext, rect);
if (NS_FAILED(rv)) return rv;
rv = child->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
rv = child->DidReflow(aPresContext, &kidReflowState, NS_FRAME_REFLOW_FINISHED);
if (NS_FAILED(rv)) return rv;
child->GetNextSibling(&child);
}
@ -263,10 +263,11 @@ nsSVGContainerFrame::Reflow(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsSVGContainerFrame::DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus)
nsSVGContainerFrame::DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
nsresult rv = nsHTMLContainerFrame::DidReflow(aPresContext, aStatus);
nsresult rv = nsHTMLContainerFrame::DidReflow(aPresContext, aReflowState, aStatus);
NS_ASSERTION(rv == NS_OK,"DidReflow failed");
return rv;

View File

@ -65,8 +65,9 @@ public:
PRInt32& aCursor);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus);
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);

View File

@ -77,7 +77,7 @@
nsTableCellFrame::nsTableCellFrame()
{
mColIndex = 0;
mBits.mColIndex = 0;
mPriorAvailWidth = 0;
#ifdef DEBUG_TABLE_REFLOW_TIMING
mTimer = new nsReflowTimer(this);
@ -131,6 +131,48 @@ nsTableCellFrame::Init(nsIPresContext* aPresContext,
return rv;
}
static PRBool
NoComputedHeightBetween(const nsHTMLReflowState& aReflowState,
nsIFrame* aCellFrame)
{
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) {
if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) || (0 != rs->mComputedHeight)) {
return PR_FALSE;
}
// stop when we hit the cell frame
if (rs->frame == aCellFrame) {
return PR_TRUE;
}
}
NS_ASSERTION(PR_FALSE, "program error in NoComputedHeightBetween");
return PR_FALSE;
}
// nsIPercentHeightObserver methods
nsresult
nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
{
if (!HadSpecialReflow()) {
// Only initiate a special reflow if we will be able to construct a computed height
// on the cell that will result in the frame getting a computed height. This can only
// happen (but not sufficient) if there no computed height already set between the
// initiating frame and the cell.
for (const nsHTMLReflowState* rs = aReflowState.parentReflowState; rs; rs = rs->parentReflowState) {
if ((NS_UNCONSTRAINEDSIZE != rs->mComputedHeight) && (0 != rs->mComputedHeight)) {
return NS_OK;
}
// stop when we reach the cell frame
if (rs->frame == this) {
nsTableFrame::NotifyAncestorsOfSpecialReflow((nsIFrame&)*this);
SetNeedSpecialReflow(PR_TRUE);
return NS_OK;
}
}
NS_ASSERTION(PR_FALSE, "program error in NotifyPercentHeight");
}
return NS_OK;
}
nsresult
nsTableCellFrame::GetRowIndex(PRInt32 &aRowIndex) const
@ -156,7 +198,7 @@ nsTableCellFrame::GetColIndex(PRInt32 &aColIndex) const
return ((nsTableCellFrame*)GetFirstInFlow())->GetColIndex(aColIndex);
}
else {
aColIndex = mColIndex;
aColIndex = mBits.mColIndex;
return NS_OK;
}
}
@ -246,7 +288,7 @@ void nsTableCellFrame::InitCellFrame(PRInt32 aColIndex)
nsresult nsTableCellFrame::SetColIndex(PRInt32 aColIndex)
{
mColIndex = aColIndex;
mBits.mColIndex = aColIndex;
// for style context optimization, set the content's column index if possible.
// this can only be done if we really have an nsTableCell.
// other tags mapped to table cell display won't benefit from this optimization
@ -766,7 +808,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
(0 == aReflowState.mComputedHeight)) &&
!mPrevInFlow &&
nsTableFrame::IsPctHeight(mStyleContext)) {
nsTableFrame::NotifyAncestorsOfSpecialReflow(aReflowState);
nsTableFrame::NotifyAncestorsOfSpecialReflow(*this);
SetNeedSpecialReflow(PR_TRUE);
}
// this should probably be cached somewhere
@ -851,7 +893,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
aPresContext->IsPaginated(&isPaginated);
nscoord computedPaginatedHeight = 0;
if (aReflowState.mFlags.mSpecialTableReflow || (eReflowReason_Incremental == aReflowState.reason)) {
if (aReflowState.mFlags.mSpecialHeightReflow ||
(HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason))) {
((nsHTMLReflowState&)aReflowState).mComputedHeight = mRect.height - topInset - bottomInset;
DISPLAY_REFLOW_CHANGE();
}
@ -866,6 +909,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
SetHasPctOverHeight(PR_FALSE);
}
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid, availSize);
// mIPercentHeightObserver is for non table related frames inside cells
kidReflowState.mPercentHeightObserver = (nsIPercentHeightObserver *)this;
// If it was a style change targeted at us, then reflow the child using
// the special reflow reason
@ -899,8 +944,10 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState);
#endif
nscoord priorBlockHeight = GetLastBlockHeight();
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
kidOrigin.x, kidOrigin.y, 0, aStatus);
SetLastBlockHeight(kidSize.height);
if (isStyleChanged) {
Invalidate(aPresContext, mRect);
}
@ -990,7 +1037,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
// NS_ASSERTION(kidSize.width <= availSize.width, "child needed more space during resize reflow");
//}
// Place the child
FinishReflowChild(firstKid, aPresContext, kidSize,
FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize,
kidOrigin.x, kidOrigin.y, 0);
// first, compute the height which can be set w/o being restricted by aMaxSize.height
@ -1041,26 +1088,21 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
}
}
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
if (aDesiredSize.height > mRect.height) {
// set a bit and frame property indicating that the pct height contents exceeded
// set a bit indicating that the pct height contents exceeded
// the height that they could honor in the pass 2 reflow
SetHasPctOverHeight(PR_TRUE);
SetPctOverHeightValue(aPresContext, aDesiredSize.height);
}
aDesiredSize.height = mRect.height;
SetNeedSpecialReflow(PR_FALSE);
SetHadSpecialReflow(PR_TRUE);
}
else if ((eReflowReason_Incremental == aReflowState.reason) && HasPctOverHeight()) {
nscoord overValue;
GetPctOverHeightValue(aPresContext, overValue);
// if the pct over height value hasn't changed, use the last height of the cell, otherwise ignore it
if (aDesiredSize.height == overValue) {
else if (HadSpecialReflow() && (eReflowReason_Incremental == aReflowState.reason)) {
// if the block height value hasn't changed, use the last height of the cell, otherwise ignore it
if (GetLastBlockHeight() == priorBlockHeight) {
aDesiredSize.height = mRect.height;
}
else {
SetHasPctOverHeight(PR_FALSE);
}
}
else if (computedPaginatedHeight > 0) {
nscoord height = computedPaginatedHeight + topInset + bottomInset - CalcHeightOfPrevInFlows(*this);
@ -1277,6 +1319,10 @@ nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr
*aInstancePtr = (void*) (nsITableCellLayout *)this;
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIPercentHeightObserver))) {
*aInstancePtr = (void*) (nsIPercentHeightObserver *)this;
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
@ -1305,7 +1351,7 @@ nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)
aColIndex = 0;
return res;
}
aColIndex = mColIndex;
aColIndex = mBits.mColIndex;
return NS_OK;
}
@ -1447,27 +1493,6 @@ void nsTableCellFrame::GetCollapseOffset(nsIPresContext* aPresContext,
}
}
void nsTableCellFrame::SetPctOverHeightValue(nsIPresContext* aPresContext,
nscoord aValue)
{
// Get the property
nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty, PR_TRUE);
if (value) {
*value = aValue;
}
}
void nsTableCellFrame::GetPctOverHeightValue(nsIPresContext* aPresContext,
nscoord& aValue)
{
aValue = 0;
// See if the property is set
nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::cellPctOverHeightProperty);
if (value) {
aValue = *value;
}
}
#ifdef DEBUG
NS_IMETHODIMP
nsTableCellFrame::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const

View File

@ -42,6 +42,7 @@
#include "nsHTMLContainerFrame.h"
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
#include "nsIStyleContext.h"
#include "nsIPercentHeightObserver.h"
class nsTableFrame;
class nsHTMLValue;
@ -51,7 +52,8 @@ class nsHTMLValue;
*/
#define NS_TABLE_CELL_CONTENT_EMPTY 0x80000000
#define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000
#define NS_TABLE_CELL_PCT_OVER_HEIGHT 0x20000000
#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000
#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000
/**
* nsTableCellFrame
@ -64,7 +66,9 @@ class nsHTMLValue;
*
* @author sclark
*/
class nsTableCellFrame : public nsHTMLContainerFrame, public nsITableCellLayout
class nsTableCellFrame : public nsHTMLContainerFrame,
public nsITableCellLayout,
public nsIPercentHeightObserver
{
public:
@ -111,6 +115,8 @@ public:
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD NotifyPercentHeight(const nsHTMLReflowState& aReflowState);
void InitCellFrame(PRInt32 aColIndex);
@ -244,17 +250,20 @@ public:
PRBool NeedSpecialReflow();
void SetNeedSpecialReflow(PRBool aContentEmpty);
PRBool HadSpecialReflow();
void SetHadSpecialReflow(PRBool aValue);
PRBool HasPctOverHeight();
void SetHasPctOverHeight(PRBool aValue);
nscoord GetLastBlockHeight();
void SetLastBlockHeight(nscoord aValue);
// The collapse offset is (0,0) except for cells originating in a row/col which is collapsed
void SetCollapseOffsetX(nsIPresContext* aPresContext, nscoord aXOffset);
void SetCollapseOffsetY(nsIPresContext* aPresContext, nscoord aYOffset);
void GetCollapseOffset(nsIPresContext* aPresContext, nsPoint& aOffset);
void SetPctOverHeightValue(nsIPresContext* aPresContext, nscoord aValue);
void GetPctOverHeightValue(nsIPresContext* aPresContext, nscoord& aValue);
nsTableCellFrame* GetNextCell() const;
protected:
@ -291,6 +300,10 @@ protected:
protected:
struct Bits {
PRUint32 mColIndex:15;
PRUint32 mLastBlockHeight:17;
} mBits;
PRInt32 mColIndex; // the starting column for this cell
// XXX these could be stored as pixels for a savings of 6 x 2 bytes
@ -369,21 +382,45 @@ inline void nsTableCellFrame::SetNeedSpecialReflow(PRBool aValue)
}
}
inline PRBool nsTableCellFrame::HadSpecialReflow()
{
return (mState & NS_TABLE_CELL_HAD_SPECIAL_REFLOW) ==
NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
}
inline void nsTableCellFrame::SetHadSpecialReflow(PRBool aValue)
{
if (aValue) {
mState |= NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
} else {
mState &= ~NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
}
}
inline PRBool nsTableCellFrame::HasPctOverHeight()
{
return (mState & NS_TABLE_CELL_PCT_OVER_HEIGHT) ==
NS_TABLE_CELL_PCT_OVER_HEIGHT;
return (mState & NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT) ==
NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
}
inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue)
{
if (aValue) {
mState |= NS_TABLE_CELL_PCT_OVER_HEIGHT;
mState |= NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
} else {
mState &= ~NS_TABLE_CELL_PCT_OVER_HEIGHT;
mState &= ~NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
}
}
inline nscoord nsTableCellFrame::GetLastBlockHeight()
{
return (nscoord)mBits.mLastBlockHeight;
}
inline void nsTableCellFrame::SetLastBlockHeight(nscoord aValue)
{
mBits.mLastBlockHeight = aValue;
}
#endif

View File

@ -503,7 +503,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, 0, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidSize, 0, 0, 0);
}
aDesiredSize.width=0;
@ -608,7 +608,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsChild(nsIPresContext* aPresC
nsSize(aReflowState.availableWidth,
aReflowState.availableHeight));
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, aStatus);
aNextFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
aNextFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
if (NS_FAILED(rv))
return rv;

View File

@ -1580,7 +1580,7 @@ PRBool nsTableFrame::NeedsReflow(const nsHTMLReflowState& aReflowState)
{
PRBool result = PR_TRUE;
if (eReflowReason_Resize == aReflowState.reason) {
if (aReflowState.mFlags.mSpecialTableReflow &&
if (aReflowState.mFlags.mSpecialHeightReflow &&
!NeedSpecialReflow() &&
!NeedToInitiateSpecialReflow()) {
result = PR_FALSE;
@ -1816,26 +1816,25 @@ ProcessRowInserted(nsIPresContext* aPresContext,
}
void
nsTableFrame::NotifyAncestorsOfSpecialReflow(const nsHTMLReflowState& aReflowState)
nsTableFrame::NotifyAncestorsOfSpecialReflow(nsIFrame& aFrame)
{
const nsHTMLReflowState* rs = aReflowState.parentReflowState;
while (rs) {
nsIFrame* parent;
for (aFrame.GetParent(&parent); parent; parent->GetParent(&parent)) {
nsCOMPtr<nsIAtom> frameType;
rs->frame->GetFrameType(getter_AddRefs(frameType));
parent->GetFrameType(getter_AddRefs(frameType));
if (nsLayoutAtoms::tableCellFrame == frameType.get()) {
((nsTableCellFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE);
((nsTableCellFrame*)parent)->SetNeedSpecialReflow(PR_TRUE);
}
else if (nsLayoutAtoms::tableRowFrame == frameType.get()) {
((nsTableRowFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE);
((nsTableRowFrame*)parent)->SetNeedSpecialReflow(PR_TRUE);
}
else if (nsLayoutAtoms::tableRowGroupFrame == frameType.get()) {
((nsTableRowGroupFrame*)rs->frame)->SetNeedSpecialReflow(PR_TRUE);
((nsTableRowGroupFrame*)parent)->SetNeedSpecialReflow(PR_TRUE);
}
else if (nsLayoutAtoms::tableFrame == frameType.get()) {
((nsTableFrame*)rs->frame)->SetNeedToInitiateSpecialReflow(PR_TRUE);
((nsTableFrame*)parent)->SetNeedToInitiateSpecialReflow(PR_TRUE);
break;
}
rs = rs->parentReflowState;
}
}
@ -1969,7 +1968,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if ( ((NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight) ||
(0 == aReflowState.mComputedHeight)) &&
IsPctHeight(mStyleContext) && IsSpecialNested(aReflowState)) {
NotifyAncestorsOfSpecialReflow(aReflowState);
NotifyAncestorsOfSpecialReflow(*this);
SetNeedSpecialReflow(PR_TRUE);
}
// see if an extra reflow will be necessary in pagination mode when there is a specified table height
@ -1982,21 +1981,21 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
}
// if we need to reflow the table an extra time, then don't constrain the height of the previous reflow
nscoord availHeight = !aReflowState.mFlags.mSpecialTableReflow &&
nscoord availHeight = !aReflowState.mFlags.mSpecialHeightReflow &&
(NeedSpecialReflow() | NeedToInitiateSpecialReflow())
? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight;
ReflowTable(aPresContext, aDesiredSize, aReflowState, availHeight, nextReason, doCollapse, balanced, aStatus);
if (!aReflowState.mFlags.mSpecialTableReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) {
if (!aReflowState.mFlags.mSpecialHeightReflow && NeedToInitiateSpecialReflow() && !NeedSpecialReflow()) {
aDesiredSize.height = CalcDesiredHeight(aPresContext, aReflowState); // distributes extra vertical space to rows
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialTableReflow = PR_TRUE;
((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = PR_TRUE;
ReflowTable(aPresContext, aDesiredSize, aReflowState, aReflowState.availableHeight,
nextReason, doCollapse, balanced, aStatus);
haveDesiredHeight = PR_TRUE;
}
}
else if (aReflowState.mFlags.mSpecialTableReflow) {
else if (aReflowState.mFlags.mSpecialHeightReflow) {
aDesiredSize.width = mRect.width;
aDesiredSize.height = mRect.height;
#if defined DEBUG_TABLE_REFLOW_TIMING
@ -2060,7 +2059,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
}
if (aReflowState.mFlags.mSpecialTableReflow) {
if (aReflowState.mFlags.mSpecialHeightReflow) {
SetNeedSpecialReflow(PR_FALSE);
SetNeedToInitiateSpecialReflow(PR_FALSE);
}
@ -2846,7 +2845,7 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
// the footer frame as well. We'll adjust the footer frame later on in
// AdjustSiblingsAfterReflow()
nsRect kidRect(aReflowState.x, aReflowState.y, desiredSize.width, desiredSize.height);
FinishReflowChild(aNextFrame, aPresContext, desiredSize, aReflowState.x, aReflowState.y, 0);
FinishReflowChild(aNextFrame, aPresContext, nsnull, desiredSize, aReflowState.x, aReflowState.y, 0);
#ifndef TABLE_REFLOW_COALESCING_OFF
// update the descendant reflow counts and determine if we need to request a timeout reflow
@ -2923,7 +2922,7 @@ void nsTableFrame::PlaceChild(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize)
{
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState.x, aReflowState.y, 0);
FinishReflowChild(aKidFrame, aPresContext, nsnull, aDesiredSize, aReflowState.x, aReflowState.y, 0);
// Adjust the running y-offset
aReflowState.y += aDesiredSize.height;
@ -3188,7 +3187,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, unusedDesiredSize, kidReflowState,
0, 0, 0, status);
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
}
}
else if (childX < numRowGroups) { // it is a row group but isn't being reflowed
@ -3214,7 +3213,7 @@ nsTableFrame::ReflowChildren(nsIPresContext* aPresContext,
aReflowState.availSize, aReflowState.reason);
nsReflowStatus cgStatus;
ReflowChild(kidFrame, aPresContext, kidMet, kidReflowState, 0, 0, 0, cgStatus);
FinishReflowChild(kidFrame, aPresContext, kidMet, 0, 0, 0);
FinishReflowChild(kidFrame, aPresContext, nsnull, kidMet, 0, 0, 0);
}
SetHaveReflowedColGroups(PR_TRUE);
}
@ -4662,7 +4661,7 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame,
PrettyUC(aState.availableWidth, width);
PrettyUC(aState.availableHeight, height);
printf("r=%d ", aState.reason);
if (aState.mFlags.mSpecialTableReflow) {
if (aState.mFlags.mSpecialHeightReflow) {
printf("special ");
}
printf("a=%s,%s ", width, height);
@ -5086,10 +5085,6 @@ nsTableFrame::GetProperty(nsIPresContext* aPresContext,
value = new nsPoint(0, 0);
dtorFunc = DestroyPointFunc;
}
else if (aPropertyName == nsLayoutAtoms::cellPctOverHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;
}
else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;

Some files were not shown because too many files have changed in this diff Show More