Separated reflow process out of nsIFrame and into nsIFrameReflow. Also

added nsIHTMLReflow, which is an HTML specific reflow interface
This commit is contained in:
troy%netscape.com 1998-10-01 04:46:11 +00:00
Родитель 93ba27810d
Коммит 8b034f4950
125 изменённых файлов: 2297 добавлений и 2300 удалений

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsStyleConsts.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIFrameReflow.h"
#include "nsIFontMetrics.h"
#include "nsIPresContext.h"
#include "nsRect.h"

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsIPref.h"
#include "nsIViewObserver.h"
#include "nsContainerFrame.h"
#include "nsHTMLIIDs.h"
static PRBool gsNoisyRefs = PR_FALSE;
#undef NOISY
@ -498,17 +499,20 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
nsRect bounds;
mPresContext->GetVisibleArea(bounds);
nsSize maxSize(bounds.width, bounds.height);
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
nsReflowState reflowState(mRootFrame, eReflowReason_Initial, maxSize);
nsIHTMLReflow* htmlReflow;
mRootFrame->Reflow(*mPresContext, desiredSize, reflowState, status);
if (NS_OK == mRootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status);
mRootFrame->SizeTo(desiredSize.width, desiredSize.height);
#ifdef NS_DEBUG
if (nsIFrame::GetVerifyTreeEnable()) {
mRootFrame->VerifyTree();
}
#endif
}
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow"));
}
@ -541,17 +545,20 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
nsRect bounds;
mPresContext->GetVisibleArea(bounds);
nsSize maxSize(bounds.width, bounds.height);
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
nsReflowState reflowState(mRootFrame, eReflowReason_Resize, maxSize);
nsIHTMLReflow* htmlReflow;
mRootFrame->Reflow(*mPresContext, desiredSize, reflowState, status);
if (NS_OK == mRootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status);
mRootFrame->SizeTo(desiredSize.width, desiredSize.height);
#ifdef NS_DEBUG
if (nsIFrame::GetVerifyTreeEnable()) {
mRootFrame->VerifyTree();
}
#endif
}
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::ResizeReflow"));
// XXX if debugging then we should assert that the cache is empty
@ -624,7 +631,7 @@ void
PresShell::ProcessReflowCommands()
{
if (0 != mReflowCommands.Count()) {
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
while (0 != mReflowCommands.Count()) {
nsIReflowCommand* rc = (nsIReflowCommand*) mReflowCommands.ElementAt(0);

Просмотреть файл

@ -24,6 +24,7 @@ EXPORTS = \
nsIDocumentContainer.h \
nsIDocumentObserver.h \
nsIFrame.h \
nsIFrameReflow.h \
nsIFrameImageLoader.h \
nsIPresContext.h \
nsIPresShell.h \

Просмотреть файл

@ -43,7 +43,6 @@ class nsString;
struct nsPoint;
struct nsRect;
struct nsReflowMetrics;
struct nsStyleStruct;
struct PRLogModuleInfo;
@ -53,168 +52,6 @@ struct PRLogModuleInfo;
#define NS_IFRAME_IID \
{ 0xa6cf9050, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/**
* Reflow metrics used to return the frame's desired size and alignment
* information.
*
* @see #Reflow()
* @see #GetReflowMetrics()
*/
struct nsReflowMetrics {
nscoord width, height; // desired width and height
nscoord ascent, descent;
// Set this to null if you don't need to compute the max element size
nsSize* maxElementSize;
// XXX Explain this better somehow!
// The caller of nsIFrame::Reflow will set these to the top margin
// value carried into the child frame. This allows the the child
// container to collapse the top margin with its first childs
// margin.
nscoord mCarriedInTopMargin; // in
// These values are set by the child frame indicating its final
// inner bottom margin value (the value of the childs last child
// bottom margin)
nscoord mCarriedOutBottomMargin; // out
nsReflowMetrics(nsSize* aMaxElementSize) {
maxElementSize = aMaxElementSize;
mCarriedInTopMargin = 0;
mCarriedOutBottomMargin = 0;
width = 0;
height = 0;
ascent = 0;
descent = 0;
}
};
/**
* Constant used to indicate an unconstrained size.
*
* @see #Reflow()
*/
#define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
/**
* The reason the frame is being reflowed.
*
* @see nsReflowState
*/
enum nsReflowReason {
eReflowReason_Initial = 0, // initial reflow of a newly created frame
eReflowReason_Incremental = 1, // an incremental change has occured. see the reflow command for details
eReflowReason_Resize = 2 // general request to determine a desired size
};
/**
* The type of size constraint that applies to a particular dimension.
* For the fixed and fixed content cases the min size in the reflow state
* structure is ignored and you should use the max size value when reflowing
* the frame.
*
* @see nsReflowState
*/
//XXX enum's are prefixed wrong
enum nsReflowConstraint {
eReflowSize_Unconstrained = 0, // choose whatever frame size you want
eReflowSize_Constrained = 1, // choose a frame size between the min and max sizes
eReflowSize_Fixed = 2, // frame size is fixed
eReflowSize_FixedContent = 3 // size of your content area is fixed
};
/**
* Reflow state passed to a frame during reflow. The reflow states are linked
* together. The max size represents the max available space in which to reflow
* your frame, and is computed as the parent frame's available content area
* minus any room for margins that your frame requests. The min size represents
* the min available space in which to reflow your frame
*
* @see #Reflow()
*/
struct nsReflowState {
const nsReflowState* parentReflowState; // pointer to parent's reflow state
nsIFrame* frame; // the frame being reflowed
nsReflowReason reason; // the reason for the reflow
nsIReflowCommand* reflowCommand; // only used for incremental changes
nsReflowConstraint widthConstraint; // constraint that applies to width dimension
nsReflowConstraint heightConstraint; // constraint that applies to height dimension
nsSize maxSize; // the max available space in which to reflow
nsSize minSize; // the min available space in which to reflow.
// Only used for eReflowSize_Constrained
// Note: there is no copy constructor so that the compiler can
// generate an optimal one.
// Constructs an initial reflow state (no parent reflow state) for a
// non-incremental reflow command
nsReflowState(nsIFrame* aFrame,
nsReflowReason aReason,
const nsSize& aMaxSize);
// Constructs an initial reflow state (no parent reflow state) for an
// incremental reflow command
nsReflowState(nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
const nsSize& aMaxSize);
// Construct a reflow state for the given frame, parent reflow state, and
// max size. Uses the reflow reason and reflow command from the parent's
// reflow state
nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize);
// Constructs a reflow state that overrides the reflow reason of the parent
// reflow state. Sets the reflow command to NULL
nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize,
nsReflowReason aReflowReason);
};
//----------------------------------------------------------------------
/**
* Reflow status returned by the reflow methods.
*
* NS_FRAME_NOT_COMPLETE bit flag means the frame does not map all its
* content, and that the parent frame should create a continuing frame.
* If this bit isn't set it means the frame does map all its content.
*
* NS_FRAME_REFLOW_NEXTINFLOW bit flag means that the next-in-flow is
* dirty, and also needs to be reflowed. This status only makes sense
* for a frame that is not complete, i.e. you wouldn't set both
* NS_FRAME_COMPLETE and NS_FRAME_REFLOW_NEXTINFLOW
*
* The low 8 bits of the nsReflowStatus are reserved for future extensions;
* the remaining 24 bits are zero (and available for extensions; however
* API's that accept/return nsReflowStatus must not receive/return any
* extension bits).
*
* @see #Reflow()
* @see #CreateContinuingFrame()
*/
typedef PRUint32 nsReflowStatus;
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_REFLOW_NEXTINFLOW 0x2
#define NS_FRAME_IS_COMPLETE(status) \
(0 == ((status) & NS_FRAME_NOT_COMPLETE))
#define NS_FRAME_IS_NOT_COMPLETE(status) \
(0 != ((status) & NS_FRAME_NOT_COMPLETE))
// This macro tests to see if an nsReflowStatus is an error value
// or just a regular return value
#define NS_IS_REFLOW_ERROR(_status) (PRInt32(_status) < 0)
//----------------------------------------------------------------------
/**
* Indication of how the frame can be split. This is used when doing runaround
* of floaters, and when pulling up child frames from a next-in-flow.
@ -257,16 +94,6 @@ typedef PRUint32 nsFrameState;
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
typedef PRBool nsDidReflowStatus;
#define NS_FRAME_REFLOW_NOT_FINISHED PR_FALSE
#define NS_FRAME_REFLOW_FINISHED PR_TRUE
//----------------------------------------------------------------------
/**
* A frame in the layout model. This interface is supported by all frame
* objects.
@ -418,64 +245,6 @@ public:
*/
NS_IMETHOD SetFrameState(nsFrameState aNewState) = 0;
/**
* Pre-reflow hook. Before a frame is incrementally reflowed or
* resize-reflowed this method will be called warning the frame of
* the impending reflow. This call may be invoked zero or more times
* before a subsequent DidReflow call. This method when called the
* first time will set the NS_FRAME_IN_REFLOW bit in the frame
* state bits.
*/
NS_IMETHOD WillReflow(nsIPresContext& aPresContext) = 0;
/**
* The frame is given a maximum size and asked for its desired size.
* This is the frame's opportunity to reflow its children.
*
* @param aDesiredSize <i>out</i> parameter where you should return the
* desired size and ascent/descent info. You should include any
* space you want for border/padding in the desired size you return.
*
* It's okay to return a desired size that exceeds the max
* size if that's the smallest you can be, i.e. it's your
* minimum size.
*
* maxElementSize is an optional parameter for returning your
* maximum element size. If may be null in which case you
* don't have to compute a maximum element size. The
* maximum element size must be less than or equal to your
* desired size.
*
* @param aReflowState information about your reflow including the reason
* for the reflow and the available space in which to lay out. Each
* dimension of the available space can either be constrained or
* unconstrained (a value of NS_UNCONSTRAINEDSIZE). If constrained
* you should choose a value that's less than or equal to the
* constrained size. If unconstrained you can choose as
* large a value as you like.
*
* Note that the available space can be negative. In this case you
* still must return an accurate desired size. If you're a container
* you must <b>always</b> reflow at least one frame regardless of the
* available space
*/
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus) = 0;
/**
* Post-reflow hook. After a frame is incrementally reflowed or
* resize-reflowed this method will be called telling the frame of
* the outcome. This call may be invoked many times, while
* NS_FRAME_IN_REFLOW is set, before it is finally called once with
* a NS_FRAME_REFLOW_COMPLETE value. When called with a
* NS_FRAME_REFLOW_COMPLETE value the NS_FRAME_IN_REFLOW bit in the
* frame state will be cleared.
*/
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus) = 0;
/**
* This call is invoked when content is changed in the content tree.
* The first frame that maps that content is asked to deal with the
@ -502,17 +271,6 @@ public:
nsIAtom* aAttribute,
PRInt32 aHint) = 0;
/**
* Return the reflow metrics for this frame. If the frame is a
* container then the values for ascent and descent are computed
* across the the various children in the appropriate manner
* (e.g. for a line frame the ascent value would be the maximum
* ascent of the line's children). Note that the metrics returned
* apply to the frame as it exists at the time of the call.
*/
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics) = 0;
/**
* Return how your frame can be split.
*/
@ -631,91 +389,6 @@ private:
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
// Constructs an initial reflow state (no parent reflow state) for a
// non-incremental reflow command
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
nsReflowReason aReason,
const nsSize& aMaxSize)
{
NS_PRECONDITION(aReason != eReflowReason_Incremental, "unexpected reflow reason");
// the following was removed because framesets need to force a reflow on themselves and didn't
// have nsReflowState parentage available
#if 0
#ifdef NS_DEBUG
nsIFrame* parent;
aFrame->GetGeometricParent(parent);
NS_PRECONDITION(nsnull == parent, "not root frame");
#endif
#endif
reason = aReason;
reflowCommand = nsnull;
maxSize = aMaxSize;
parentReflowState = nsnull;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
// Constructs an initial reflow state (no parent reflow state) for an
// incremental reflow command
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
const nsSize& aMaxSize)
{
#ifdef NS_DEBUG
nsIFrame* parent;
aFrame->GetGeometricParent(parent);
NS_PRECONDITION(nsnull == parent, "not root frame");
#endif
reason = eReflowReason_Incremental;
reflowCommand = &aReflowCommand;
maxSize = aMaxSize;
parentReflowState = nsnull;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
// Construct a reflow state for the given frame, parent reflow state, and
// max size. Uses the reflow reason and reflow command from the parent's
// reflow state
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize)
{
reason = aParentReflowState.reason;
reflowCommand = aParentReflowState.reflowCommand;
maxSize = aMaxSize;
parentReflowState = &aParentReflowState;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
// Constructs a reflow state that overrides the reflow reason of the parent
// reflow state. Sets the reflow command to NULL
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize,
nsReflowReason aReflowReason)
{
reason = aReflowReason;
reflowCommand = nsnull;
maxSize = aMaxSize;
parentReflowState = &aParentReflowState;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
/* ----- nsIListFilter definition ----- */
class nsIListFilter
{

Просмотреть файл

@ -0,0 +1,310 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIFrameReflow_h___
#define nsIFrameReflow_h___
#include "nslayout.h"
#include "nsISupports.h"
#include "nsSize.h"
class nsIFrame;
class nsIPresContext;
class nsIReflowCommand;
//----------------------------------------------------------------------
/**
* Reflow metrics used to return the frame's desired size and alignment
* information.
*
* @see #Reflow()
* @see #GetReflowMetrics()
*/
struct nsReflowMetrics {
nscoord width, height; // desired width and height
nscoord ascent, descent;
// Set this to null if you don't need to compute the max element size
nsSize* maxElementSize;
nsReflowMetrics(nsSize* aMaxElementSize) {
maxElementSize = aMaxElementSize;
}
};
//----------------------------------------------------------------------
/**
* Constant used to indicate an unconstrained size.
*
* @see #Reflow()
*/
#define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
//----------------------------------------------------------------------
/**
* The reason the frame is being reflowed.
* XXX Should probably be a #define so it can be extended for specialized
* reflow interfaces...
*
* @see nsReflowState
*/
enum nsReflowReason {
eReflowReason_Initial = 0, // initial reflow of a newly created frame
eReflowReason_Incremental = 1, // an incremental change has occured. see the reflow command for details
eReflowReason_Resize = 2 // general request to determine a desired size
};
//----------------------------------------------------------------------
/**
* Reflow state passed to a frame during reflow. The reflow states are linked
* together. The max size represents the max available space in which to reflow
* your frame, and is computed as the parent frame's available content area
* minus any room for margins that your frame requests. The min size represents
* the min available space in which to reflow your frame
*
* @see #Reflow()
*/
struct nsReflowState {
const nsReflowState* parentReflowState; // pointer to parent's reflow state
nsIFrame* frame; // the frame being reflowed
nsReflowReason reason; // the reason for the reflow
nsIReflowCommand* reflowCommand; // only used for incremental changes
nsSize maxSize; // the max available space in which to reflow
// Note: there is no copy constructor so that the compiler can
// generate an optimal one.
// Constructs an initial reflow state (no parent reflow state) for a
// non-incremental reflow command
nsReflowState(nsIFrame* aFrame,
nsReflowReason aReason,
const nsSize& aMaxSize);
// Constructs an initial reflow state (no parent reflow state) for an
// incremental reflow command
nsReflowState(nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
const nsSize& aMaxSize);
// Construct a reflow state for the given frame, parent reflow state, and
// max size. Uses the reflow reason and reflow command from the parent's
// reflow state
nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize);
// Constructs a reflow state that overrides the reflow reason of the parent
// reflow state. Sets the reflow command to NULL
nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize,
nsReflowReason aReflowReason);
};
//----------------------------------------------------------------------
/**
* Reflow status returned by the reflow methods.
*
* NS_FRAME_NOT_COMPLETE bit flag means the frame does not map all its
* content, and that the parent frame should create a continuing frame.
* If this bit isn't set it means the frame does map all its content.
*
* NS_FRAME_REFLOW_NEXTINFLOW bit flag means that the next-in-flow is
* dirty, and also needs to be reflowed. This status only makes sense
* for a frame that is not complete, i.e. you wouldn't set both
* NS_FRAME_COMPLETE and NS_FRAME_REFLOW_NEXTINFLOW
*
* The low 8 bits of the nsReflowStatus are reserved for future extensions;
* the remaining 24 bits are zero (and available for extensions; however
* API's that accept/return nsReflowStatus must not receive/return any
* extension bits).
*
* @see #Reflow()
* @see #CreateContinuingFrame()
*/
typedef PRUint32 nsReflowStatus;
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_REFLOW_NEXTINFLOW 0x2
#define NS_FRAME_IS_COMPLETE(status) \
(0 == ((status) & NS_FRAME_NOT_COMPLETE))
#define NS_FRAME_IS_NOT_COMPLETE(status) \
(0 != ((status) & NS_FRAME_NOT_COMPLETE))
// This macro tests to see if an nsReflowStatus is an error value
// or just a regular return value
#define NS_IS_REFLOW_ERROR(_status) (PRInt32(_status) < 0)
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
typedef PRBool nsDidReflowStatus;
#define NS_FRAME_REFLOW_NOT_FINISHED PR_FALSE
#define NS_FRAME_REFLOW_FINISHED PR_TRUE
//----------------------------------------------------------------------
/**
* Basic layout protocol.
*/
template<class ReflowState, class ReflowMetrics> class nsIFrameReflow : public nsISupports {
public:
/**
* Pre-reflow hook. Before a frame is incrementally reflowed or
* resize-reflowed this method will be called warning the frame of
* the impending reflow. This call may be invoked zero or more times
* before a subsequent DidReflow call. This method when called the
* first time will set the NS_FRAME_IN_REFLOW bit in the frame
* state bits.
*/
NS_IMETHOD WillReflow(nsIPresContext& aPresContext) = 0;
/**
* The frame is given a maximum size and asked for its desired size.
* This is the frame's opportunity to reflow its children.
*
* @param aDesiredSize <i>out</i> parameter where you should return the
* desired size and ascent/descent info. You should include any
* space you want for border/padding in the desired size you return.
*
* It's okay to return a desired size that exceeds the max
* size if that's the smallest you can be, i.e. it's your
* minimum size.
*
* maxElementSize is an optional parameter for returning your
* maximum element size. If may be null in which case you
* don't have to compute a maximum element size. The
* maximum element size must be less than or equal to your
* desired size.
*
* @param aReflowState information about your reflow including the reason
* for the reflow and the available space in which to lay out. Each
* dimension of the available space can either be constrained or
* unconstrained (a value of NS_UNCONSTRAINEDSIZE). If constrained
* you should choose a value that's less than or equal to the
* constrained size. If unconstrained you can choose as
* large a value as you like.
*
* Note that the available space can be negative. In this case you
* still must return an accurate desired size. If you're a container
* you must <b>always</b> reflow at least one frame regardless of the
* available space
*/
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
ReflowMetrics& aDesiredSize,
const ReflowState& aReflowState,
nsReflowStatus& aStatus) = 0;
/**
* Post-reflow hook. After a frame is incrementally reflowed or
* resize-reflowed this method will be called telling the frame of
* the outcome. This call may be invoked many times, while
* NS_FRAME_IN_REFLOW is set, before it is finally called once with
* a NS_FRAME_REFLOW_COMPLETE value. When called with a
* NS_FRAME_REFLOW_COMPLETE value the NS_FRAME_IN_REFLOW bit in the
* frame state will be cleared.
*/
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus) = 0;
/**
* Return the reflow metrics for this frame. If the frame is a
* container then the values for ascent and descent are computed
* across the the various children in the appropriate manner
* (e.g. for a line frame the ascent value would be the maximum
* ascent of the line's children). Note that the metrics returned
* apply to the frame as it exists at the time of the call.
*/
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
ReflowMetrics& aMetrics) = 0;
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
//----------------------------------------------------------------------
// Constructs an initial reflow state (no parent reflow state) for a
// non-incremental reflow command
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
nsReflowReason aReason,
const nsSize& aMaxSize)
{
NS_PRECONDITION(aReason != eReflowReason_Incremental, "unexpected reflow reason");
reason = aReason;
reflowCommand = nsnull;
maxSize = aMaxSize;
parentReflowState = nsnull;
frame = aFrame;
}
// Constructs an initial reflow state (no parent reflow state) for an
// incremental reflow command
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
const nsSize& aMaxSize)
{
reason = eReflowReason_Incremental;
reflowCommand = &aReflowCommand;
maxSize = aMaxSize;
parentReflowState = nsnull;
frame = aFrame;
}
// Construct a reflow state for the given frame, parent reflow state, and
// max size. Uses the reflow reason and reflow command from the parent's
// reflow state
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize)
{
reason = aParentReflowState.reason;
reflowCommand = aParentReflowState.reflowCommand;
maxSize = aMaxSize;
parentReflowState = &aParentReflowState;
frame = aFrame;
}
// Constructs a reflow state that overrides the reflow reason of the parent
// reflow state. Sets the reflow command to NULL
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize,
nsReflowReason aReflowReason)
{
reason = aReflowReason;
reflowCommand = nsnull;
maxSize = aMaxSize;
parentReflowState = &aParentReflowState;
frame = aFrame;
}
#endif /* nsIFrameReflow_h___ */

Просмотреть файл

@ -22,7 +22,7 @@
class nsIFrame;
class nsIPresContext;
struct nsReflowMetrics;
struct nsHTMLReflowMetrics;
struct nsSize;
// IID for the nsIReflowCommand interface {C3658E40-FF20-11d1-85BC-00A02468FAB6}
@ -92,7 +92,7 @@ public:
* @see nsIFrame#Reflow()
*/
NS_IMETHOD Dispatch(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize) = 0;
/**

Просмотреть файл

@ -1,75 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIRunaround_h___
#define nsIRunaround_h___
#include "nsIFrame.h"
// IID for the nsIRunaround interface {3C6ABCF0-C028-11d1-853F-00A02468FAB6}
#define NS_IRUNAROUND_IID \
{ 0x3c6abcf0, 0xc028, 0x11d1, \
{0x85, 0x3f, 0x0, 0xa0, 0x24, 0x68, 0xfa, 0xb6}}
/**
* An interface for handling reflow that allows direct access to the space
* manager. Note that this interface is not an nsISupports interface, and
* therefore you cannot QueryInterface() back
*/
class nsIRunaround
{
public:
/**
* Reflow. The frame is given a maximum size and asked for its desired
* rect. The space manager should be used to do runaround of anchored
* items.
*
* @param aSpaceManager the space manager to use. The caller has translated
* the coordinate system so the frame has its own local coordinate
* space with an origin of (0, 0). If you translate the coordinate
* space you must restore it before returning.
* @param aMaxSize the available space in which to lay out. Each dimension
* can either be constrained or unconstrained (a value of
* NS_UNCONSTRAINEDSIZE). If constrained you should choose a value
* that's less than or equal to the constrained size. If unconstrained
* you can choose as large a value as you like.
*
* It's okay to return a desired size that exceeds the max size if
* that's the smallest you can be, i.e. it's your minimum size.
*
* @param aDesiredRect <i>out</i> parameter where you should return the desired
* origin and size. You should include any space you want for border
* and padding in the desired size.
*
* The origin of the desired rect is relative to the upper-left of the
* local coordinate space.
*
* @param aMaxElementSize an optional parameter for returning your maximum
* element size. If may be null in which case you don't have to compute
* a maximum element size
*
* @see nsISpaceManager#Translate()
*/
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect, // XXX FIX ME
nsReflowStatus& aStatus) = 0;
};
#endif /* nsIRunaround_h___ */

Просмотреть файл

@ -184,7 +184,7 @@ void SetType(nsIHTMLContent* aElement, nsString& aValue)
}
NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -219,15 +219,18 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext,
}
nsSize maxSize = aReflowState.maxSize;
nsReflowMetrics desiredSize = aDesiredSize;
nsHTMLReflowMetrics desiredSize = aDesiredSize;
aDesiredSize.width = CONTROL_SPACING;
aDesiredSize.height = 0;
childFrame = mFirstChild;
nsPoint offset(0,0);
while (nsnull != childFrame) { // reflow, place, size the children
nsReflowState reflowState(childFrame, aReflowState, maxSize);
childFrame->WillReflow(aPresContext);
nsresult result = childFrame->Reflow(aPresContext, desiredSize, reflowState, aStatus);
nsIHTMLReflow* htmlReflow;
if (NS_OK == childFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
nsresult result = htmlReflow->Reflow(aPresContext, desiredSize, reflowState, aStatus);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
nsRect rect(offset.x, offset.y, desiredSize.width, desiredSize.height);
childFrame->SetRect(rect);
@ -237,6 +240,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext,
childFrame->GetNextSibling(childFrame);
offset.x += desiredSize.width + CONTROL_SPACING;
}
}
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;

Просмотреть файл

@ -35,7 +35,7 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Reflow(nsIPresContext& aCX,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);

Просмотреть файл

@ -164,7 +164,7 @@ nsFormControlFrame::Paint(nsIPresContext& aPresContext,
void
nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
// get the css size and let the frame use or override it
@ -183,7 +183,7 @@ nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
void
nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsSize ignore;
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, ignore);
@ -209,7 +209,7 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext,
NS_METHOD
nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -118,7 +118,7 @@ public:
* @see nsIFrame::Reflow
*/
NS_IMETHOD Reflow(nsIPresContext& aCX,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -216,11 +216,11 @@ protected:
*/
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
NS_IMETHOD GetFont(nsIPresContext* aPresContext, nsFont& aFont);

Просмотреть файл

@ -170,7 +170,7 @@ nsTextControlFrame::EnterPressed(nsIPresContext& aPresContext)
void
nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
nsCompatibility mode;

Просмотреть файл

@ -59,7 +59,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
};

Просмотреть файл

@ -43,7 +43,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
protected:
@ -110,7 +110,7 @@ BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
NS_IMETHODIMP
BRFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
if (nsnull != aMetrics.maxElementSize) {

Просмотреть файл

@ -126,7 +126,7 @@ class nsBlockFrame;
struct nsBlockReflowState : public nsFrameReflowState {
nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager);
~nsBlockReflowState();
@ -251,7 +251,7 @@ public:
// nsIRunaround
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus);
@ -313,7 +313,7 @@ public:
nsresult ResizeReflow(nsBlockReflowState& aState);
void ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect);
nsresult ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine);
@ -412,14 +412,14 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
void GetListItemText(nsIPresContext& aCX,
const nsStyleList& aMol,
@ -749,7 +749,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
void
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList =
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
@ -831,7 +831,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
NS_IMETHODIMP
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
// Get the base size
@ -1295,7 +1295,7 @@ GetParentLeftPadding(const nsReflowState* aReflowState)
nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics),
mLineLayout(aPresContext, aSpaceManager)
@ -1691,7 +1691,7 @@ nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
NS_IMETHODIMP
nsBlockFrame::ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
@ -1852,7 +1852,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
void
nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect)
{
aDesiredRect.x = 0;
@ -3190,7 +3190,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
availSize.width = NS_UNCONSTRAINEDSIZE;
availSize.height = NS_UNCONSTRAINEDSIZE;
nsReflowState reflowState(mBullet, aState, availSize);
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsIInlineReflow* iir;
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
mBullet->WillReflow(aState.mPresContext);
@ -3724,11 +3724,14 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// Resize reflow the anchored item into the available space
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsIHTMLReflow* floaterReflow;
if (NS_OK == aFloaterFrame->QueryInterface(kIHTMLReflowIID, (void**)&floaterReflow)) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
aFloaterFrame->WillReflow(aPresContext);
aFloaterFrame->Reflow(aPresContext, desiredSize, reflowState, status);
floaterReflow->WillReflow(aPresContext);
floaterReflow->Reflow(aPresContext, desiredSize, reflowState, status);
aFloaterFrame->SizeTo(desiredSize.width, desiredSize.height);
}
}
PRBool

Просмотреть файл

@ -126,7 +126,7 @@ class nsBlockFrame;
struct nsBlockReflowState : public nsFrameReflowState {
nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager);
~nsBlockReflowState();
@ -251,7 +251,7 @@ public:
// nsIRunaround
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus);
@ -313,7 +313,7 @@ public:
nsresult ResizeReflow(nsBlockReflowState& aState);
void ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect);
nsresult ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine);
@ -412,14 +412,14 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
void GetListItemText(nsIPresContext& aCX,
const nsStyleList& aMol,
@ -749,7 +749,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
void
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList =
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
@ -831,7 +831,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
NS_IMETHODIMP
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
// Get the base size
@ -1295,7 +1295,7 @@ GetParentLeftPadding(const nsReflowState* aReflowState)
nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics),
mLineLayout(aPresContext, aSpaceManager)
@ -1691,7 +1691,7 @@ nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
NS_IMETHODIMP
nsBlockFrame::ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
@ -1852,7 +1852,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
void
nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect)
{
aDesiredRect.x = 0;
@ -3190,7 +3190,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
availSize.width = NS_UNCONSTRAINEDSIZE;
availSize.height = NS_UNCONSTRAINEDSIZE;
nsReflowState reflowState(mBullet, aState, availSize);
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsIInlineReflow* iir;
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
mBullet->WillReflow(aState.mPresContext);
@ -3724,11 +3724,14 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// Resize reflow the anchored item into the available space
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsIHTMLReflow* floaterReflow;
if (NS_OK == aFloaterFrame->QueryInterface(kIHTMLReflowIID, (void**)&floaterReflow)) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
aFloaterFrame->WillReflow(aPresContext);
aFloaterFrame->Reflow(aPresContext, desiredSize, reflowState, status);
floaterReflow->WillReflow(aPresContext);
floaterReflow->Reflow(aPresContext, desiredSize, reflowState, status);
aFloaterFrame->SizeTo(desiredSize.width, desiredSize.height);
}
}
PRBool

Просмотреть файл

@ -126,7 +126,7 @@ class nsBlockFrame;
struct nsBlockReflowState : public nsFrameReflowState {
nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager);
~nsBlockReflowState();
@ -251,7 +251,7 @@ public:
// nsIRunaround
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus);
@ -313,7 +313,7 @@ public:
nsresult ResizeReflow(nsBlockReflowState& aState);
void ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect);
nsresult ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine);
@ -412,14 +412,14 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
void GetListItemText(nsIPresContext& aCX,
const nsStyleList& aMol,
@ -749,7 +749,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
void
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList =
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
@ -831,7 +831,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
NS_IMETHODIMP
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
// Get the base size
@ -1295,7 +1295,7 @@ GetParentLeftPadding(const nsReflowState* aReflowState)
nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics),
mLineLayout(aPresContext, aSpaceManager)
@ -1691,7 +1691,7 @@ nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
NS_IMETHODIMP
nsBlockFrame::ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
@ -1852,7 +1852,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
void
nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect)
{
aDesiredRect.x = 0;
@ -3190,7 +3190,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
availSize.width = NS_UNCONSTRAINEDSIZE;
availSize.height = NS_UNCONSTRAINEDSIZE;
nsReflowState reflowState(mBullet, aState, availSize);
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsIInlineReflow* iir;
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
mBullet->WillReflow(aState.mPresContext);
@ -3724,11 +3724,14 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// Resize reflow the anchored item into the available space
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsIHTMLReflow* floaterReflow;
if (NS_OK == aFloaterFrame->QueryInterface(kIHTMLReflowIID, (void**)&floaterReflow)) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
aFloaterFrame->WillReflow(aPresContext);
aFloaterFrame->Reflow(aPresContext, desiredSize, reflowState, status);
floaterReflow->WillReflow(aPresContext);
floaterReflow->Reflow(aPresContext, desiredSize, reflowState, status);
aFloaterFrame->SizeTo(desiredSize.width, desiredSize.height);
}
}
PRBool

Просмотреть файл

@ -29,6 +29,7 @@
#include "nsIView.h"
#include "nsVoidArray.h"
#include "nsISizeOfHandler.h"
#include "nsHTMLIIDs.h"
#ifdef NS_DEBUG
#undef NOISY
@ -114,7 +115,11 @@ nsContainerFrame::DidReflow(nsIPresContext& aPresContext,
nsIFrame* kid;
FirstChild(kid);
while (nsnull != kid) {
kid->DidReflow(aPresContext, aStatus);
nsIHTMLReflow* htmlReflow;
if (NS_OK == kid->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->DidReflow(aPresContext, aStatus);
}
kid->GetNextSibling(kid);
}
}
@ -287,7 +292,7 @@ NS_METHOD nsContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
*/
nsReflowStatus nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState)
{
nsReflowStatus status;
@ -299,7 +304,10 @@ nsReflowStatus nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
aKidFrame->Reflow(*aPresContext, aDesiredSize, aReflowState, status);
nsIHTMLReflow* htmlReflow;
if (NS_OK == aKidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(*aPresContext, aDesiredSize, aReflowState, status);
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;

Просмотреть файл

@ -115,7 +115,7 @@ protected:
*/
nsReflowStatus ReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
/**

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsDocument.h"
#include "nsIDeviceContext.h"
#include "nsIPresShell.h"
#include "nsHTMLIIDs.h"
// Some Misc #defines
#define SELECTION_DEBUG 0
@ -267,7 +268,10 @@ nsresult nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kIFrameIID);
if (aIID.Equals(kClassIID) || (aIID.Equals(kISupportsIID))) {
if (aIID.Equals(kIHTMLReflowIID)) {
*aInstancePtr = (void*)(nsIHTMLReflow*)this;
return NS_OK;
} else if (aIID.Equals(kClassIID) || aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*)this;
return NS_OK;
}
@ -1083,7 +1087,7 @@ nsFrame::SetFrameState(nsFrameState aNewState)
return NS_OK;
}
// Resize reflow methods
// nsIHTMLReflow member functions
NS_METHOD
nsFrame::WillReflow(nsIPresContext& aPresContext)
@ -1120,7 +1124,7 @@ nsFrame::DidReflow(nsIPresContext& aPresContext,
}
NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -1141,6 +1145,16 @@ NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext,
return NS_OK;
}
NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics)
{
aMetrics.width = mRect.width;
aMetrics.height = mRect.height;
aMetrics.ascent = mRect.height;
aMetrics.descent = 0;
return NS_OK;
}
NS_METHOD nsFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
@ -1156,16 +1170,6 @@ NS_IMETHODIMP nsFrame::AttributeChanged(nsIPresContext* aPresContext,
return NS_OK;
}
NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics)
{
aMetrics.width = mRect.width;
aMetrics.height = mRect.height;
aMetrics.ascent = mRect.height;
aMetrics.descent = 0;
return NS_OK;
}
// Flow member functions
NS_METHOD nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const

Просмотреть файл

@ -19,6 +19,7 @@
#define nsFrame_h___
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
#include "nsRect.h"
#include "nsISelection.h"
#include "nsSelectionRange.h"
@ -87,7 +88,7 @@
//----------------------------------------------------------------------
// Implementation of a simple frame with no children and that isn't splittable
class nsFrame : public nsIFrame
class nsFrame : public nsIFrame, public nsIHTMLReflow
{
public:
/**
@ -140,13 +141,6 @@ public:
PRInt32& aCursor);
NS_IMETHOD GetFrameState(nsFrameState& aResult);
NS_IMETHOD SetFrameState(nsFrameState aNewState);
NS_IMETHOD WillReflow(nsIPresContext& aPresContext);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
@ -155,8 +149,6 @@ public:
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
nsIFrame* aParent,
@ -186,6 +178,17 @@ public:
NS_IMETHOD ListTag(FILE* out = stdout) const;
NS_IMETHOD VerifyTree() const;
// nsIHTMLReflow
NS_IMETHOD WillReflow(nsIPresContext& aPresContext);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics);
// Selection Methods
NS_IMETHOD HandlePress(nsIPresContext& aPresContext,
nsGUIEvent * aEvent,

Просмотреть файл

@ -113,7 +113,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD VerifyTree() const;
@ -124,7 +124,7 @@ protected:
virtual ~nsHTMLFrameOuterFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
virtual PRIntn GetSkipSides() const;
PRBool *mIsInline;
};
@ -151,7 +151,7 @@ public:
* @see nsIFrame::Reflow
*/
NS_IMETHOD Reflow(nsIPresContext& aCX,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -172,7 +172,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
nsIWebShell* mWebShell;
PRBool mCreatingViewer;
@ -224,7 +224,7 @@ nsHTMLFrameOuterFrame::GetSkipSides() const
void
nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
// <frame> processing does not use this routine, only <iframe>
float p2t = aPresContext->GetPixelsToTwips();
@ -286,7 +286,7 @@ NS_IMETHODIMP nsHTMLFrameOuterFrame::ListTag(FILE* out) const
NS_IMETHODIMP
nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -316,16 +316,20 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
nsSize innerSize(aDesiredSize.width - borderWidth - kludge, aDesiredSize.height - borderWidth - kludge);
// Reflow the child and get its desired size
nsReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
nsReflowState kidReflowState(mFirstChild, aReflowState, innerSize);
mFirstChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, kidMetrics, kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
// Place and size the child
nsRect rect(borderWidth, borderWidth, innerSize.width, innerSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
// XXX what should the max-element-size of an iframe be? Shouldn't
// iframe's normally shrink wrap around their content when they
@ -688,7 +692,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
NS_IMETHODIMP
nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -754,7 +758,7 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
void
nsHTMLFrameInnerFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
// it must be defined, but not called
NS_ASSERTION(0, "this should never be called");

Просмотреть файл

@ -74,7 +74,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -88,7 +88,7 @@ protected:
virtual ~nsHTMLFramesetBorderFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
PRInt32 mWidth;
PRBool mVertical;
PRBool mVisibility;
@ -113,7 +113,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -122,7 +122,7 @@ protected:
virtual ~nsHTMLFramesetBlankFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
friend class nsHTMLFramesetFrame;
friend class nsHTMLFrameset;
};
@ -362,7 +362,7 @@ nsHTMLFramesetFrame::GetSkipSides() const
void
nsHTMLFramesetFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsHTMLFramesetFrame* framesetParent = GetFramesetParent(this);
if (nsnull == framesetParent) {
@ -671,9 +671,12 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
}
nsReflowState reflowState(aChild, aReflowState, aSize);
aChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
nsReflowMetrics metrics(nsnull);
if (NS_OK == aChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
nsHTMLReflowMetrics metrics(nsnull);
metrics.width = aSize.width;
metrics.height= aSize.height;
nsReflowStatus status;
@ -694,7 +697,8 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
nsRect rect(aOffset.x, aOffset.y, aSize.width, aSize.height);
aChild->SetFrameState(0);
aChild->SetRect(rect);
aChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); // XXX do we need this
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); // XXX do we need this
}
}
@ -817,7 +821,7 @@ nscolor nsHTMLFramesetFrame::GetBorderColor(nsIContent* aContent)
NS_IMETHODIMP
nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -832,7 +836,7 @@ static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
NS_IMETHODIMP
nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext,
nsFramesetDrag* aDrag,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -1389,7 +1393,7 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
}
if (change != 0) {
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsSize size;
GetSize(size);
nsReflowState state(this, eReflowReason_Initial, size);
@ -1454,7 +1458,7 @@ printf("nsHTMLFramesetBorderFrame destructor %X \n", this);
void nsHTMLFramesetBorderFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
aDesiredSize.width = aReflowState.maxSize.width;
aDesiredSize.height = aReflowState.maxSize.height;
@ -1475,7 +1479,7 @@ void nsHTMLFramesetBorderFrame::SetColor(nscolor aColor)
NS_IMETHODIMP
nsHTMLFramesetBorderFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -1623,7 +1627,7 @@ nsHTMLFramesetBlankFrame::~nsHTMLFramesetBlankFrame()
void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
aDesiredSize.width = aReflowState.maxSize.width;
aDesiredSize.height = aReflowState.maxSize.height;
@ -1633,7 +1637,7 @@ void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsHTMLFramesetBlankFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -23,7 +23,6 @@
#include "nsColor.h"
class nsIContent;
struct nsReflowMetrics;
class nsIFrame;
class nsIPresContext;
class nsIRenderingContext;
@ -118,13 +117,13 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsFramesetDrag* aDrag,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -144,7 +143,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
PRInt32 GetBorderWidth(nsIPresContext* aPresContext);
PRInt32 GetParentBorderWidth() { return mParentBorderWidth; }

Просмотреть файл

@ -43,7 +43,7 @@ public:
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
@ -61,7 +61,7 @@ public:
RootContentFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
@ -119,7 +119,7 @@ RootFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
NS_IMETHODIMP
RootFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -146,16 +146,19 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
// Reflow our pseudo frame. It will choose whetever height its child frame
// wants
if (nsnull != mFirstChild) {
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowState kidReflowState(mFirstChild, aReflowState, aReflowState.maxSize);
nsIHTMLReflow* htmlReflow;
mFirstChild->WillReflow(aPresContext);
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, desiredSize, kidReflowState);
// Place and size the child
nsRect rect(0, 0, desiredSize.width, desiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
}
// Return the max size as our desired size
@ -292,7 +295,7 @@ RootContentFrame::ComputeChildMargins(nsMargin& aMargin)
NS_IMETHODIMP
RootContentFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -360,15 +363,18 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
nsSize maxSize(availWidth, NS_UNCONSTRAINEDSIZE);
nsReflowState kidReflowState(next, aReflowState, maxSize);
nsIHTMLReflow* htmlReflow;
// Dispatch the reflow command to our child frame. Allow it to be as high
// as it wants
mFirstChild->WillReflow(aPresContext);
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
// Place and size the child
nsRect rect(left, top, aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
}
// Compute our desired size
aDesiredSize.width += left + right + sbarWidth;
@ -383,7 +389,7 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
if (nsnull != mFirstChild) {
if (aPresContext.IsPaginated()) {
nscoord y = PAGE_SPACING_TWIPS;
nsReflowMetrics kidSize(aDesiredSize.maxElementSize);
nsHTMLReflowMetrics kidSize(aDesiredSize.maxElementSize);
// Compute the size of each page and the x coordinate within
// ourselves that the pages will be placed at.
@ -409,11 +415,13 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
// Reflow the page
nsReflowState kidReflowState(kidFrame, aReflowState, pageSize,
reflowReason);
nsIHTMLReflow* htmlReflow;
nsReflowStatus status;
// Place and size the page. If the page is narrower than our
// max width then center it horizontally
kidFrame->WillReflow(aPresContext);
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
kidFrame->MoveTo(x, y);
status = ReflowChild(kidFrame, &aPresContext, kidSize,
kidReflowState);
@ -448,6 +456,7 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
#endif
kidFrame->SetNextSibling(continuingPage);
}
}
// Get the next page
kidFrame->GetNextSibling(kidFrame);
@ -467,10 +476,12 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
nsSize maxSize(availWidth, NS_UNCONSTRAINEDSIZE);
nsReflowState kidReflowState(mFirstChild, aReflowState, maxSize,
reflowReason);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
// Get the child's desired size. Our child's desired height is our
// desired size
mFirstChild->WillReflow(aPresContext);
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
@ -484,6 +495,7 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
if (aDesiredSize.height < aReflowState.maxSize.height) {
aDesiredSize.height = aReflowState.maxSize.height;
}
}
// Do the necessary repainting
if (eReflowReason_Initial == reflowReason) {

Просмотреть файл

@ -17,6 +17,7 @@
*/
#include "nsHTMLReflowCommand.h"
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIContent.h"
@ -134,7 +135,7 @@ void nsHTMLReflowCommand::BuildPath()
}
NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize)
{
// Build the path from the target frame (index 0) to the root frame
@ -155,8 +156,12 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext,
mPath.RemoveElementAt(mPath.Count() - 1);
nsReflowState reflowState(root, *this, aMaxSize);
nsIHTMLReflow* htmlReflow;
nsReflowStatus status;
root->Reflow(aPresContext, aDesiredSize, reflowState, status);
if (NS_OK == root->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(aPresContext, aDesiredSize, reflowState, status);
}
}
return NS_OK;

Просмотреть файл

@ -51,7 +51,7 @@ public:
// nsIReflowCommand
NS_IMETHOD Dispatch(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize);
NS_IMETHOD GetNext(nsIFrame*& aNextFrame);
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const;

Просмотреть файл

@ -43,7 +43,6 @@ class nsString;
struct nsPoint;
struct nsRect;
struct nsReflowMetrics;
struct nsStyleStruct;
struct PRLogModuleInfo;
@ -53,168 +52,6 @@ struct PRLogModuleInfo;
#define NS_IFRAME_IID \
{ 0xa6cf9050, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/**
* Reflow metrics used to return the frame's desired size and alignment
* information.
*
* @see #Reflow()
* @see #GetReflowMetrics()
*/
struct nsReflowMetrics {
nscoord width, height; // desired width and height
nscoord ascent, descent;
// Set this to null if you don't need to compute the max element size
nsSize* maxElementSize;
// XXX Explain this better somehow!
// The caller of nsIFrame::Reflow will set these to the top margin
// value carried into the child frame. This allows the the child
// container to collapse the top margin with its first childs
// margin.
nscoord mCarriedInTopMargin; // in
// These values are set by the child frame indicating its final
// inner bottom margin value (the value of the childs last child
// bottom margin)
nscoord mCarriedOutBottomMargin; // out
nsReflowMetrics(nsSize* aMaxElementSize) {
maxElementSize = aMaxElementSize;
mCarriedInTopMargin = 0;
mCarriedOutBottomMargin = 0;
width = 0;
height = 0;
ascent = 0;
descent = 0;
}
};
/**
* Constant used to indicate an unconstrained size.
*
* @see #Reflow()
*/
#define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
/**
* The reason the frame is being reflowed.
*
* @see nsReflowState
*/
enum nsReflowReason {
eReflowReason_Initial = 0, // initial reflow of a newly created frame
eReflowReason_Incremental = 1, // an incremental change has occured. see the reflow command for details
eReflowReason_Resize = 2 // general request to determine a desired size
};
/**
* The type of size constraint that applies to a particular dimension.
* For the fixed and fixed content cases the min size in the reflow state
* structure is ignored and you should use the max size value when reflowing
* the frame.
*
* @see nsReflowState
*/
//XXX enum's are prefixed wrong
enum nsReflowConstraint {
eReflowSize_Unconstrained = 0, // choose whatever frame size you want
eReflowSize_Constrained = 1, // choose a frame size between the min and max sizes
eReflowSize_Fixed = 2, // frame size is fixed
eReflowSize_FixedContent = 3 // size of your content area is fixed
};
/**
* Reflow state passed to a frame during reflow. The reflow states are linked
* together. The max size represents the max available space in which to reflow
* your frame, and is computed as the parent frame's available content area
* minus any room for margins that your frame requests. The min size represents
* the min available space in which to reflow your frame
*
* @see #Reflow()
*/
struct nsReflowState {
const nsReflowState* parentReflowState; // pointer to parent's reflow state
nsIFrame* frame; // the frame being reflowed
nsReflowReason reason; // the reason for the reflow
nsIReflowCommand* reflowCommand; // only used for incremental changes
nsReflowConstraint widthConstraint; // constraint that applies to width dimension
nsReflowConstraint heightConstraint; // constraint that applies to height dimension
nsSize maxSize; // the max available space in which to reflow
nsSize minSize; // the min available space in which to reflow.
// Only used for eReflowSize_Constrained
// Note: there is no copy constructor so that the compiler can
// generate an optimal one.
// Constructs an initial reflow state (no parent reflow state) for a
// non-incremental reflow command
nsReflowState(nsIFrame* aFrame,
nsReflowReason aReason,
const nsSize& aMaxSize);
// Constructs an initial reflow state (no parent reflow state) for an
// incremental reflow command
nsReflowState(nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
const nsSize& aMaxSize);
// Construct a reflow state for the given frame, parent reflow state, and
// max size. Uses the reflow reason and reflow command from the parent's
// reflow state
nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize);
// Constructs a reflow state that overrides the reflow reason of the parent
// reflow state. Sets the reflow command to NULL
nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize,
nsReflowReason aReflowReason);
};
//----------------------------------------------------------------------
/**
* Reflow status returned by the reflow methods.
*
* NS_FRAME_NOT_COMPLETE bit flag means the frame does not map all its
* content, and that the parent frame should create a continuing frame.
* If this bit isn't set it means the frame does map all its content.
*
* NS_FRAME_REFLOW_NEXTINFLOW bit flag means that the next-in-flow is
* dirty, and also needs to be reflowed. This status only makes sense
* for a frame that is not complete, i.e. you wouldn't set both
* NS_FRAME_COMPLETE and NS_FRAME_REFLOW_NEXTINFLOW
*
* The low 8 bits of the nsReflowStatus are reserved for future extensions;
* the remaining 24 bits are zero (and available for extensions; however
* API's that accept/return nsReflowStatus must not receive/return any
* extension bits).
*
* @see #Reflow()
* @see #CreateContinuingFrame()
*/
typedef PRUint32 nsReflowStatus;
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_REFLOW_NEXTINFLOW 0x2
#define NS_FRAME_IS_COMPLETE(status) \
(0 == ((status) & NS_FRAME_NOT_COMPLETE))
#define NS_FRAME_IS_NOT_COMPLETE(status) \
(0 != ((status) & NS_FRAME_NOT_COMPLETE))
// This macro tests to see if an nsReflowStatus is an error value
// or just a regular return value
#define NS_IS_REFLOW_ERROR(_status) (PRInt32(_status) < 0)
//----------------------------------------------------------------------
/**
* Indication of how the frame can be split. This is used when doing runaround
* of floaters, and when pulling up child frames from a next-in-flow.
@ -257,16 +94,6 @@ typedef PRUint32 nsFrameState;
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
typedef PRBool nsDidReflowStatus;
#define NS_FRAME_REFLOW_NOT_FINISHED PR_FALSE
#define NS_FRAME_REFLOW_FINISHED PR_TRUE
//----------------------------------------------------------------------
/**
* A frame in the layout model. This interface is supported by all frame
* objects.
@ -418,64 +245,6 @@ public:
*/
NS_IMETHOD SetFrameState(nsFrameState aNewState) = 0;
/**
* Pre-reflow hook. Before a frame is incrementally reflowed or
* resize-reflowed this method will be called warning the frame of
* the impending reflow. This call may be invoked zero or more times
* before a subsequent DidReflow call. This method when called the
* first time will set the NS_FRAME_IN_REFLOW bit in the frame
* state bits.
*/
NS_IMETHOD WillReflow(nsIPresContext& aPresContext) = 0;
/**
* The frame is given a maximum size and asked for its desired size.
* This is the frame's opportunity to reflow its children.
*
* @param aDesiredSize <i>out</i> parameter where you should return the
* desired size and ascent/descent info. You should include any
* space you want for border/padding in the desired size you return.
*
* It's okay to return a desired size that exceeds the max
* size if that's the smallest you can be, i.e. it's your
* minimum size.
*
* maxElementSize is an optional parameter for returning your
* maximum element size. If may be null in which case you
* don't have to compute a maximum element size. The
* maximum element size must be less than or equal to your
* desired size.
*
* @param aReflowState information about your reflow including the reason
* for the reflow and the available space in which to lay out. Each
* dimension of the available space can either be constrained or
* unconstrained (a value of NS_UNCONSTRAINEDSIZE). If constrained
* you should choose a value that's less than or equal to the
* constrained size. If unconstrained you can choose as
* large a value as you like.
*
* Note that the available space can be negative. In this case you
* still must return an accurate desired size. If you're a container
* you must <b>always</b> reflow at least one frame regardless of the
* available space
*/
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus) = 0;
/**
* Post-reflow hook. After a frame is incrementally reflowed or
* resize-reflowed this method will be called telling the frame of
* the outcome. This call may be invoked many times, while
* NS_FRAME_IN_REFLOW is set, before it is finally called once with
* a NS_FRAME_REFLOW_COMPLETE value. When called with a
* NS_FRAME_REFLOW_COMPLETE value the NS_FRAME_IN_REFLOW bit in the
* frame state will be cleared.
*/
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus) = 0;
/**
* This call is invoked when content is changed in the content tree.
* The first frame that maps that content is asked to deal with the
@ -502,17 +271,6 @@ public:
nsIAtom* aAttribute,
PRInt32 aHint) = 0;
/**
* Return the reflow metrics for this frame. If the frame is a
* container then the values for ascent and descent are computed
* across the the various children in the appropriate manner
* (e.g. for a line frame the ascent value would be the maximum
* ascent of the line's children). Note that the metrics returned
* apply to the frame as it exists at the time of the call.
*/
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics) = 0;
/**
* Return how your frame can be split.
*/
@ -631,91 +389,6 @@ private:
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
// Constructs an initial reflow state (no parent reflow state) for a
// non-incremental reflow command
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
nsReflowReason aReason,
const nsSize& aMaxSize)
{
NS_PRECONDITION(aReason != eReflowReason_Incremental, "unexpected reflow reason");
// the following was removed because framesets need to force a reflow on themselves and didn't
// have nsReflowState parentage available
#if 0
#ifdef NS_DEBUG
nsIFrame* parent;
aFrame->GetGeometricParent(parent);
NS_PRECONDITION(nsnull == parent, "not root frame");
#endif
#endif
reason = aReason;
reflowCommand = nsnull;
maxSize = aMaxSize;
parentReflowState = nsnull;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
// Constructs an initial reflow state (no parent reflow state) for an
// incremental reflow command
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
const nsSize& aMaxSize)
{
#ifdef NS_DEBUG
nsIFrame* parent;
aFrame->GetGeometricParent(parent);
NS_PRECONDITION(nsnull == parent, "not root frame");
#endif
reason = eReflowReason_Incremental;
reflowCommand = &aReflowCommand;
maxSize = aMaxSize;
parentReflowState = nsnull;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
// Construct a reflow state for the given frame, parent reflow state, and
// max size. Uses the reflow reason and reflow command from the parent's
// reflow state
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize)
{
reason = aParentReflowState.reason;
reflowCommand = aParentReflowState.reflowCommand;
maxSize = aMaxSize;
parentReflowState = &aParentReflowState;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
// Constructs a reflow state that overrides the reflow reason of the parent
// reflow state. Sets the reflow command to NULL
inline nsReflowState::nsReflowState(nsIFrame* aFrame,
const nsReflowState& aParentReflowState,
const nsSize& aMaxSize,
nsReflowReason aReflowReason)
{
reason = aReflowReason;
reflowCommand = nsnull;
maxSize = aMaxSize;
parentReflowState = &aParentReflowState;
frame = aFrame;
widthConstraint = eReflowSize_Constrained;
heightConstraint = eReflowSize_Constrained;
minSize.width = 0;
minSize.height = 0;
}
/* ----- nsIListFilter definition ----- */
class nsIListFilter
{

Просмотреть файл

@ -82,7 +82,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
nsIImageMap* GetImageMap();
@ -269,7 +269,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsIFrame* aTargetFrame,
nsFrameImageLoaderCB aCallBack,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsSize styleSize;
PRIntn ss = nsCSSLayout::GetStyleSize(aPresContext, aReflowState, styleSize);
@ -419,7 +419,7 @@ UpdateImageFrame(nsIPresContext& aPresContext, nsIFrame* aFrame,
void
ImageFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
if (mSizeFrozen) {
aDesiredSize.width = mRect.width;

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsHTMLContainerFrame.h"
#include "nsFrameReflowState.h"
#include "nsInlineReflow.h"
#include "nsIHTMLReflow.h"
#include "nsLineLayout.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
@ -31,7 +32,7 @@
struct nsInlineReflowState : nsFrameReflowState {
nsInlineReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics);
const nsHTMLReflowMetrics& aMetrics);
~nsInlineReflowState();
// Last child we have reflowed (so far)
@ -40,7 +41,7 @@ struct nsInlineReflowState : nsFrameReflowState {
nsInlineReflowState::nsInlineReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics)
const nsHTMLReflowMetrics& aMetrics)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics)
{
@ -74,7 +75,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
virtual PRIntn GetSkipSides() const;
@ -96,7 +97,7 @@ public:
void ComputeFinalSize(nsInlineReflowState& aState,
nsInlineReflow& aInlineReflow,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
PRBool ReflowMapped(nsInlineReflowState& aState,
nsInlineReflow& aInlineReflow,
@ -309,7 +310,7 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
NS_IMETHODIMP
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
//XXX ListTag(stdout); printf(": enter (runningMargin=%d)\n", aMetrics.mCarriedInTopMargin);
@ -430,7 +431,7 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
void
nsInlineFrame::ComputeFinalSize(nsInlineReflowState& aState,
nsInlineReflow& aInlineReflow,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
// Align our child frames. Note that inline frames "shrink wrap"
// around their contents therefore we need to fixup the available

Просмотреть файл

@ -56,7 +56,7 @@ NS_METHOD nsLeafFrame::Paint(nsIPresContext& aPresContext,
}
NS_METHOD nsLeafFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -79,7 +79,7 @@ NS_METHOD nsLeafFrame::Reflow(nsIPresContext& aPresContext,
// XXX how should border&padding effect baseline alignment?
// => descent = borderPadding.bottom for example
void nsLeafFrame::AddBordersAndPadding(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
const nsStyleSpacing* space =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);

Просмотреть файл

@ -34,7 +34,7 @@ public:
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
@ -53,7 +53,7 @@ protected:
*/
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize) = 0;
nsHTMLReflowMetrics& aDesiredSize) = 0;
/**
* Get the inner rect of this frame. This takes the outer size (mRect)
@ -65,7 +65,7 @@ protected:
* Subroutine to add in borders and padding
*/
void AddBordersAndPadding(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
};
#endif /* nsLeafFrame_h___ */

Просмотреть файл

@ -145,7 +145,7 @@ public:
// NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame *aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
@ -164,7 +164,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
nsresult SetURL(const nsString& aURLSpec);
@ -298,7 +298,7 @@ exit:
void
nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
// Determine our size stylistically
nsSize styleSize;
@ -339,7 +339,7 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsObjectFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsIReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
: nsContainerFrame(aContent, aParent)
@ -64,7 +65,7 @@ void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
}
NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -126,9 +127,11 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
// XXX Pay attention to the page's border and padding...
if (nsnull != mFirstChild) {
nsReflowState kidReflowState(mFirstChild, aReflowState, aReflowState.maxSize);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
// Get the child's desired size
mFirstChild->WillReflow(aPresContext);
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
// Make sure the child is at least as tall as our max size (the containing window)
@ -139,7 +142,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
// Place and size the child
nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
// Is the frame complete?
if (NS_FRAME_IS_COMPLETE(aStatus)) {
@ -149,6 +152,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
NS_ASSERTION(nsnull == childNextInFlow, "bad child flow list");
}
}
}
// Return our desired size
aDesiredSize.width = aReflowState.maxSize.width;

Просмотреть файл

@ -26,7 +26,7 @@ public:
nsPageFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aMaxSize,
nsReflowStatus& aStatus);

Просмотреть файл

@ -81,7 +81,7 @@ nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
NS_IMETHODIMP
nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState)
{
nsIPresContext& presContext = aLineLayout.mPresContext;

Просмотреть файл

@ -44,7 +44,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,

Просмотреть файл

@ -44,7 +44,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
PRUint8 GetType();
@ -91,7 +91,7 @@ SpacerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
NS_IMETHODIMP
SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
nsresult rv = NS_FRAME_COMPLETE;

Просмотреть файл

@ -151,7 +151,7 @@ public:
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
// TextFrame methods
@ -195,13 +195,13 @@ public:
nscoord dx, nscoord dy);
nsInlineReflowStatus ReflowPre(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFont,
PRInt32 aStartingOffset);
nsInlineReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFontStyle,
const nsStyleText& aTextStyle,
@ -1295,7 +1295,7 @@ TextFrame::GetPosition(nsIPresContext& aCX,
NS_IMETHODIMP
TextFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
@ -1348,7 +1348,7 @@ TextFrame::InlineReflow(nsLineLayout& aLineLayout,
// "whiteSpace" style property.
nsInlineReflowStatus
TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFont,
const nsStyleText& aTextStyle,
@ -1522,7 +1522,7 @@ TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
nsInlineReflowStatus
TextFrame::ReflowPre(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFont,
PRInt32 aStartingOffset)

Просмотреть файл

@ -53,7 +53,7 @@ nsAbsoluteFrame::~nsAbsoluteFrame()
}
NS_IMETHODIMP nsAbsoluteFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -41,7 +41,7 @@ public:
// nsIFrame overrides
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);

Просмотреть файл

@ -43,7 +43,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
protected:
@ -110,7 +110,7 @@ BRFrame::FindTextRuns(nsLineLayout& aLineLayout,
NS_IMETHODIMP
BRFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
if (nsnull != aMetrics.maxElementSize) {

Просмотреть файл

@ -126,7 +126,7 @@ class nsBlockFrame;
struct nsBlockReflowState : public nsFrameReflowState {
nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager);
~nsBlockReflowState();
@ -251,7 +251,7 @@ public:
// nsIRunaround
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus);
@ -313,7 +313,7 @@ public:
nsresult ResizeReflow(nsBlockReflowState& aState);
void ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect);
nsresult ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine);
@ -412,14 +412,14 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
void GetListItemText(nsIPresContext& aCX,
const nsStyleList& aMol,
@ -749,7 +749,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
void
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList =
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
@ -831,7 +831,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
NS_IMETHODIMP
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
// Get the base size
@ -1295,7 +1295,7 @@ GetParentLeftPadding(const nsReflowState* aReflowState)
nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics),
mLineLayout(aPresContext, aSpaceManager)
@ -1691,7 +1691,7 @@ nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
NS_IMETHODIMP
nsBlockFrame::ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
@ -1852,7 +1852,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
void
nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect)
{
aDesiredRect.x = 0;
@ -3190,7 +3190,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
availSize.width = NS_UNCONSTRAINEDSIZE;
availSize.height = NS_UNCONSTRAINEDSIZE;
nsReflowState reflowState(mBullet, aState, availSize);
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsIInlineReflow* iir;
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
mBullet->WillReflow(aState.mPresContext);
@ -3724,11 +3724,14 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// Resize reflow the anchored item into the available space
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsIHTMLReflow* floaterReflow;
if (NS_OK == aFloaterFrame->QueryInterface(kIHTMLReflowIID, (void**)&floaterReflow)) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
aFloaterFrame->WillReflow(aPresContext);
aFloaterFrame->Reflow(aPresContext, desiredSize, reflowState, status);
floaterReflow->WillReflow(aPresContext);
floaterReflow->Reflow(aPresContext, desiredSize, reflowState, status);
aFloaterFrame->SizeTo(desiredSize.width, desiredSize.height);
}
}
PRBool

Просмотреть файл

@ -126,7 +126,7 @@ class nsBlockFrame;
struct nsBlockReflowState : public nsFrameReflowState {
nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager);
~nsBlockReflowState();
@ -251,7 +251,7 @@ public:
// nsIRunaround
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus);
@ -313,7 +313,7 @@ public:
nsresult ResizeReflow(nsBlockReflowState& aState);
void ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect);
nsresult ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine);
@ -412,14 +412,14 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
void GetListItemText(nsIPresContext& aCX,
const nsStyleList& aMol,
@ -749,7 +749,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
void
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList =
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
@ -831,7 +831,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
NS_IMETHODIMP
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
// Get the base size
@ -1295,7 +1295,7 @@ GetParentLeftPadding(const nsReflowState* aReflowState)
nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics),
mLineLayout(aPresContext, aSpaceManager)
@ -1691,7 +1691,7 @@ nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
NS_IMETHODIMP
nsBlockFrame::ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
@ -1852,7 +1852,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
void
nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect)
{
aDesiredRect.x = 0;
@ -3190,7 +3190,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
availSize.width = NS_UNCONSTRAINEDSIZE;
availSize.height = NS_UNCONSTRAINEDSIZE;
nsReflowState reflowState(mBullet, aState, availSize);
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsIInlineReflow* iir;
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
mBullet->WillReflow(aState.mPresContext);
@ -3724,11 +3724,14 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// Resize reflow the anchored item into the available space
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsIHTMLReflow* floaterReflow;
if (NS_OK == aFloaterFrame->QueryInterface(kIHTMLReflowIID, (void**)&floaterReflow)) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
aFloaterFrame->WillReflow(aPresContext);
aFloaterFrame->Reflow(aPresContext, desiredSize, reflowState, status);
floaterReflow->WillReflow(aPresContext);
floaterReflow->Reflow(aPresContext, desiredSize, reflowState, status);
aFloaterFrame->SizeTo(desiredSize.width, desiredSize.height);
}
}
PRBool

Просмотреть файл

@ -126,7 +126,7 @@ class nsBlockFrame;
struct nsBlockReflowState : public nsFrameReflowState {
nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager);
~nsBlockReflowState();
@ -251,7 +251,7 @@ public:
// nsIRunaround
NS_IMETHOD ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus);
@ -313,7 +313,7 @@ public:
nsresult ResizeReflow(nsBlockReflowState& aState);
void ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect);
nsresult ReflowLinesAt(nsBlockReflowState& aState, LineData* aLine);
@ -412,14 +412,14 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
void SetListItemOrdinal(nsBlockReflowState& aBlockState);
void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
void GetListItemText(nsIPresContext& aCX,
const nsStyleList& aMol,
@ -749,7 +749,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
void
BulletFrame::GetDesiredSize(nsIPresContext* aCX,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
const nsStyleList* myList =
(const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List);
@ -831,7 +831,7 @@ BulletFrame::GetDesiredSize(nsIPresContext* aCX,
NS_IMETHODIMP
BulletFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
// Get the base size
@ -1295,7 +1295,7 @@ GetParentLeftPadding(const nsReflowState* aReflowState)
nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics,
const nsHTMLReflowMetrics& aMetrics,
nsISpaceManager* aSpaceManager)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics),
mLineLayout(aPresContext, aSpaceManager)
@ -1691,7 +1691,7 @@ nsBlockFrame::FirstChild(nsIFrame*& aFirstChild) const
NS_IMETHODIMP
nsBlockFrame::ReflowAround(nsIPresContext& aPresContext,
nsISpaceManager* aSpaceManager,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsRect& aDesiredRect,
nsReflowStatus& aStatus)
@ -1852,7 +1852,7 @@ nsBlockFrame::RenumberLists(nsBlockReflowState& aState)
void
nsBlockFrame::ComputeFinalSize(nsBlockReflowState& aState,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
nsRect& aDesiredRect)
{
aDesiredRect.x = 0;
@ -3190,7 +3190,7 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
availSize.width = NS_UNCONSTRAINEDSIZE;
availSize.height = NS_UNCONSTRAINEDSIZE;
nsReflowState reflowState(mBullet, aState, availSize);
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsIInlineReflow* iir;
if (NS_OK == mBullet->QueryInterface(kIInlineReflowIID, (void**) &iir)) {
mBullet->WillReflow(aState.mPresContext);
@ -3724,11 +3724,14 @@ nsBlockFrame::ReflowFloater(nsIPresContext& aPresContext,
// Resize reflow the anchored item into the available space
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsIHTMLReflow* floaterReflow;
if (NS_OK == aFloaterFrame->QueryInterface(kIHTMLReflowIID, (void**)&floaterReflow)) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
aFloaterFrame->WillReflow(aPresContext);
aFloaterFrame->Reflow(aPresContext, desiredSize, reflowState, status);
floaterReflow->WillReflow(aPresContext);
floaterReflow->Reflow(aPresContext, desiredSize, reflowState, status);
aFloaterFrame->SizeTo(desiredSize.width, desiredSize.height);
}
}
PRBool

Просмотреть файл

@ -114,7 +114,7 @@ nsBodyFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
NS_IMETHODIMP
nsBodyFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -183,14 +183,16 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
// It's an absolutely positioned frame that's the target.
// XXX FIX ME. For an absolutely positioned item we need to properly
// compute the available space and compute the origin...
nsIHTMLReflow* reflow;
if (NS_OK == nextFrame->QueryInterface(kIHTMLReflowIID, (void**)&reflow)) {
nsReflowState reflowState(nextFrame, aReflowState, aReflowState.maxSize);
nextFrame->WillReflow(aPresContext);
nsresult rv = nextFrame->Reflow(aPresContext, aDesiredSize,
reflowState, aStatus);
reflow->WillReflow(aPresContext);
nsresult rv = reflow->Reflow(aPresContext, aDesiredSize, reflowState, aStatus);
if (NS_OK != rv) {
return rv;
}
nextFrame->SizeTo(aDesiredSize.width, aDesiredSize.height);
}
// XXX Temporary code: if the frame we just reflowed is a
// floating frame then fall through into the main reflow pathway
@ -206,7 +208,7 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
nextFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct*&) display);
if (NS_STYLE_FLOAT_NONE == display->mFloats) {
return rv;
return NS_OK;
}
// Switch over to a reflow-state that is called resize instead
@ -249,12 +251,15 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
nsIRunaround* reflowRunaround;
nsReflowState reflowState(mFirstChild, *rsp, kidMaxSize);
nsRect desiredRect;
nsIHTMLReflow* childReflow;
mFirstChild->WillReflow(aPresContext);
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&childReflow)) {
childReflow->WillReflow(aPresContext);
mFirstChild->MoveTo(borderPadding.left, borderPadding.top);
mFirstChild->QueryInterface(kIRunaroundIID, (void**)&reflowRunaround);
reflowRunaround->ReflowAround(aPresContext, mSpaceManager, aDesiredSize,
reflowState, desiredRect, aStatus);
}
// If the frame is complete, then check whether there's a next-in-flow that
// needs to be deleted
@ -497,7 +502,7 @@ nsBodyFrame::ComputeDesiredSize(nsIPresContext& aPresContext,
const nsRect& aDesiredRect,
const nsSize& aMaxSize,
const nsMargin& aBorderPadding,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
// Note: Body used as a pseudo-frame shrink wraps (unless of course
// style says otherwise)
@ -732,7 +737,9 @@ void nsBodyFrame::ReflowAbsoluteItems(nsIPresContext* aPresContext,
nsRect rect;
ComputeAbsoluteFrameBounds(anchorFrame, aReflowState, position, rect);
absoluteFrame->WillReflow(*aPresContext);
nsIHTMLReflow* htmlReflow;
if (NS_OK == absoluteFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(*aPresContext);
absoluteFrame->MoveTo(rect.x, rect.y);
if (reflowFrame) {
@ -745,11 +752,11 @@ void nsBodyFrame::ReflowAbsoluteItems(nsIPresContext* aPresContext,
availSize.height = NS_UNCONSTRAINEDSIZE;
}
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowState reflowState(absoluteFrame, aReflowState, availSize,
reflowReason);
nsReflowStatus status;
absoluteFrame->Reflow(*aPresContext, desiredSize, reflowState, status);
htmlReflow->Reflow(*aPresContext, desiredSize, reflowState, status);
// Figure out what size to actually use. If we let the child choose its
// size, then use what the child requested. Otherwise, use the value
@ -769,6 +776,7 @@ void nsBodyFrame::ReflowAbsoluteItems(nsIPresContext* aPresContext,
}
}
}
}
}
nsIView* nsBodyFrame::CreateAbsoluteView(const nsStylePosition* aPosition,

Просмотреть файл

@ -41,7 +41,7 @@ public:
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -89,7 +89,7 @@ protected:
const nsRect& aDesiredRect,
const nsSize& aMaxSize,
const nsMargin& aBorderPadding,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
virtual PRIntn GetSkipSides() const;

Просмотреть файл

@ -29,6 +29,7 @@
#include "nsIView.h"
#include "nsVoidArray.h"
#include "nsISizeOfHandler.h"
#include "nsHTMLIIDs.h"
#ifdef NS_DEBUG
#undef NOISY
@ -114,7 +115,11 @@ nsContainerFrame::DidReflow(nsIPresContext& aPresContext,
nsIFrame* kid;
FirstChild(kid);
while (nsnull != kid) {
kid->DidReflow(aPresContext, aStatus);
nsIHTMLReflow* htmlReflow;
if (NS_OK == kid->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->DidReflow(aPresContext, aStatus);
}
kid->GetNextSibling(kid);
}
}
@ -287,7 +292,7 @@ NS_METHOD nsContainerFrame::GetCursorAndContentAt(nsIPresContext& aPresContext,
*/
nsReflowStatus nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState)
{
nsReflowStatus status;
@ -299,7 +304,10 @@ nsReflowStatus nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
aKidFrame->Reflow(*aPresContext, aDesiredSize, aReflowState, status);
nsIHTMLReflow* htmlReflow;
if (NS_OK == aKidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(*aPresContext, aDesiredSize, aReflowState, status);
}
if (NS_FRAME_IS_COMPLETE(status)) {
nsIFrame* kidNextInFlow;

Просмотреть файл

@ -115,7 +115,7 @@ protected:
*/
nsReflowStatus ReflowChild(nsIFrame* aKidFrame,
nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
/**

Просмотреть файл

@ -39,6 +39,7 @@
#include "nsDocument.h"
#include "nsIDeviceContext.h"
#include "nsIPresShell.h"
#include "nsHTMLIIDs.h"
// Some Misc #defines
#define SELECTION_DEBUG 0
@ -267,7 +268,10 @@ nsresult nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
}
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kClassIID, kIFrameIID);
if (aIID.Equals(kClassIID) || (aIID.Equals(kISupportsIID))) {
if (aIID.Equals(kIHTMLReflowIID)) {
*aInstancePtr = (void*)(nsIHTMLReflow*)this;
return NS_OK;
} else if (aIID.Equals(kClassIID) || aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*)this;
return NS_OK;
}
@ -1083,7 +1087,7 @@ nsFrame::SetFrameState(nsFrameState aNewState)
return NS_OK;
}
// Resize reflow methods
// nsIHTMLReflow member functions
NS_METHOD
nsFrame::WillReflow(nsIPresContext& aPresContext)
@ -1120,7 +1124,7 @@ nsFrame::DidReflow(nsIPresContext& aPresContext,
}
NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -1141,6 +1145,16 @@ NS_METHOD nsFrame::Reflow(nsIPresContext& aPresContext,
return NS_OK;
}
NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics)
{
aMetrics.width = mRect.width;
aMetrics.height = mRect.height;
aMetrics.ascent = mRect.height;
aMetrics.descent = 0;
return NS_OK;
}
NS_METHOD nsFrame::ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
nsISupports* aSubContent)
@ -1156,16 +1170,6 @@ NS_IMETHODIMP nsFrame::AttributeChanged(nsIPresContext* aPresContext,
return NS_OK;
}
NS_METHOD nsFrame::GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics)
{
aMetrics.width = mRect.width;
aMetrics.height = mRect.height;
aMetrics.ascent = mRect.height;
aMetrics.descent = 0;
return NS_OK;
}
// Flow member functions
NS_METHOD nsFrame::IsSplittable(nsSplittableType& aIsSplittable) const

Просмотреть файл

@ -19,6 +19,7 @@
#define nsFrame_h___
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
#include "nsRect.h"
#include "nsISelection.h"
#include "nsSelectionRange.h"
@ -87,7 +88,7 @@
//----------------------------------------------------------------------
// Implementation of a simple frame with no children and that isn't splittable
class nsFrame : public nsIFrame
class nsFrame : public nsIFrame, public nsIHTMLReflow
{
public:
/**
@ -140,13 +141,6 @@ public:
PRInt32& aCursor);
NS_IMETHOD GetFrameState(nsFrameState& aResult);
NS_IMETHOD SetFrameState(nsFrameState aNewState);
NS_IMETHOD WillReflow(nsIPresContext& aPresContext);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
nsIContent* aChild,
@ -155,8 +149,6 @@ public:
nsIContent* aChild,
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics);
NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const;
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
nsIFrame* aParent,
@ -186,6 +178,17 @@ public:
NS_IMETHOD ListTag(FILE* out = stdout) const;
NS_IMETHOD VerifyTree() const;
// nsIHTMLReflow
NS_IMETHOD WillReflow(nsIPresContext& aPresContext);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
nsDidReflowStatus aStatus);
NS_IMETHOD GetReflowMetrics(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aMetrics);
// Selection Methods
NS_IMETHOD HandlePress(nsIPresContext& aPresContext,
nsGUIEvent * aEvent,

Просмотреть файл

@ -19,10 +19,12 @@
#include "nsFrameReflowState.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
nsFrameReflowState::nsFrameReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics)
const nsHTMLReflowMetrics& aMetrics)
: nsReflowState(aReflowState),
mPresContext(aPresContext)
{

Просмотреть файл

@ -19,8 +19,11 @@
#ifndef nsFrameReflowState_h___
#define nsFrameReflowState_h___
#include "nsIFrame.h"
#include "nsIFrameReflow.h"
#include "nsMargin.h"
class nsIPresContext;
struct nsHTMLReflowMetrics;
struct nsStyleDisplay;
struct nsStyleSpacing;
struct nsStyleText;
@ -29,7 +32,7 @@ class nsFrameReflowState : public nsReflowState {
public:
nsFrameReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics);
const nsHTMLReflowMetrics& aMetrics);
~nsFrameReflowState();
nsIPresContext& mPresContext;

Просмотреть файл

@ -44,7 +44,7 @@ public:
nsIFrame* aParentFrame);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
@ -56,7 +56,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
PRBool GetNoShade();
PRInt32 GetThickness();
@ -207,7 +207,7 @@ HRuleFrame::Paint(nsIPresContext& aPresContext,
NS_IMETHODIMP
HRuleFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -243,7 +243,7 @@ HRuleFrame::Reflow(nsIPresContext& aPresContext,
void
HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsSize size;
PRIntn ss = nsCSSLayout::GetStyleSize(aPresContext, aReflowState, size);

Просмотреть файл

@ -43,7 +43,7 @@ public:
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
@ -61,7 +61,7 @@ public:
RootContentFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
@ -119,7 +119,7 @@ RootFrame::Init(nsIPresContext& aPresContext, nsIFrame* aChildList)
NS_IMETHODIMP
RootFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -146,16 +146,19 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
// Reflow our pseudo frame. It will choose whetever height its child frame
// wants
if (nsnull != mFirstChild) {
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowState kidReflowState(mFirstChild, aReflowState, aReflowState.maxSize);
nsIHTMLReflow* htmlReflow;
mFirstChild->WillReflow(aPresContext);
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, desiredSize, kidReflowState);
// Place and size the child
nsRect rect(0, 0, desiredSize.width, desiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
}
// Return the max size as our desired size
@ -292,7 +295,7 @@ RootContentFrame::ComputeChildMargins(nsMargin& aMargin)
NS_IMETHODIMP
RootContentFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -360,15 +363,18 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
nsSize maxSize(availWidth, NS_UNCONSTRAINEDSIZE);
nsReflowState kidReflowState(next, aReflowState, maxSize);
nsIHTMLReflow* htmlReflow;
// Dispatch the reflow command to our child frame. Allow it to be as high
// as it wants
mFirstChild->WillReflow(aPresContext);
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
// Place and size the child
nsRect rect(left, top, aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
}
// Compute our desired size
aDesiredSize.width += left + right + sbarWidth;
@ -383,7 +389,7 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
if (nsnull != mFirstChild) {
if (aPresContext.IsPaginated()) {
nscoord y = PAGE_SPACING_TWIPS;
nsReflowMetrics kidSize(aDesiredSize.maxElementSize);
nsHTMLReflowMetrics kidSize(aDesiredSize.maxElementSize);
// Compute the size of each page and the x coordinate within
// ourselves that the pages will be placed at.
@ -409,11 +415,13 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
// Reflow the page
nsReflowState kidReflowState(kidFrame, aReflowState, pageSize,
reflowReason);
nsIHTMLReflow* htmlReflow;
nsReflowStatus status;
// Place and size the page. If the page is narrower than our
// max width then center it horizontally
kidFrame->WillReflow(aPresContext);
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
kidFrame->MoveTo(x, y);
status = ReflowChild(kidFrame, &aPresContext, kidSize,
kidReflowState);
@ -448,6 +456,7 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
#endif
kidFrame->SetNextSibling(continuingPage);
}
}
// Get the next page
kidFrame->GetNextSibling(kidFrame);
@ -467,10 +476,12 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
nsSize maxSize(availWidth, NS_UNCONSTRAINEDSIZE);
nsReflowState kidReflowState(mFirstChild, aReflowState, maxSize,
reflowReason);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
// Get the child's desired size. Our child's desired height is our
// desired size
mFirstChild->WillReflow(aPresContext);
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
@ -484,6 +495,7 @@ RootContentFrame::Reflow(nsIPresContext& aPresContext,
if (aDesiredSize.height < aReflowState.maxSize.height) {
aDesiredSize.height = aReflowState.maxSize.height;
}
}
// Do the necessary repainting
if (eReflowReason_Initial == reflowReason) {

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsIFloaterContainer.h"
#include "nsIRunaround.h"
#include "nsIInlineReflow.h"
#include "nsIHTMLReflow.h"
const nsIID kIAbsoluteItemsIID = NS_IABSOLUTE_ITEMS_IID;
const nsIID kIAnchoredItemsIID = NS_IANCHORED_ITEMS_IID;
@ -29,3 +30,4 @@ const nsIID kIFloaterContainerIID = NS_IFLOATER_CONTAINER_IID;
const nsIID kIHTMLContentIID = NS_IHTMLCONTENT_IID;
const nsIID kIInlineReflowIID = NS_IINLINE_REFLOW_IID;
const nsIID kIRunaroundIID = NS_IRUNAROUND_IID;
const nsIID kIHTMLReflowIID = NS_IHTMLREFLOW_IID;

Просмотреть файл

@ -28,5 +28,6 @@ extern const nsIID kIFloaterContainerIID;
extern const nsIID kIHTMLContentIID;
extern const nsIID kIInlineReflowIID;
extern const nsIID kIRunaroundIID;
extern const nsIID kIHTMLReflowIID;
#endif /* nsHTMLIIDs_h___ */

Просмотреть файл

@ -26,7 +26,7 @@ class nsIFrameImageLoader;
class nsIPresContext;
class nsISizeOfHandler;
struct nsReflowState;
struct nsReflowMetrics;
struct nsHTMLReflowMetrics;
struct nsSize;
/**
@ -75,7 +75,7 @@ public:
const nsReflowState& aReflowState,
nsIFrame* aTargetFrame,
nsFrameImageLoaderCB aCallBack,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
PRBool GetLoadImageFailed() {
return mLoadImageFailed;

Просмотреть файл

@ -17,6 +17,7 @@
*/
#include "nsHTMLReflowCommand.h"
#include "nsIFrame.h"
#include "nsIHTMLReflow.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIContent.h"
@ -134,7 +135,7 @@ void nsHTMLReflowCommand::BuildPath()
}
NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize)
{
// Build the path from the target frame (index 0) to the root frame
@ -155,8 +156,12 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext,
mPath.RemoveElementAt(mPath.Count() - 1);
nsReflowState reflowState(root, *this, aMaxSize);
nsIHTMLReflow* htmlReflow;
nsReflowStatus status;
root->Reflow(aPresContext, aDesiredSize, reflowState, status);
if (NS_OK == root->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(aPresContext, aDesiredSize, reflowState, status);
}
}
return NS_OK;

Просмотреть файл

@ -51,7 +51,7 @@ public:
// nsIReflowCommand
NS_IMETHOD Dispatch(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize);
NS_IMETHOD GetNext(nsIFrame*& aNextFrame);
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const;

Просмотреть файл

@ -21,6 +21,7 @@
#include "nsIFrame.h"
class nsPlaceholderFrame;
class nsIPresContext;
struct nsReflowState;
// 5a305ee0-cb55-11d1-8556-00a02468fab6
#define NS_IFLOATER_CONTAINER_IID \

Просмотреть файл

@ -0,0 +1,88 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIHTMLReflow_h___
#define nsIHTMLReflow_h___
#include "nsIFrameReflow.h"
// IID for the nsIHTMLFrame interface
// a6cf9069-15b3-11d2-932e-00805f8add32
#define NS_IHTMLREFLOW_IID \
{ 0xa6cf9069, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/**
* HTML/CSS specific reflow metrics
*/
struct nsHTMLReflowMetrics : nsReflowMetrics {
// XXX Explain this better somehow!
// The caller of nsIFrame::Reflow will set these to the top margin
// value carried into the child frame. This allows the the child
// container to collapse the top margin with its first childs
// margin.
nscoord mCarriedInTopMargin; // in
// These values are set by the child frame indicating its final
// inner bottom margin value (the value of the childs last child
// bottom margin)
nscoord mCarriedOutBottomMargin; // out
nsHTMLReflowMetrics(nsSize* aMaxElementSize)
: nsReflowMetrics(aMaxElementSize)
{
mCarriedInTopMargin = 0;
mCarriedOutBottomMargin = 0;
}
};
/**
* The type of size constraint that applies to a particular dimension.
* For the fixed and fixed content cases the min size in the reflow state
* structure is ignored and you should use the max size value when reflowing
* the frame.
*
* @see nsReflowState
*/
//XXX enum's are prefixed wrong
enum nsReflowConstraint {
eReflowSize_Unconstrained = 0, // choose whatever frame size you want
eReflowSize_Constrained = 1, // choose a frame size between the min and max sizes
eReflowSize_Fixed = 2, // frame size is fixed
eReflowSize_FixedContent = 3 // size of your content area is fixed
};
#if 0
// XXX None of this is currently being used...
struct nsHTMLReflowState : nsReflowState {
nsReflowConstraint widthConstraint; // constraint that applies to width dimension
nsReflowConstraint heightConstraint; // constraint that applies to height dimension
nsSize minSize; // the min available space in which to reflow.
// Only used for eReflowSize_Constrained
};
#endif
/**
* Generate a reflow interface specific to HTML/CSS frame objects
*/
class nsIHTMLReflow : public nsIFrameReflow<nsReflowState, nsHTMLReflowMetrics>
{
};
#endif /* nsIHTMLReflow_h___ */

Просмотреть файл

@ -21,7 +21,9 @@
#include "nsISupports.h"
#include "nsStyleConsts.h"
#include "nsIFrameReflow.h"
class nsLineLayout;
struct nsHTMLReflowMetrics;
/* d76e29b0-ff56-11d1-89e7-006008911b81 */
#define NS_IINLINE_REFLOW_IID \
@ -43,7 +45,7 @@ public:
* InlineReflow method. See below for how to interpret the return value.
*/
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState) = 0;
};

Просмотреть файл

@ -82,7 +82,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
nsIImageMap* GetImageMap();
@ -269,7 +269,7 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsIFrame* aTargetFrame,
nsFrameImageLoaderCB aCallBack,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsSize styleSize;
PRIntn ss = nsCSSLayout::GetStyleSize(aPresContext, aReflowState, styleSize);
@ -419,7 +419,7 @@ UpdateImageFrame(nsIPresContext& aPresContext, nsIFrame* aFrame,
void
ImageFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
if (mSizeFrozen) {
aDesiredSize.width = mRect.width;

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsHTMLContainerFrame.h"
#include "nsFrameReflowState.h"
#include "nsInlineReflow.h"
#include "nsIHTMLReflow.h"
#include "nsLineLayout.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
@ -31,7 +32,7 @@
struct nsInlineReflowState : nsFrameReflowState {
nsInlineReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics);
const nsHTMLReflowMetrics& aMetrics);
~nsInlineReflowState();
// Last child we have reflowed (so far)
@ -40,7 +41,7 @@ struct nsInlineReflowState : nsFrameReflowState {
nsInlineReflowState::nsInlineReflowState(nsIPresContext& aPresContext,
const nsReflowState& aReflowState,
const nsReflowMetrics& aMetrics)
const nsHTMLReflowMetrics& aMetrics)
: nsFrameReflowState(aPresContext, aReflowState, aMetrics)
{
@ -74,7 +75,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
virtual PRIntn GetSkipSides() const;
@ -96,7 +97,7 @@ public:
void ComputeFinalSize(nsInlineReflowState& aState,
nsInlineReflow& aInlineReflow,
nsReflowMetrics& aMetrics);
nsHTMLReflowMetrics& aMetrics);
PRBool ReflowMapped(nsInlineReflowState& aState,
nsInlineReflow& aInlineReflow,
@ -309,7 +310,7 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
NS_IMETHODIMP
nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
//XXX ListTag(stdout); printf(": enter (runningMargin=%d)\n", aMetrics.mCarriedInTopMargin);
@ -430,7 +431,7 @@ nsInlineFrame::InlineReflow(nsLineLayout& aLineLayout,
void
nsInlineFrame::ComputeFinalSize(nsInlineReflowState& aState,
nsInlineReflow& aInlineReflow,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
// Align our child frames. Note that inline frames "shrink wrap"
// around their contents therefore we need to fixup the available

Просмотреть файл

@ -192,7 +192,7 @@ nsInlineReflow::ReflowFrame(nsIFrame* aFrame)
{
nsReflowStatus result;
nsSize innerMaxElementSize;
nsReflowMetrics metrics(mComputeMaxElementSize
nsHTMLReflowMetrics metrics(mComputeMaxElementSize
? &innerMaxElementSize
: nsnull);
@ -346,7 +346,7 @@ nsInlineReflow::ComputeAvailableSize()
* Reflow the frame, choosing the appropriate reflow method.
*/
PRBool
nsInlineReflow::ReflowFrame(nsReflowMetrics& aMetrics,
nsInlineReflow::ReflowFrame(nsHTMLReflowMetrics& aMetrics,
nsRect& aBounds,
nsInlineReflowStatus& aStatus)
{
@ -374,7 +374,10 @@ nsInlineReflow::ReflowFrame(nsReflowMetrics& aMetrics,
// Let frame know that are reflowing it
nscoord x = mFrameX;
nscoord y = mFrameY;
mFrame->WillReflow(mPresContext);
nsIHTMLReflow* htmlReflow;
mFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow);
htmlReflow->WillReflow(mPresContext);
mFrame->MoveTo(x, y);
// There are 3 ways to reflow the child frame: using the
@ -419,7 +422,7 @@ nsInlineReflow::ReflowFrame(nsReflowMetrics& aMetrics,
aBounds.height = aMetrics.height;
}
else {
mFrame->Reflow(mPresContext, aMetrics, reflowState, aStatus);
htmlReflow->Reflow(mPresContext, aMetrics, reflowState, aStatus);
aBounds.width = aMetrics.width;
aBounds.height = aMetrics.height;
}
@ -469,7 +472,7 @@ nsInlineReflow::ReflowFrame(nsReflowMetrics& aMetrics,
* assume that the caller will take care of that.
*/
PRBool
nsInlineReflow::CanPlaceFrame(nsReflowMetrics& aMetrics,
nsInlineReflow::CanPlaceFrame(nsHTMLReflowMetrics& aMetrics,
nsRect& aBounds,
nsInlineReflowStatus& aStatus)
{
@ -523,7 +526,7 @@ nsInlineReflow::CanPlaceFrame(nsReflowMetrics& aMetrics,
* Place the frame. Update running counters.
*/
void
nsInlineReflow::PlaceFrame(nsReflowMetrics& aMetrics, nsRect& aBounds)
nsInlineReflow::PlaceFrame(nsHTMLReflowMetrics& aMetrics, nsRect& aBounds)
{
// Remember this for later...
if (mTreatFrameAsBlock) {
@ -600,7 +603,7 @@ nsInlineReflow::PlaceFrame(nsReflowMetrics& aMetrics, nsRect& aBounds)
* Store away the ascent value associated with the current frame
*/
nsresult
nsInlineReflow::SetFrameData(const nsReflowMetrics& aMetrics)
nsInlineReflow::SetFrameData(const nsHTMLReflowMetrics& aMetrics)
{
PRInt32 frameNum = mFrameNum;
if (frameNum == mNumFrameData) {

Просмотреть файл

@ -89,17 +89,17 @@ protected:
PRBool ComputeAvailableSize();
PRBool ReflowFrame(nsReflowMetrics& aMetrics,
PRBool ReflowFrame(nsHTMLReflowMetrics& aMetrics,
nsRect& aBounds,
nsInlineReflowStatus& aStatus);
PRBool CanPlaceFrame(nsReflowMetrics& aMetrics,
PRBool CanPlaceFrame(nsHTMLReflowMetrics& aMetrics,
nsRect& aBounds,
nsInlineReflowStatus& aStatus);
void PlaceFrame(nsReflowMetrics& aMetrics, nsRect& aBounds);
void PlaceFrame(nsHTMLReflowMetrics& aMetrics, nsRect& aBounds);
nsresult SetFrameData(const nsReflowMetrics& aMetrics);
nsresult SetFrameData(const nsHTMLReflowMetrics& aMetrics);
// The outer frame that contains the frames that we reflow.
nsHTMLContainerFrame* mOuterFrame;

Просмотреть файл

@ -56,7 +56,7 @@ NS_METHOD nsLeafFrame::Paint(nsIPresContext& aPresContext,
}
NS_METHOD nsLeafFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -79,7 +79,7 @@ NS_METHOD nsLeafFrame::Reflow(nsIPresContext& aPresContext,
// XXX how should border&padding effect baseline alignment?
// => descent = borderPadding.bottom for example
void nsLeafFrame::AddBordersAndPadding(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
const nsStyleSpacing* space =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);

Просмотреть файл

@ -34,7 +34,7 @@ public:
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD ContentChanged(nsIPresContext* aPresContext,
@ -53,7 +53,7 @@ protected:
*/
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize) = 0;
nsHTMLReflowMetrics& aDesiredSize) = 0;
/**
* Get the inner rect of this frame. This takes the outer size (mRect)
@ -65,7 +65,7 @@ protected:
* Subroutine to add in borders and padding
*/
void AddBordersAndPadding(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
};
#endif /* nsLeafFrame_h___ */

Просмотреть файл

@ -145,7 +145,7 @@ public:
// NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame *aChildList);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD DidReflow(nsIPresContext& aPresContext,
@ -164,7 +164,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
nsresult SetURL(const nsString& aURLSpec);
@ -298,7 +298,7 @@ exit:
void
nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aMetrics)
nsHTMLReflowMetrics& aMetrics)
{
// Determine our size stylistically
nsSize styleSize;
@ -339,7 +339,7 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsObjectFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -22,6 +22,7 @@
#include "nsIReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
nsPageFrame::nsPageFrame(nsIContent* aContent, nsIFrame* aParent)
: nsContainerFrame(aContent, aParent)
@ -64,7 +65,7 @@ void nsPageFrame::CreateFirstChild(nsIPresContext* aPresContext)
}
NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -126,9 +127,11 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
// XXX Pay attention to the page's border and padding...
if (nsnull != mFirstChild) {
nsReflowState kidReflowState(mFirstChild, aReflowState, aReflowState.maxSize);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
// Get the child's desired size
mFirstChild->WillReflow(aPresContext);
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
// Make sure the child is at least as tall as our max size (the containing window)
@ -139,7 +142,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
// Place and size the child
nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
// Is the frame complete?
if (NS_FRAME_IS_COMPLETE(aStatus)) {
@ -149,6 +152,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext,
NS_ASSERTION(nsnull == childNextInFlow, "bad child flow list");
}
}
}
// Return our desired size
aDesiredSize.width = aReflowState.maxSize.width;

Просмотреть файл

@ -26,7 +26,7 @@ public:
nsPageFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aMaxSize,
nsReflowStatus& aStatus);

Просмотреть файл

@ -81,7 +81,7 @@ nsPlaceholderFrame::FindTextRuns(nsLineLayout& aLineLayout,
NS_IMETHODIMP
nsPlaceholderFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState)
{
nsIPresContext& presContext = aLineLayout.mPresContext;

Просмотреть файл

@ -44,7 +44,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
NS_IMETHOD Paint(nsIPresContext& aPresContext,
nsIRenderingContext& aRenderingContext,

Просмотреть файл

@ -32,6 +32,7 @@
#include "nsIPref.h"
#include "nsIViewObserver.h"
#include "nsContainerFrame.h"
#include "nsHTMLIIDs.h"
static PRBool gsNoisyRefs = PR_FALSE;
#undef NOISY
@ -498,17 +499,20 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
nsRect bounds;
mPresContext->GetVisibleArea(bounds);
nsSize maxSize(bounds.width, bounds.height);
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
nsReflowState reflowState(mRootFrame, eReflowReason_Initial, maxSize);
nsIHTMLReflow* htmlReflow;
mRootFrame->Reflow(*mPresContext, desiredSize, reflowState, status);
if (NS_OK == mRootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status);
mRootFrame->SizeTo(desiredSize.width, desiredSize.height);
#ifdef NS_DEBUG
if (nsIFrame::GetVerifyTreeEnable()) {
mRootFrame->VerifyTree();
}
#endif
}
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow"));
}
@ -541,17 +545,20 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
nsRect bounds;
mPresContext->GetVisibleArea(bounds);
nsSize maxSize(bounds.width, bounds.height);
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
nsReflowStatus status;
nsReflowState reflowState(mRootFrame, eReflowReason_Resize, maxSize);
nsIHTMLReflow* htmlReflow;
mRootFrame->Reflow(*mPresContext, desiredSize, reflowState, status);
if (NS_OK == mRootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status);
mRootFrame->SizeTo(desiredSize.width, desiredSize.height);
#ifdef NS_DEBUG
if (nsIFrame::GetVerifyTreeEnable()) {
mRootFrame->VerifyTree();
}
#endif
}
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::ResizeReflow"));
// XXX if debugging then we should assert that the cache is empty
@ -624,7 +631,7 @@ void
PresShell::ProcessReflowCommands()
{
if (0 != mReflowCommands.Count()) {
nsReflowMetrics desiredSize(nsnull);
nsHTMLReflowMetrics desiredSize(nsnull);
while (0 != mReflowCommands.Count()) {
nsIReflowCommand* rc = (nsIReflowCommand*) mReflowCommands.ElementAt(0);

Просмотреть файл

@ -27,6 +27,7 @@
#include "nsBodyFrame.h"
#include "nsHTMLContainerFrame.h"
#include "nsCSSLayout.h"
#include "nsHTMLIIDs.h"
#include "nsBodyFrame.h"
@ -35,7 +36,7 @@ public:
nsScrollBodyFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -90,7 +91,7 @@ nsScrollBodyFrame::CreateFirstChild(nsIPresContext* aPresContext)
NS_IMETHODIMP
nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -121,10 +122,12 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
nsSize maxSize(aReflowState.maxSize.width, NS_UNCONSTRAINEDSIZE);
nsReflowState kidReflowState(next, aReflowState, maxSize);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
// Dispatch the reflow command to our child frame. Allow it to be as high
// as it wants
mFirstChild->WillReflow(aPresContext);
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
// Place and size the child. Make sure the child is at least as
@ -135,7 +138,8 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
} else {
// Do we have any children?
@ -148,7 +152,7 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
if (nsnull != mFirstChild) {
if (aPresContext.IsPaginated()) {
nscoord y = PAGE_SPACING;
nsReflowMetrics kidSize(aDesiredSize.maxElementSize);
nsHTMLReflowMetrics kidSize(aDesiredSize.maxElementSize);
nsSize pageSize(aPresContext.GetPageWidth(),
aPresContext.GetPageHeight());
@ -167,13 +171,15 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
NSToCoordRound(sbWidth);
NS_RELEASE(dx);
nscoord x = extra > 0 ? extra / 2 : 0;
nsIHTMLReflow* htmlReflow;
kidFrame->WillReflow(aPresContext);
if (NS_OK == kidFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
kidFrame->MoveTo(x, y);
status = ReflowChild(kidFrame, &aPresContext, kidSize, kidReflowState);
kidFrame->SetRect(nsRect(x, y, kidSize.width, kidSize.height));
kidFrame->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
y += kidSize.height;
// Leave a slight gap between the pages
@ -204,6 +210,7 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
#endif
kidFrame->SetNextSibling(continuingPage);
}
}
// Get the next page
kidFrame->GetNextSibling(kidFrame);
@ -218,10 +225,12 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
// as it wants to be.
nsSize maxSize(aReflowState.maxSize.width, NS_UNCONSTRAINEDSIZE);
nsReflowState kidReflowState(mFirstChild, aReflowState, maxSize);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
// Get the child's desired size. Our child's desired height is our
// desired size
mFirstChild->WillReflow(aPresContext);
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize, kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
@ -236,7 +245,8 @@ nsScrollBodyFrame::Reflow(nsIPresContext& aPresContext,
// Place and size the child
nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
}
}
else {
@ -298,7 +308,7 @@ public:
nsScrollInnerFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -314,7 +324,7 @@ nsScrollInnerFrame::nsScrollInnerFrame(nsIContent* aContent, nsIFrame* aParent)
NS_IMETHODIMP
nsScrollInnerFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -378,9 +388,12 @@ nsScrollInnerFrame::Reflow(nsIPresContext& aPresContext,
maxSize.height = NS_UNCONSTRAINEDSIZE;
// Reflow the child
nsReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
nsReflowState kidReflowState(mFirstChild, aReflowState, maxSize);
mFirstChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, kidMetrics,
kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
@ -388,7 +401,8 @@ nsScrollInnerFrame::Reflow(nsIPresContext& aPresContext,
// Place and size the child
nsRect rect(0, 0, kidMetrics.width, kidMetrics.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
// Determine our size. Our width is our maxWidth and our height is
// either our child's height or our maxHeight if our maxHeight is
@ -432,7 +446,7 @@ public:
nsScrollOuterFrame(nsIContent* aContent, nsIFrame* aParent);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -450,7 +464,7 @@ nsScrollOuterFrame::nsScrollOuterFrame(nsIContent* aContent, nsIFrame* aParent)
//XXX incremental reflow pass through
NS_IMETHODIMP
nsScrollOuterFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -490,7 +504,10 @@ nsScrollOuterFrame::Reflow(nsIPresContext& aPresContext,
// Reflow the child and get its desired size
nsReflowState kidReflowState(mFirstChild, aReflowState, maxSize);
mFirstChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, aDesiredSize,
kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
@ -499,7 +516,8 @@ nsScrollOuterFrame::Reflow(nsIPresContext& aPresContext,
nsRect rect(borderPadding.left, borderPadding.top,
aDesiredSize.width, aDesiredSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
// The scroll outer frame either shrink wraps around it's single
// child OR uses the style width/height.

Просмотреть файл

@ -44,7 +44,7 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout,
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState);
PRUint8 GetType();
@ -91,7 +91,7 @@ SpacerFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult)
NS_IMETHODIMP
SpacerFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
nsresult rv = NS_FRAME_COMPLETE;

Просмотреть файл

@ -151,7 +151,7 @@ public:
nsIReflowCommand* aReflowCommand);
NS_IMETHOD InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState);
// TextFrame methods
@ -195,13 +195,13 @@ public:
nscoord dx, nscoord dy);
nsInlineReflowStatus ReflowPre(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFont,
PRInt32 aStartingOffset);
nsInlineReflowStatus ReflowNormal(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFontStyle,
const nsStyleText& aTextStyle,
@ -1295,7 +1295,7 @@ TextFrame::GetPosition(nsIPresContext& aCX,
NS_IMETHODIMP
TextFrame::InlineReflow(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState)
{
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
@ -1348,7 +1348,7 @@ TextFrame::InlineReflow(nsLineLayout& aLineLayout,
// "whiteSpace" style property.
nsInlineReflowStatus
TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFont,
const nsStyleText& aTextStyle,
@ -1522,7 +1522,7 @@ TextFrame::ReflowNormal(nsLineLayout& aLineLayout,
nsInlineReflowStatus
TextFrame::ReflowPre(nsLineLayout& aLineLayout,
nsReflowMetrics& aMetrics,
nsHTMLReflowMetrics& aMetrics,
const nsReflowState& aReflowState,
const nsStyleFont& aFont,
PRInt32 aStartingOffset)

Просмотреть файл

@ -113,7 +113,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD VerifyTree() const;
@ -124,7 +124,7 @@ protected:
virtual ~nsHTMLFrameOuterFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
virtual PRIntn GetSkipSides() const;
PRBool *mIsInline;
};
@ -151,7 +151,7 @@ public:
* @see nsIFrame::Reflow
*/
NS_IMETHOD Reflow(nsIPresContext& aCX,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -172,7 +172,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
nsIWebShell* mWebShell;
PRBool mCreatingViewer;
@ -224,7 +224,7 @@ nsHTMLFrameOuterFrame::GetSkipSides() const
void
nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
// <frame> processing does not use this routine, only <iframe>
float p2t = aPresContext->GetPixelsToTwips();
@ -286,7 +286,7 @@ NS_IMETHODIMP nsHTMLFrameOuterFrame::ListTag(FILE* out) const
NS_IMETHODIMP
nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -316,16 +316,20 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext,
nsSize innerSize(aDesiredSize.width - borderWidth - kludge, aDesiredSize.height - borderWidth - kludge);
// Reflow the child and get its desired size
nsReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
nsHTMLReflowMetrics kidMetrics(aDesiredSize.maxElementSize);
nsReflowState kidReflowState(mFirstChild, aReflowState, innerSize);
mFirstChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
aStatus = ReflowChild(mFirstChild, &aPresContext, kidMetrics, kidReflowState);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
// Place and size the child
nsRect rect(borderWidth, borderWidth, innerSize.width, innerSize.height);
mFirstChild->SetRect(rect);
mFirstChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED);
}
// XXX what should the max-element-size of an iframe be? Shouldn't
// iframe's normally shrink wrap around their content when they
@ -688,7 +692,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext,
NS_IMETHODIMP
nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -754,7 +758,7 @@ nsHTMLFrameInnerFrame::Reflow(nsIPresContext& aPresContext,
void
nsHTMLFrameInnerFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
// it must be defined, but not called
NS_ASSERTION(0, "this should never be called");

Просмотреть файл

@ -74,7 +74,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -88,7 +88,7 @@ protected:
virtual ~nsHTMLFramesetBorderFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
PRInt32 mWidth;
PRBool mVertical;
PRBool mVisibility;
@ -113,7 +113,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -122,7 +122,7 @@ protected:
virtual ~nsHTMLFramesetBlankFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
friend class nsHTMLFramesetFrame;
friend class nsHTMLFrameset;
};
@ -362,7 +362,7 @@ nsHTMLFramesetFrame::GetSkipSides() const
void
nsHTMLFramesetFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsHTMLFramesetFrame* framesetParent = GetFramesetParent(this);
if (nsnull == framesetParent) {
@ -671,9 +671,12 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
}
nsReflowState reflowState(aChild, aReflowState, aSize);
aChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
nsReflowMetrics metrics(nsnull);
if (NS_OK == aChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
nsHTMLReflowMetrics metrics(nsnull);
metrics.width = aSize.width;
metrics.height= aSize.height;
nsReflowStatus status;
@ -694,7 +697,8 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
nsRect rect(aOffset.x, aOffset.y, aSize.width, aSize.height);
aChild->SetFrameState(0);
aChild->SetRect(rect);
aChild->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); // XXX do we need this
htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); // XXX do we need this
}
}
@ -817,7 +821,7 @@ nscolor nsHTMLFramesetFrame::GetBorderColor(nsIContent* aContent)
NS_IMETHODIMP
nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -832,7 +836,7 @@ static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID);
NS_IMETHODIMP
nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext,
nsFramesetDrag* aDrag,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -1389,7 +1393,7 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
}
if (change != 0) {
nsReflowMetrics metrics(nsnull);
nsHTMLReflowMetrics metrics(nsnull);
nsSize size;
GetSize(size);
nsReflowState state(this, eReflowReason_Initial, size);
@ -1454,7 +1458,7 @@ printf("nsHTMLFramesetBorderFrame destructor %X \n", this);
void nsHTMLFramesetBorderFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
aDesiredSize.width = aReflowState.maxSize.width;
aDesiredSize.height = aReflowState.maxSize.height;
@ -1475,7 +1479,7 @@ void nsHTMLFramesetBorderFrame::SetColor(nscolor aColor)
NS_IMETHODIMP
nsHTMLFramesetBorderFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -1623,7 +1627,7 @@ nsHTMLFramesetBlankFrame::~nsHTMLFramesetBlankFrame()
void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
aDesiredSize.width = aReflowState.maxSize.width;
aDesiredSize.height = aReflowState.maxSize.height;
@ -1633,7 +1637,7 @@ void nsHTMLFramesetBlankFrame::GetDesiredSize(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsHTMLFramesetBlankFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -23,7 +23,6 @@
#include "nsColor.h"
class nsIContent;
struct nsReflowMetrics;
class nsIFrame;
class nsIPresContext;
class nsIRenderingContext;
@ -118,13 +117,13 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsFramesetDrag* aDrag,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -144,7 +143,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
PRInt32 GetBorderWidth(nsIPresContext* aPresContext);
PRInt32 GetParentBorderWidth() { return mParentBorderWidth; }

Просмотреть файл

@ -272,7 +272,7 @@ nsButtonControlFrame::MouseClicked(nsIPresContext* aPresContext)
NS_METHOD
nsButtonControlFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -298,7 +298,7 @@ nsButtonControlFrame::Reflow(nsIPresContext& aPresContext,
void
nsButtonControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
PRInt32 type;

Просмотреть файл

@ -32,7 +32,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -65,7 +65,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
nsHTMLImageLoader mImageLoader;

Просмотреть файл

@ -60,7 +60,7 @@ protected:
virtual ~nsCheckboxControlFrame();
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
};
@ -102,7 +102,7 @@ nsCheckboxControlFrame::GetCID()
void
nsCheckboxControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
float p2t = aPresContext->GetPixelsToTwips();

Просмотреть файл

@ -184,7 +184,7 @@ void SetType(nsIHTMLContent* aElement, nsString& aValue)
}
NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -219,15 +219,18 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext,
}
nsSize maxSize = aReflowState.maxSize;
nsReflowMetrics desiredSize = aDesiredSize;
nsHTMLReflowMetrics desiredSize = aDesiredSize;
aDesiredSize.width = CONTROL_SPACING;
aDesiredSize.height = 0;
childFrame = mFirstChild;
nsPoint offset(0,0);
while (nsnull != childFrame) { // reflow, place, size the children
nsReflowState reflowState(childFrame, aReflowState, maxSize);
childFrame->WillReflow(aPresContext);
nsresult result = childFrame->Reflow(aPresContext, desiredSize, reflowState, aStatus);
nsIHTMLReflow* htmlReflow;
if (NS_OK == childFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
nsresult result = htmlReflow->Reflow(aPresContext, desiredSize, reflowState, aStatus);
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
nsRect rect(offset.x, offset.y, desiredSize.width, desiredSize.height);
childFrame->SetRect(rect);
@ -237,6 +240,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext,
childFrame->GetNextSibling(childFrame);
offset.x += desiredSize.width + CONTROL_SPACING;
}
}
aDesiredSize.ascent = aDesiredSize.height;
aDesiredSize.descent = 0;

Просмотреть файл

@ -35,7 +35,7 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Reflow(nsIPresContext& aCX,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);

Просмотреть файл

@ -164,7 +164,7 @@ nsFormControlFrame::Paint(nsIPresContext& aPresContext,
void
nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
// get the css size and let the frame use or override it
@ -183,7 +183,7 @@ nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
void
nsFormControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
nsSize ignore;
GetDesiredSize(aPresContext, aReflowState, aDesiredSize, ignore);
@ -209,7 +209,7 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext,
NS_METHOD
nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -118,7 +118,7 @@ public:
* @see nsIFrame::Reflow
*/
NS_IMETHOD Reflow(nsIPresContext& aCX,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -216,11 +216,11 @@ protected:
*/
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
NS_IMETHOD GetFont(nsIPresContext* aPresContext, nsFont& aFont);

Просмотреть файл

@ -115,7 +115,7 @@ nsFormFrame::CanSubmit(nsFormControlFrame& aFrame)
void
nsFormFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize)
nsHTMLReflowMetrics& aDesiredSize)
{
aDesiredSize.width = 0;
aDesiredSize.height = 0;
@ -201,7 +201,7 @@ nsFormFrame::GetEnctype(PRInt32* aEnctype)
NS_IMETHODIMP
nsFormFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -26,7 +26,6 @@ class nsString;
class nsIContent;
class nsIFrame;
class nsIPresContext;
struct nsReflowMetrics;
struct nsReflowState;
class nsFormControlFrame;
class nsRadioControlFrame;
@ -39,7 +38,7 @@ public:
nsFormFrame(nsIContent* aContent, nsIFrame* aParentFrame);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
virtual ~nsFormFrame();
@ -71,7 +70,7 @@ protected:
NS_IMETHOD_(nsrefcnt) Release(void);
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredSize);
nsHTMLReflowMetrics& aDesiredSize);
void RemoveRadioGroups();
void ProcessAsURLEncoded(PRBool aIsPost, nsString& aData);
void ProcessAsMultipart(nsString& aData);

Просмотреть файл

@ -84,7 +84,7 @@ nsRadioControlFrame::GetCID()
void
nsRadioControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
float p2t = aPresContext->GetPixelsToTwips();

Просмотреть файл

@ -53,7 +53,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
PRBool *mInitialChecked;
PRBool mForcedChecked;

Просмотреть файл

@ -95,7 +95,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
PRBool mIsComboBox;
@ -194,7 +194,7 @@ nsSelectControlFrame::GetCID()
void
nsSelectControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
nsIDOMHTMLSelectElement* select = GetSelect();

Просмотреть файл

@ -170,7 +170,7 @@ nsTextControlFrame::EnterPressed(nsIPresContext& aPresContext)
void
nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize)
{
nsCompatibility mode;

Просмотреть файл

@ -59,7 +59,7 @@ protected:
virtual void GetDesiredSize(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowMetrics& aDesiredLayoutSize,
nsHTMLReflowMetrics& aDesiredLayoutSize,
nsSize& aDesiredWidgetSize);
};

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsStyleConsts.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsIFrameReflow.h"
#include "nsIFontMetrics.h"
#include "nsIPresContext.h"
#include "nsRect.h"

Просмотреть файл

@ -248,7 +248,7 @@ PRInt32 nsTableCellFrame::GetColSpan()
/**
*/
NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
@ -322,11 +322,14 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
if (gsDebug==PR_TRUE)
printf(" nsTableCellFrame::Reflow calling ReflowChild with availSize=%d,%d\n",
availSize.width, availSize.height);
nsReflowMetrics kidSize(pMaxElementSize);
nsHTMLReflowMetrics kidSize(pMaxElementSize);
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
SetPriorAvailWidth(aReflowState.maxSize.width);
nsReflowState kidReflowState(mFirstChild, aReflowState, availSize);
mFirstChild->WillReflow(aPresContext);
nsIHTMLReflow* htmlReflow;
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
htmlReflow->WillReflow(aPresContext);
mFirstChild->MoveTo(leftInset, topInset);
aStatus = ReflowChild(mFirstChild, &aPresContext, kidSize, kidReflowState);
#ifdef NS_DEBUG
@ -336,6 +339,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
kidSize.width, availSize.width);
}
#endif
}
if (PR_TRUE==gsDebug || PR_TRUE==gsDebugNT)
{
if (nsnull!=pMaxElementSize)

Просмотреть файл

@ -65,7 +65,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);
@ -107,7 +107,7 @@ public:
virtual nsSize GetDesiredSize();
/** set the desired size returned by this frame during its last reflow */
virtual void SetDesiredSize(const nsReflowMetrics & aDesiredSize);
virtual void SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
/** return the MaxElement size returned by this frame during its last reflow
* not counting reflows where MaxElementSize is not requested.
@ -124,7 +124,7 @@ public:
virtual nsSize GetPass1DesiredSize();
/** set the desired size returned by this frame during its last reflow */
virtual void SetPass1DesiredSize(const nsReflowMetrics & aDesiredSize);
virtual void SetPass1DesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
/** return the MaxElement size returned by this frame during its last reflow
* not counting reflows where MaxElementSize is not requested.
@ -267,7 +267,7 @@ inline void nsTableCellFrame::SetPriorAvailWidth(nscoord aPriorAvailWidth)
inline nsSize nsTableCellFrame::GetDesiredSize()
{ return mDesiredSize; }
inline void nsTableCellFrame::SetDesiredSize(const nsReflowMetrics & aDesiredSize)
inline void nsTableCellFrame::SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize)
{
mDesiredSize.width = aDesiredSize.width;
mDesiredSize.height = aDesiredSize.height;
@ -285,7 +285,7 @@ inline void nsTableCellFrame::SetMaxElementSize(const nsSize & aMaxElementSize)
inline nsSize nsTableCellFrame::GetPass1DesiredSize()
{ return mPass1DesiredSize; }
inline void nsTableCellFrame::SetPass1DesiredSize(const nsReflowMetrics & aDesiredSize)
inline void nsTableCellFrame::SetPass1DesiredSize(const nsHTMLReflowMetrics & aDesiredSize)
{
mPass1DesiredSize.width = aDesiredSize.width;
mPass1DesiredSize.height = aDesiredSize.height;

Просмотреть файл

@ -61,7 +61,7 @@ NS_METHOD nsTableColFrame::Paint(nsIPresContext& aPresContext,
NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{

Просмотреть файл

@ -48,7 +48,7 @@ public:
const nsRect& aDirtyRect);
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsReflowMetrics& aDesiredSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше