Bug 115113. Eliminate nsIReflowCommand, and just use nsHTMLReflowCommand directly. r=karnaze, sr=attinasi.

This commit is contained in:
waterson%netscape.com 2001-12-17 22:39:59 +00:00
parent 65cef5bae6
commit 854831c91c
113 changed files with 1023 additions and 853 deletions

View File

@ -419,13 +419,19 @@ GetIBContainingBlockFor(nsIFrame* aFrame)
nsIFrame* parentFrame;
do {
aFrame->GetParent(&parentFrame);
if (!parentFrame || !IsFrameSpecial(parentFrame))
if (! parentFrame) {
NS_ERROR("no unsplit block frame in IB hierarchy");
return aFrame;
}
if (!IsFrameSpecial(parentFrame))
break;
aFrame = parentFrame;
} while (1);
return aFrame;
return parentFrame;
}
//----------------------------------------------------------------------
@ -8605,6 +8611,17 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsLayoutAtoms::fixedList,
state.mFixedItems.childList);
}
#ifdef DEBUG
if (gReallyNoisyContentUpdates && docElementFrame) {
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(docElementFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentInserted: resulting frame model:\n");
fdbg->List(aPresContext, stdout, 0);
}
}
#endif
}
nsCOMPtr<nsIBindingManager> bm;
@ -9904,9 +9921,9 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsCOMPtr<nsIReflowCommand> reflowCmd;
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), aFrame,
nsIReflowCommand::StyleChanged,
nsHTMLReflowCommand *reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
eReflowType_StyleChanged,
nsnull,
aAttribute);
@ -13461,6 +13478,12 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&) parentDisplay);
if (NS_STYLE_DISPLAY_INLINE == parentDisplay->mDisplay) {
if (!AreAllKidsInline(aFrameList)) {
// XXXwaterson temporary code until we figure out why bug 102931
// is really happening.
NS_ASSERTION(aBlockContent != nsnull, "ack, inline without a containing block");
if (! aBlockContent)
return PR_FALSE;
// Ok, reverse tracks: wipe out the frames we just created
nsCOMPtr<nsIPresShell> presShell;
nsCOMPtr<nsIFrameManager> frameManager;

View File

@ -39,9 +39,10 @@
#include "nsISupports.h"
#include "nsCoord.h"
#include "nsIReflowCommand.h"
#include "nsEvent.h"
#include "nsReflowType.h"
class nsIAtom;
class nsIContent;
class nsIContentIterator;
class nsIDocument;
@ -64,6 +65,7 @@ class nsIArena;
class nsIReflowCallback;
class nsISupportsArray;
class nsIDOMNode;
class nsHTMLReflowCommand;
#define NS_IPRESSHELL_IID \
{ 0x76e79c60, 0x944e, 0x11d1, \
@ -287,8 +289,8 @@ public:
/**
* Reflow commands
*/
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0;
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowType* aCmdType) = 0;
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand) = 0;
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsReflowType* aCmdType) = 0;
NS_IMETHOD CancelAllReflowCommands() = 0;

View File

@ -49,7 +49,7 @@
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsIServiceManager.h"
#include "nsFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIViewManager.h"
#include "nsCRT.h"
#include "prlog.h"
@ -876,15 +876,15 @@ public:
nsIContent** aContent) const;
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame** aPlaceholderFrame) const;
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand);
NS_IMETHOD AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand);
NS_IMETHOD AppendReflowCommandInternal(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType);
NS_IMETHOD CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest = PR_TRUE);
nsReflowType* aCmdType);
NS_IMETHOD CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest = PR_TRUE);
NS_IMETHOD CancelAllReflowCommands();
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush);
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews);
@ -1092,8 +1092,8 @@ protected:
*/
nsresult NotifyReflowObservers(const char *aData);
nsresult ReflowCommandAdded(nsIReflowCommand* aRC);
nsresult ReflowCommandRemoved(nsIReflowCommand* aRC);
nsresult ReflowCommandAdded(nsHTMLReflowCommand* aRC);
nsresult ReflowCommandRemoved(nsHTMLReflowCommand* aRC);
// This method should be called after a reflow commands have been
// removed from the queue, but after the state in the presshell is
@ -1118,8 +1118,8 @@ protected:
nsresult GetReflowEventStatus(PRBool* aPending);
nsresult SetReflowEventStatus(PRBool aPending);
void PostReflowEvent();
PRBool AlreadyInQueue(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
PRBool AlreadyInQueue(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
friend struct ReflowEvent;
// utility to determine if we're in the middle of a drag
@ -3526,8 +3526,8 @@ PresShell::EndReflow(nsIDocument *aDocument, nsIPresShell* aShell)
// frame it targets is targeted by a pre-existing reflow command in
// the queue.
PRBool
PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
PresShell::AlreadyInQueue(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
{
PRInt32 i, n = aQueue.Count();
nsIFrame* targetFrame;
@ -3536,12 +3536,12 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand,
if (NS_SUCCEEDED(aReflowCommand->GetTarget(targetFrame))) {
// Iterate over the reflow commands and compare the targeted frames.
for (i = 0; i < n; i++) {
nsIReflowCommand* rc = (nsIReflowCommand*) aQueue.ElementAt(i);
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*) aQueue.ElementAt(i);
if (rc) {
nsIFrame* targetOfQueuedRC;
if (NS_SUCCEEDED(rc->GetTarget(targetOfQueuedRC))) {
nsIReflowCommand::ReflowType RCType;
nsIReflowCommand::ReflowType queuedRCType;
nsReflowType RCType;
nsReflowType queuedRCType;
aReflowCommand->GetType(RCType);
rc->GetType(queuedRCType);
if (targetFrame == targetOfQueuedRC &&
@ -3564,9 +3564,9 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand,
}
void
NotifyAncestorFramesOfReflowCommand(nsIPresShell* aPresShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded)
NotifyAncestorFramesOfReflowCommand(nsIPresShell* aPresShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded)
{
if (aRC) {
nsIFrame* target;
@ -3583,8 +3583,8 @@ NotifyAncestorFramesOfReflowCommand(nsIPresShell* aPresShell,
}
NS_IMETHODIMP
PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
PresShell::AppendReflowCommandInternal(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
{
// If we've not yet done the initial reflow, then don't bother
// enqueuing a reflow command yet.
@ -3616,11 +3616,14 @@ PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
// who call SendInterruptNotificationTo to make sure there are no duplicates
if ((&aQueue == &mTimeoutReflowCommands) ||
((&aQueue == &mReflowCommands) && !AlreadyInQueue(aReflowCommand, aQueue))) {
NS_ADDREF(aReflowCommand);
rv = (aQueue.AppendElement(aReflowCommand) ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
ReflowCommandAdded(aReflowCommand);
NotifyAncestorFramesOfReflowCommand(this, aReflowCommand, PR_TRUE);
}
else {
// We're not going to process this reflow command.
delete aReflowCommand;
}
// For async reflow during doc load, post a reflow event if we are not batching reflow commands.
// For sync reflow during doc load, post a reflow event if we are not batching reflow commands
@ -3637,7 +3640,7 @@ PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
}
NS_IMETHODIMP
PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand)
PresShell::AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand)
{
return AppendReflowCommandInternal(aReflowCommand, mReflowCommands);
}
@ -3665,14 +3668,14 @@ PresShell :: IsDragInProgress ( ) const
NS_IMETHODIMP
PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest)
PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest)
{
PRInt32 i, n = aQueue.Count();
for (i = 0; i < n; i++) {
nsIReflowCommand* rc = (nsIReflowCommand*) aQueue.ElementAt(i);
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*) aQueue.ElementAt(i);
if (rc) {
nsIFrame* target;
if (NS_SUCCEEDED(rc->GetTarget(target))) {
@ -3680,7 +3683,7 @@ PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFram
if (aCmdType != NULL) {
// If aCmdType is specified, only remove reflow commands
// of that type
nsIReflowCommand::ReflowType type;
nsReflowType type;
if (NS_SUCCEEDED(rc->GetType(type))) {
if (type != *aCmdType)
continue;
@ -3696,7 +3699,7 @@ PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFram
aQueue.RemoveElementAt(i);
ReflowCommandRemoved(rc);
NotifyAncestorFramesOfReflowCommand(this, rc, PR_FALSE);
NS_RELEASE(rc);
delete rc;
n--;
i--;
continue;
@ -3713,8 +3716,8 @@ PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFram
}
NS_IMETHODIMP
PresShell::CancelReflowCommand(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType)
PresShell::CancelReflowCommand(nsIFrame* aTargetFrame,
nsReflowType* aCmdType)
{
return CancelReflowCommandInternal(aTargetFrame, aCmdType, mReflowCommands);
}
@ -3724,21 +3727,21 @@ NS_IMETHODIMP
PresShell::CancelAllReflowCommands()
{
PRInt32 n = mReflowCommands.Count();
nsIReflowCommand* rc;
nsHTMLReflowCommand* rc;
PRInt32 i;
for (i = 0; i < n; i++) {
rc = NS_STATIC_CAST(nsIReflowCommand*, mReflowCommands.ElementAt(0));
rc = NS_STATIC_CAST(nsHTMLReflowCommand*, mReflowCommands.ElementAt(0));
mReflowCommands.RemoveElementAt(0);
ReflowCommandRemoved(rc);
NS_RELEASE(rc);
delete rc;
}
n = mTimeoutReflowCommands.Count();
for (i = 0; i < n; i++) {
rc = NS_STATIC_CAST(nsIReflowCommand*, mTimeoutReflowCommands.ElementAt(0));
rc = NS_STATIC_CAST(nsHTMLReflowCommand*, mTimeoutReflowCommands.ElementAt(0));
mTimeoutReflowCommands.RemoveElementAt(0);
ReflowCommandRemoved(rc);
NS_RELEASE(rc);
delete rc;
}
DoneRemovingReflowCommands();
@ -6043,7 +6046,7 @@ PresShell::ProcessReflowCommand(nsVoidArray& aQueue,
{
// Use RemoveElementAt in case the reflowcommand dispatches a
// new one during its execution.
nsIReflowCommand* rc = (nsIReflowCommand*)aQueue.ElementAt(0);
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*)aQueue.ElementAt(0);
aQueue.RemoveElementAt(0);
// Dispatch the reflow command
@ -6055,7 +6058,7 @@ PresShell::ProcessReflowCommand(nsVoidArray& aQueue,
afterReflow = PR_Now();
ReflowCommandRemoved(rc);
NS_RELEASE(rc);
delete rc;
VERIFY_STYLE_TREE;
if (aAccumulateTime) {
@ -6095,7 +6098,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
PRInt32 i, n = mReflowCommands.Count();
printf("\nPresShell::ProcessReflowCommands: this=%p, count=%d\n", (void*)this, n);
for (i = 0; i < n; i++) {
nsIReflowCommand* rc = (nsIReflowCommand*)
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*)
mReflowCommands.ElementAt(i);
rc->List(stdout);
}
@ -6200,16 +6203,15 @@ PresShell::SendInterruptNotificationTo(nsIFrame* aFrame,
nsIPresShell::InterruptType aInterruptType)
{
// create a reflow command targeted at aFrame
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv;
// Target the reflow comamnd at aFrame
rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::Timeout);
eReflowType_Timeout);
if (NS_SUCCEEDED(rv)) {
// Add the reflow command
AppendReflowCommandInternal(reflowCmd, mTimeoutReflowCommands);
NS_RELEASE(reflowCmd);
}
return rv;
}
@ -6293,7 +6295,7 @@ PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
nsresult
PresShell::ReflowCommandAdded(nsIReflowCommand* aRC)
PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC)
{
if (gAsyncReflowDuringDocLoad) {
@ -6333,7 +6335,7 @@ PresShell::ReflowCommandAdded(nsIReflowCommand* aRC)
}
nsresult
PresShell::ReflowCommandRemoved(nsIReflowCommand* aRC)
PresShell::ReflowCommandRemoved(nsHTMLReflowCommand* aRC)
{
if (gAsyncReflowDuringDocLoad) {
NS_PRECONDITION(mRCCreatedDuringLoad >= 0, "PresShell's reflow command queue is in a bad state.");
@ -7505,7 +7507,6 @@ static void RecurseIndiTotals(nsIPresContext* aPresContext,
//------------------------------------------------------------------
PRIntn ReflowCountMgr::DoSingleIndi(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
IndiReflowCounter * counter = (IndiReflowCounter *)he->value;
if (counter && !counter->mHasBeenOutput) {
char * name = ToNewCString(counter->mName);

View File

@ -29,7 +29,6 @@ nsIPresState.h
nsIPrintContext.h
nsIPrintPreviewContext.h
nsIReflowCallback.h
nsIReflowCommand.h
nsIScrollableFrame.h
nsIScrollableViewProvider.h
nsIStatefulFrame.h
@ -37,5 +36,6 @@ nsIStyleContext.h
nsIStyleFrameConstruction.h
nsIStyleSet.h
nsITextFrame.h
nsReflowType.h
nsStyleChangeList.h
nsStyleConsts.h

View File

@ -58,13 +58,13 @@ nsIPresState.h \
nsIPrintContext.h \
nsIPrintPreviewContext.h \
nsIReflowCallback.h \
nsIReflowCommand.h \
nsIScrollableFrame.h \
nsIScrollableViewProvider.h \
nsIStatefulFrame.h \
nsIStyleContext.h \
nsIStyleFrameConstruction.h \
nsIStyleSet.h \
nsReflowType.h \
nsStyleChangeList.h \
nsStyleConsts.h \
$(NULL)

View File

@ -53,13 +53,13 @@ EXPORTS = \
nsIPrintContext.h \
nsIPrintPreviewContext.h \
nsIReflowCallback.h \
nsIReflowCommand.h \
nsIScrollableFrame.h \
nsIScrollableViewProvider.h \
nsIStatefulFrame.h \
nsIStyleContext.h \
nsIStyleFrameConstruction.h \
nsIStyleSet.h \
nsReflowType.h \
nsStyleChangeList.h \
nsStyleConsts.h \
!ifdef IBMBIDI

View File

@ -42,7 +42,7 @@
class nsIFrame;
class nsIPresContext;
class nsIReflowCommand;
class nsHTMLReflowCommand;
class nsIRenderingContext;
class nsSpaceManager;
class nsLineLayout;
@ -140,7 +140,7 @@ struct nsHTMLReflowState {
nsReflowReason reason;
// the reflow command. only set for a reflow reason of eReflowReason_Incremental
nsIReflowCommand* reflowCommand;
nsHTMLReflowCommand* reflowCommand;
// the available space in which to reflow the frame. The space represents the
// amount of room for the frame's border, padding, and content area (not the
@ -264,7 +264,7 @@ struct nsHTMLReflowState {
// reflow.
nsHTMLReflowState(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
nsHTMLReflowCommand& aReflowCommand,
nsIRenderingContext* aRenderingContext,
const nsSize& aAvailableSpace);

View File

@ -68,7 +68,7 @@
*/
struct nsHTMLReflowState;
class nsIReflowCommand;
class nsHTMLReflowCommand;
struct nsHTMLReflowMetrics;
class nsIAtom;
@ -1059,7 +1059,7 @@ public:
/**
* Called by a child frame on a parent frame to tell the parent frame that the child needs
* to be reflowed. The parent should either propagate the request to its parent frame or
* handle the request by generating a nsIReflowCommand::ReflowDirtyChildren reflow command.
* handle the request by generating a eReflowType_ReflowDirtyChildren reflow command.
*/
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) = 0;
@ -1079,9 +1079,9 @@ public:
* Called during appending or cancelling a reflow command to give frames notice
* of reflow commands that will be targeted below them.
*/
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded) = 0;
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded) = 0;
/**
* Called in style ReResolution to get the frame that contains the style context that is the

View File

@ -39,9 +39,10 @@
#include "nsISupports.h"
#include "nsCoord.h"
#include "nsIReflowCommand.h"
#include "nsEvent.h"
#include "nsReflowType.h"
class nsIAtom;
class nsIContent;
class nsIContentIterator;
class nsIDocument;
@ -64,6 +65,7 @@ class nsIArena;
class nsIReflowCallback;
class nsISupportsArray;
class nsIDOMNode;
class nsHTMLReflowCommand;
#define NS_IPRESSHELL_IID \
{ 0x76e79c60, 0x944e, 0x11d1, \
@ -287,8 +289,8 @@ public:
/**
* Reflow commands
*/
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand) = 0;
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsIReflowCommand::ReflowType* aCmdType) = 0;
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand) = 0;
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame, nsReflowType* aCmdType) = 0;
NS_IMETHOD CancelAllReflowCommands() = 0;

View File

@ -1,183 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsIReflowCommand_h___
#define nsIReflowCommand_h___
#include "nsISupports.h"
#include <stdio.h>
class nsIAtom;
class nsIFrame;
class nsIPresContext;
class nsIRenderingContext;
struct nsHTMLReflowMetrics;
struct nsSize;
// IID for the nsIReflowCommand interface {C3658E40-FF20-11d1-85BC-00A02468FAB6}
#define NS_IREFLOWCOMMAND_IID \
{ 0xc3658e40, 0xff20, 0x11d1, \
{0x85, 0xbc, 0x0, 0xa0, 0x24, 0x68, 0xfa, 0xb6}}
// Reflow command flags
#define NS_RC_CREATED_DURING_DOCUMENT_LOAD 0x0001
/**
* A reflow command is an object that is generated in response to a content
* model change notification. The reflow command is given to a presentation
* shell where it is queued and then dispatched by invoking the reflow
* commands's Dispatch() member function.
*
* Reflow command processing follows a path from the root frame down to the
* target frame (the frame for which the reflow command is destined). Reflow
* commands are processed by invoking the frame's Reflow() member function.
*
* The typical flow of control for a given reflow command starts with a content
* change notification. The content notifications are sent to document observers.
* The presentation shell forwards the notifications to the style set. The style
* system responds to the notifications by creating new frame (or destroying
* existing frames) as appropriate, and then generating a reflow command.
*
* @see nsIDocumentObserver
* @see nsIStyleSet
* @see nsIFrameReflow#Reflow()
* @see nsIPresShell#AppendReflowCommand()
* @see nsIPresShell#ProcessReflowCommands()
*/
class nsIReflowCommand : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IREFLOWCOMMAND_IID; return iid; }
enum ReflowType {
// This reflow command is used when a leaf node's content changes
// (e.g. some text in a text run, an image's source, etc.). The
// target of the reflow command is the frame that changed (see
// nsIFrame#ContentChanged() for how the target frame is
// determined).
ContentChanged,
// This reflow command is used when the style for a frame has
// changed. This also implies that if the frame is a container
// that its childrens style has also changed. The target of the
// reflow command is the frame that changed style.
StyleChanged,
// Reflow dirty stuff (really a per-frame extension)
ReflowDirty,
// The pres shell ran out of time but will guaranteed the reflow command gets processed.
Timeout,
// Trap door for extensions.
UserDefined
};
/**
* Dispatch the reflow command.
*
* Builds a path from the target frame back to the root frame, and then
* invokes the root frame's Reflow() member function.
*
* @see nsIFrame#Reflow()
*/
NS_IMETHOD Dispatch(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize,
nsIRenderingContext& aRendContext) = 0;
/**
* Get the next frame in the command processing path. If requested removes the
* the frame from the path. You must remove the frame from the path before
* dispatching the reflow command to the next frame in the chain.
*/
NS_IMETHOD GetNext(nsIFrame*& aNextFrame, PRBool aRemove = PR_TRUE) = 0;
/**
* Get the target of the reflow command.
*/
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const = 0;
/**
* Change the target of the reflow command.
*/
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame) = 0;
/**
* Get the type of reflow command.
*/
NS_IMETHOD GetType(ReflowType& aReflowType) const = 0;
/**
* Get the child frame associated with the reflow command.
*/
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const = 0;
/**
* Returns the name of the child list to which the child frame belongs.
* Only used for reflow command types FrameAppended, FrameInserted, and
* FrameRemoved
*
* Returns nsnull if the child frame is associated with the unnamed
* principal child list
*/
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const = 0;
/**
* Sets the name of the child list to which the child frame belongs.
* Only used for reflow command types FrameAppended, FrameInserted, and
* FrameRemoved
*/
NS_IMETHOD SetChildListName(nsIAtom* aListName) = 0;
/**
* Get the previous sibling frame associated with the reflow command.
* This is used for FrameInserted reflow commands.
*/
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const = 0;
/**
* Dump out the reflow-command to out
*/
NS_IMETHOD List(FILE* out) const = 0;
/**
* Get/set reflow command flags
*/
NS_IMETHOD GetFlags(PRInt32* aFlags) = 0;
NS_IMETHOD SetFlags(PRInt32 aFlags) = 0;
};
#endif /* nsIReflowCommand_h___ */

View File

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsReflowType_h__
#define nsReflowType_h__
enum nsReflowType {
/**
* This reflow command is used when a leaf node's content changes
* (e.g. some text in a text run, an image's source, etc.). The
* target of the reflow command is the frame that changed (see
* nsIFrame#ContentChanged() for how the target frame is
* determined).
*/
eReflowType_ContentChanged,
/**
* This reflow command is used when the style for a frame has
* changed. This also implies that if the frame is a container
* that its childrens style has also changed. The target of the
* reflow command is the frame that changed style.
*/
eReflowType_StyleChanged,
/**
* Reflow dirty stuff (really a per-frame extension)
*/
eReflowType_ReflowDirty,
/**
* The pres shell ran out of time but will guaranteed the reflow
* command gets processed.
*/
eReflowType_Timeout,
/**
* Trap door for extensions.
*/
eReflowType_UserDefined
};
#endif // nsReflowType_h__

View File

@ -221,7 +221,7 @@ following items are also included:
has changed size) and 'eReflowReason_Incremental' (processing of an incremental
reflow command).</Body>
<Body>Reflow commands (see nsIReflowCommand in mozilla/layout/base/public) are used
<Body>Reflow commands (see nsHTMLReflowCommand in mozilla/layout/html/base/src) are used
to kick off an incremental reflow. They're generated either by the style system
(in response to a style change) or by a frame itself (for example, if a frame has
dirty child frames that need to be reflowed it will generate a reflow command).</Body>

View File

@ -293,7 +293,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsReflowReason reason = aReflowState.reason;
if ( aReflowState.reason == eReflowReason_Incremental ) {
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
// See if it's targeted at us
@ -303,7 +303,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
if (this == targetFrame) {
switch (reflowType) {
case nsIReflowCommand::StyleChanged:
case eReflowType_StyleChanged:
{
nsHTMLReflowState newState(aReflowState);
newState.reason = eReflowReason_StyleChange;
@ -312,7 +312,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
break;
// if its a dirty type then reflow us with a dirty reflow
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
{
nsHTMLReflowState newState(aReflowState);
newState.reason = eReflowReason_Dirty;

View File

@ -319,9 +319,9 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
if (this == targetFrame) {
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
if (nsIReflowCommand::StyleChanged == reflowType) {
if (eReflowType_StyleChanged == reflowType) {
reflowState.reason = eReflowReason_StyleChange;
}
else {

View File

@ -598,9 +598,9 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
if (this == targetFrame) {
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
if (nsIReflowCommand::StyleChanged == reflowType) {
if (eReflowType_StyleChanged == reflowType) {
reflowState.reason = eReflowReason_StyleChange;
}
else {

View File

@ -58,7 +58,7 @@
#include "nsIScrollableView.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsWidgetsCID.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIDOMEventReceiver.h"
@ -784,7 +784,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame* targetFrame;
firstPassState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
firstPassState.reason = eReflowReason_StyleChange;
firstPassState.reflowCommand = nsnull;
@ -798,7 +798,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
NS_ASSERTION(aDesiredSize.height < 100000, "Height is still NS_UNCONSTRAINEDSIZE");
return res;
}
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
firstPassState.reason = eReflowReason_StyleChange;
firstPassState.reflowCommand = nsnull;

View File

@ -38,11 +38,10 @@
#include "nsAbsoluteContainingBlock.h"
#include "nsContainerFrame.h"
#include "nsHTMLIIDs.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsIViewManager.h"
#include "nsLayoutAtoms.h"
#include "nsIReflowCommand.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
@ -88,12 +87,11 @@ nsAbsoluteContainingBlock::AppendFrames(nsIFrame* aDelegatingFrame,
mAbsoluteFrames.AppendFrames(nsnull, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return rv;
@ -116,12 +114,11 @@ nsAbsoluteContainingBlock::InsertFrames(nsIFrame* aDelegatingFrame,
mAbsoluteFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return rv;
@ -306,14 +303,14 @@ nsAbsoluteContainingBlock::IncrementalReflow(nsIFrame* aDelegatin
NS_IF_RELEASE(listName);
if (isAbsoluteChild) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
// Get the type of reflow command
aReflowState.reflowCommand->GetType(type);
// The only type of reflow command we expect is that we have dirty
// child frames to reflow
NS_ASSERTION(nsIReflowCommand::ReflowDirty, "unexpected reflow type");
NS_ASSERTION(eReflowType_ReflowDirty, "unexpected reflow type");
// Walk the positioned frames and reflow the dirty frames
for (nsIFrame* f = mAbsoluteFrames.FirstChild(); f; f->GetNextSibling(&f)) {

View File

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAreaFrame.h"
#include "nsBlockBandData.h"
#include "nsIReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"

View File

@ -54,7 +54,7 @@
#include "nsIFrameManager.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsIView.h"
#include "nsIFontMetrics.h"
@ -84,6 +84,7 @@
#include "nsIDOMHTMLHtmlElement.h"
#ifdef DEBUG
#include "nsPrintfCString.h"
#include "nsBlockDebugFlags.h"
@ -182,10 +183,11 @@ nsBlockFrame::InitDebugFlags()
// Debugging support code
#ifdef DEBUG
static const char* kReflowCommandType[] = {
const char* nsBlockFrame::kReflowCommandType[] = {
"ContentChanged",
"StyleChanged",
"ReflowDirty",
"Timeout",
"UserDefined",
};
#endif
@ -600,10 +602,27 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
#ifdef DEBUG
if (gNoisyReflow) {
nsCAutoString reflow;
reflow.Append(nsHTMLReflowState::ReasonToString(aReflowState.reason));
if (aReflowState.reason == eReflowReason_Incremental) {
reflow += " (";
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
reflow += kReflowCommandType[type];
nsIFrame* target;
aReflowState.reflowCommand->GetTarget(target);
reflow += nsPrintfCString("@%p", target);
reflow += ")";
}
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": begin %s reflow availSize=%d,%d computedSize=%d,%d\n",
nsHTMLReflowState::ReasonToString(aReflowState.reason),
reflow.get(),
aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
}
@ -759,24 +778,26 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
mState &= ~NS_FRAME_FIRST_REFLOW;
break;
case eReflowReason_Dirty:
case eReflowReason_Dirty:
// Do nothing; the dirty lines will already have been marked.
break;
case eReflowReason_Incremental: // should call GetNext() ?
aReflowState.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
#ifdef NOISY_REFLOW_REASON
ListTag(stdout);
printf(": reflow=incremental type=%d\n", type);
#endif
switch (type) {
case nsIReflowCommand::StyleChanged:
case eReflowType_StyleChanged:
rv = PrepareStyleChangedReflow(state);
isStyleChange = PR_TRUE;
break;
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
// Do nothing; the dirty lines will already have been marked.
break;
default:
// Map any other incremental operations into full reflows
@ -2032,7 +2053,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
#ifdef DEBUG
if (gNoisyReflow) {
if (aState.mReflowState.reason == eReflowReason_Incremental) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aState.mReflowState.reflowCommand->GetType(type);
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
@ -2837,15 +2858,13 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged,
eReflowType_ContentChanged,
nsnull,
aAttribute);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
else if (nsHTMLAtoms::value == aAttribute) {
const nsStyleDisplay* styleDisplay;
@ -2875,15 +2894,13 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, blockParent,
nsIReflowCommand::ContentChanged,
eReflowType_ContentChanged,
nsnull,
aAttribute);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
}
}
@ -5822,13 +5839,12 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
// although we should. We can't use the NS_FRAME_HAS_DIRTY_CHILDREN
// flag, because that's used to indicate whether in-flow children are
// dirty...
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ReflowDirty);
eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
aPresShell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
#ifdef DEBUG
@ -5870,7 +5886,7 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
nsFrame::CreateAndPostReflowCommand(aPresShell, this,
nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull);
eReflowType_ReflowDirty, nsnull, nsnull, nsnull);
#ifdef DEBUG
if (gNoisyReflow) {
@ -5885,7 +5901,7 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
mState |= NS_FRAME_IS_DIRTY;
// Cancel the dirty children reflow command you posted earlier
nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty;
nsReflowType type = eReflowType_ReflowDirty;
aPresShell->CancelReflowCommand(this, &type);
#ifdef DEBUG

View File

@ -519,6 +519,8 @@ public:
static PRInt32 gNoiseIndent;
static const char* kReflowCommandType[];
protected:
static void InitDebugFlags();
#endif

View File

@ -44,7 +44,7 @@
#include "nsIPresContext.h"
#include "nsIContent.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLContainerFrame.h"
#include "nsBlockFrame.h"
#include "nsIDOMHTMLTableCellElement.h"
@ -282,18 +282,18 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
// and it's target is the current block, then make sure we send
// StyleChange reflow reasons down to all the children so that
// they don't over-optimize their reflow.
nsIReflowCommand* rc = mOuterReflowState.reflowCommand;
nsHTMLReflowCommand* rc = mOuterReflowState.reflowCommand;
if (rc) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
rc->GetType(type);
if (type == nsIReflowCommand::StyleChanged) {
if (type == eReflowType_StyleChanged) {
nsIFrame* target;
rc->GetTarget(target);
if (target == mOuterReflowState.frame) {
reason = eReflowReason_StyleChange;
}
}
else if (type == nsIReflowCommand::ReflowDirty &&
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY)) {
reason = eReflowReason_Dirty;
}

View File

@ -136,6 +136,10 @@ protected:
nsIFrame* mFrame;
nsRect mSpace;
// For an incremental reflow that has not yet reached the target
// frame, this field contains the next frame along the reflow's
// path.
nsIFrame* mNextRCFrame;
// Spacing style for the frame we are reflowing; only valid after reflow

View File

@ -46,7 +46,7 @@
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsILoadGroup.h"
#include "nsIURL.h"
@ -1335,11 +1335,11 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame", aReflowState.reason);
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
if (eReflowReason_Incremental == aReflowState.reason) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
/* if the style changed, see if we need to load a new url */
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
nsCOMPtr<nsIURI> baseURI;
GetBaseURI(getter_AddRefs(baseURI));

View File

@ -48,7 +48,7 @@
#include "nsIScrollableView.h"
#include "nsVoidArray.h"
#include "nsISizeOfHandler.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLIIDs.h"
#include "nsHTMLContainerFrame.h"
#include "nsIFrameManager.h"
@ -353,7 +353,7 @@ nsContainerFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
nsFrame::CreateAndPostReflowCommand(aPresShell, aChild,
nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull);
eReflowType_ReflowDirty, nsnull, nsnull, nsnull);
return NS_OK;
}

View File

@ -38,7 +38,6 @@
#include "nsHTMLContainerFrame.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIContent.h"
#include "nsLineLayout.h"
#include "nsHTMLAtoms.h"

View File

@ -1850,13 +1850,11 @@ nsFrame::ContentChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged);
if (NS_SUCCEEDED(rv)) {
eReflowType_ContentChanged);
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
return rv;
}
@ -3859,9 +3857,9 @@ nsFrame::GetAccessible(nsIAccessible** aAccessible)
#endif
NS_IMETHODIMP
nsFrame::ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded)
nsFrame::ReflowCommandNotify(nsIPresShell* aShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded)
{
return NS_OK;
@ -3972,12 +3970,12 @@ nsFrame::GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame)
}
}
nsresult nsFrame::CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName)
nsresult nsFrame::CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName)
{
nsresult rv;
@ -3985,8 +3983,8 @@ nsresult nsFrame::CreateAndPostReflowCommand(nsIPresShell* aPresS
rv = NS_ERROR_NULL_POINTER;
}
else {
nsCOMPtr<nsIReflowCommand> reflowCmd;
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), aTargetFrame,
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aTargetFrame,
aReflowType, aChildFrame,
aAttribute);
if (NS_SUCCEEDED(rv)) {

View File

@ -47,7 +47,7 @@
#endif
#include "nsIPresShell.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIFrameSelection.h"
#include "nsHTMLReflowState.h"
#include "nsHTMLReflowMetrics.h"
@ -273,9 +273,9 @@ public:
nsPeekOffsetStruct *aPos);
NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aPresShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded);
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aPresShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded);
#ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
@ -368,12 +368,12 @@ public:
nsIFrame *aFrame,
nsIView **aView);
static nsresult CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName);
static nsresult CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName);
//Mouse Capturing code used by the frames to tell the view to capture all the following events
NS_IMETHOD CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);

View File

@ -37,7 +37,7 @@
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIDeviceContext.h"
#include "nsPageFrame.h"
#include "nsViewsCID.h"
@ -1371,7 +1371,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
// force a reflow of the fixed children
nsFrame::CreateAndPostReflowCommand(presShell, parentFrame,
nsIReflowCommand::UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
eReflowType_UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
}
}
}

View File

@ -56,7 +56,6 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsViewsCID.h"
#include "nsIReflowCommand.h"
#include "nsHTMLIIDs.h"
#include "nsIDOMEvent.h"
#include "nsIScrollableView.h"

View File

@ -39,7 +39,7 @@
#include "nsHTMLContainerFrame.h"
#include "nsCSSRendering.h"
#include "nsIDocument.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsViewsCID.h"
@ -310,11 +310,10 @@ CanvasFrame::AppendFrames(nsIPresContext* aPresContext,
mFrames.AppendFrame(nsnull, aFrameList);
// Generate a reflow command to reflow the newly inserted frame
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
@ -366,11 +365,10 @@ CanvasFrame::RemoveFrame(nsIPresContext* aPresContext,
mFrames.DestroyFrame(aPresContext, aOldFrame);
// Generate a reflow command so we get reflowed
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
} else {
@ -417,7 +415,6 @@ CanvasFrame::Paint(nsIPresContext* aPresContext,
#endif
if (mDoPaintFocus) {
PRBool clipEmpty;
nsRect focusRect;
GetRect(focusRect);
/////////////////////
@ -506,15 +503,15 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
aReflowState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) {
// Get the reflow type
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
switch (reflowType) {
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
isDirtyChildReflow = PR_TRUE;
break;
case nsIReflowCommand::StyleChanged:
case eReflowType_StyleChanged:
// Remember it's a style change so we can set the reflow reason below
isStyleChange = PR_TRUE;
break;

View File

@ -39,13 +39,15 @@
#include "nscore.h"
#include "nsISupports.h"
#include "nsIReflowCommand.h"
#include "nsReflowType.h"
class nsHTMLReflowCommand;
class nsIArena;
class nsIAtom;
class nsINodeInfo;
class nsIContent;
class nsIContentIterator;
class nsIDocument;
class nsIFrame;
class nsIHTMLContent;
class nsIHTMLContentSink;
class nsIHTMLFragmentContentSink;
@ -213,10 +215,10 @@ extern nsresult NS_NewHTMLFragmentContentSink(nsIHTMLFragmentContentSink** aInst
/** Create a new HTML reflow command */
extern nsresult
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
NS_NewHTMLReflowCommand(nsHTMLReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
#endif /* nsHTMLParts_h___ */

View File

@ -49,11 +49,11 @@
nsresult
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
NS_NewHTMLReflowCommand(nsHTMLReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
{
NS_ASSERTION(aInstancePtrResult,
"null result passed to NS_NewHTMLReflowCommand");
@ -64,8 +64,6 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
@ -107,20 +105,20 @@ mPathStats gmPathStats;
// Construct a reflow command given a target frame, reflow command type,
// and optional child frame
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
: mType(aReflowType), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame),
mPrevSiblingFrame(nsnull),
mAttribute(aAttribute),
mListName(nsnull),
mFlags(0)
{
MOZ_COUNT_CTOR(nsHTMLReflowCommand);
NS_PRECONDITION(mTargetFrame != nsnull, "null target frame");
if (nsnull!=mAttribute)
NS_ADDREF(mAttribute);
NS_INIT_REFCNT();
#ifdef DEBUG_jesup
gReflows++;
gReflowsInUse++;
@ -131,6 +129,7 @@ nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
nsHTMLReflowCommand::~nsHTMLReflowCommand()
{
MOZ_COUNT_DTOR(nsHTMLReflowCommand);
#ifdef DEBUG_jesup
if (mPath.GetArraySize() == 0)
gReflowsMaxZero++;
@ -145,8 +144,6 @@ nsHTMLReflowCommand::~nsHTMLReflowCommand()
NS_IF_RELEASE(mListName);
}
NS_IMPL_ISUPPORTS1(nsHTMLReflowCommand, nsIReflowCommand)
nsIFrame* nsHTMLReflowCommand::GetContainingBlock(nsIFrame* aFloater) const
{
nsIFrame* containingBlock;
@ -255,7 +252,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::SetTarget(nsIFrame* aTargetFrame)
return NS_OK;
}
NS_IMETHODIMP nsHTMLReflowCommand::GetType(ReflowType& aReflowType) const
NS_IMETHODIMP nsHTMLReflowCommand::GetType(nsReflowType& aReflowType) const
{
aReflowType = mType;
return NS_OK;
@ -374,3 +371,4 @@ nsHTMLReflowCommand::SetFlags(PRInt32 aFlags)
mFlags = aFlags;
return NS_OK;
}

View File

@ -36,60 +36,141 @@
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLReflowCommand_h___
#define nsHTMLReflowCommand_h___
#include "nsIReflowCommand.h"
#include "nsReflowType.h"
#include "nsVoidArray.h"
class nsIAtom;
class nsIAtom;
class nsIFrame;
class nsIPresContext;
class nsIRenderingContext;
struct nsHTMLReflowMetrics;
struct nsSize;
// Reflow command flags
#define NS_RC_CREATED_DURING_DOCUMENT_LOAD 0x0001
/**
* An HTML reflow command
* A reflow command is an object that is generated in response to a content
* model change notification. The reflow command is given to a presentation
* shell where it is queued and then dispatched by invoking the reflow
* commands's Dispatch() member function.
*
* Reflow command processing follows a path from the root frame down to the
* target frame (the frame for which the reflow command is destined). Reflow
* commands are processed by invoking the frame's Reflow() member function.
*
* The typical flow of control for a given reflow command starts with a content
* change notification. The content notifications are sent to document observers.
* The presentation shell forwards the notifications to the style set. The style
* system responds to the notifications by creating new frame (or destroying
* existing frames) as appropriate, and then generating a reflow command.
*
* @see nsIDocumentObserver
* @see nsIStyleSet
* @see nsIFrameReflow#Reflow()
* @see nsIPresShell#AppendReflowCommand()
* @see nsIPresShell#ProcessReflowCommands()
*/
class nsHTMLReflowCommand : public nsIReflowCommand {
class nsHTMLReflowCommand {
public:
/**
* Construct an HTML reflow command of type aReflowType and with target
* frame aTargetFrame. You can also specify an optional child frame, e.g.
* to indicate the inserted child frame
*/
nsHTMLReflowCommand(nsIFrame* aTargetFrame,
ReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
nsHTMLReflowCommand(nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
virtual ~nsHTMLReflowCommand();
~nsHTMLReflowCommand();
// nsISupports
NS_DECL_ISUPPORTS
/**
* Dispatch the reflow command.
*
* Builds a path from the target frame back to the root frame, and then
* invokes the root frame's Reflow() member function.
*
* @see nsIFrame#Reflow()
*/
nsresult Dispatch(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize,
nsIRenderingContext& aRendContext);
// nsIReflowCommand
NS_IMETHOD Dispatch(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize,
nsIRenderingContext& aRendContext);
NS_IMETHOD GetNext(nsIFrame*& aNextFrame, PRBool aRemove);
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const;
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame);
NS_IMETHOD GetType(ReflowType& aReflowType) const;
/**
* Get the next frame in the command processing path. If requested removes the
* the frame from the path. You must remove the frame from the path before
* dispatching the reflow command to the next frame in the chain.
*/
nsresult GetNext(nsIFrame*& aNextFrame, PRBool aRemove = PR_TRUE);
/** can return nsnull. If nsnull is not returned, the caller must NS_RELEASE aAttribute */
NS_IMETHOD GetAttribute(nsIAtom *& aAttribute) const;
/**
* Get the target of the reflow command.
*/
nsresult GetTarget(nsIFrame*& aTargetFrame) const;
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const;
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const;
NS_IMETHOD SetChildListName(nsIAtom* aListName);
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
NS_IMETHOD List(FILE* out) const;
/**
* Change the target of the reflow command.
*/
nsresult SetTarget(nsIFrame* aTargetFrame);
NS_IMETHOD GetFlags(PRInt32* aFlags);
NS_IMETHOD SetFlags(PRInt32 aFlags);
/**
* Get the type of reflow command.
*/
nsresult GetType(nsReflowType& aReflowType) const;
/**
* Can return nsnull. If nsnull is not returned, the caller must NS_RELEASE aAttribute
*/
nsresult GetAttribute(nsIAtom *& aAttribute) const;
/**
* Get the child frame associated with the reflow command.
*/
nsresult GetChildFrame(nsIFrame*& aChildFrame) const;
/**
* Returns the name of the child list to which the child frame belongs.
* Only used for reflow command types FrameAppended, FrameInserted, and
* FrameRemoved
*
* Returns nsnull if the child frame is associated with the unnamed
* principal child list
*/
nsresult GetChildListName(nsIAtom*& aListName) const;
/**
* Sets the name of the child list to which the child frame belongs.
* Only used for reflow command types FrameAppended, FrameInserted, and
* FrameRemoved
*/
nsresult SetChildListName(nsIAtom* aListName);
/**
* Get the previous sibling frame associated with the reflow command.
* This is used for FrameInserted reflow commands.
*/
nsresult GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
/**
* Dump out the reflow-command to out
*/
nsresult List(FILE* out) const;
/**
* Get/set reflow command flags
*/
nsresult GetFlags(PRInt32* aFlags);
nsresult SetFlags(PRInt32 aFlags);
protected:
void BuildPath();
nsIFrame* GetContainingBlock(nsIFrame* aFloater) const;
private:
ReflowType mType;
nsReflowType mType;
nsIFrame* mTargetFrame;
nsIFrame* mChildFrame;
nsIFrame* mPrevSiblingFrame;

View File

@ -108,7 +108,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
// reflow.
nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
nsHTMLReflowCommand& aReflowCommand,
nsIRenderingContext* aRenderingContext,
const nsSize& aAvailableSpace)
: mReflowDepth(0)

View File

@ -42,7 +42,7 @@
class nsIFrame;
class nsIPresContext;
class nsIReflowCommand;
class nsHTMLReflowCommand;
class nsIRenderingContext;
class nsSpaceManager;
class nsLineLayout;
@ -140,7 +140,7 @@ struct nsHTMLReflowState {
nsReflowReason reason;
// the reflow command. only set for a reflow reason of eReflowReason_Incremental
nsIReflowCommand* reflowCommand;
nsHTMLReflowCommand* reflowCommand;
// the available space in which to reflow the frame. The space represents the
// amount of room for the frame's border, padding, and content area (not the
@ -264,7 +264,7 @@ struct nsHTMLReflowState {
// reflow.
nsHTMLReflowState(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
nsHTMLReflowCommand& aReflowCommand,
nsIRenderingContext* aRenderingContext,
const nsSize& aAvailableSpace);

View File

@ -68,7 +68,7 @@
*/
struct nsHTMLReflowState;
class nsIReflowCommand;
class nsHTMLReflowCommand;
struct nsHTMLReflowMetrics;
class nsIAtom;
@ -1059,7 +1059,7 @@ public:
/**
* Called by a child frame on a parent frame to tell the parent frame that the child needs
* to be reflowed. The parent should either propagate the request to its parent frame or
* handle the request by generating a nsIReflowCommand::ReflowDirtyChildren reflow command.
* handle the request by generating a eReflowType_ReflowDirtyChildren reflow command.
*/
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild) = 0;
@ -1079,9 +1079,9 @@ public:
* Called during appending or cancelling a reflow command to give frames notice
* of reflow commands that will be targeted below them.
*/
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded) = 0;
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded) = 0;
/**
* Called in style ReResolution to get the frame that contains the style context that is the

View File

@ -142,10 +142,10 @@ nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
{
/*
// Generate a reflow command with this frame as the target frame
nsIReflowCommand* cmd;
nsHTMLReflowCommand* cmd;
nsresult rv;
rv = NS_NewHTMLReflowCommand(&cmd, this, nsIReflowCommand::ContentChanged);
rv = NS_NewHTMLReflowCommand(&cmd, this, eReflowType_ContentChanged);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext->GetShell(getter_AddRefs(shell));

View File

@ -495,7 +495,7 @@ nsLineBox::GetCombinedArea(nsRect* aResult)
if (aResult) {
*aResult = mData ? mData->mCombinedArea : mBounds;
#ifdef VERY_NOISY_REFLOW
printf("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n",
printf("nsLineBox::GetCombinedArea(1) %p (%d,%d,%d,%d)\n",
this, aResult->x, aResult->y, aResult->width, aResult->height);
#endif
}

View File

@ -52,7 +52,7 @@
#include "nsIRenderingContext.h"
#include "nsLayoutAtoms.h"
#include "nsPlaceholderFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIDocument.h"
#include "nsIHTMLDocument.h"
#include "nsIContent.h"
@ -942,11 +942,11 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// it's target is the current span, then make sure we send
// StyleChange reflow reasons down to the children so that they
// don't over-optimize their reflow.
nsIReflowCommand* rc = rs->reflowCommand;
nsHTMLReflowCommand* rc = rs->reflowCommand;
if (rc) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
rc->GetType(type);
if (type == nsIReflowCommand::StyleChanged) {
if (type == eReflowType_StyleChanged) {
nsIFrame* parentFrame = psd->mFrame
? psd->mFrame->mFrame
: mBlockReflowState->frame;
@ -956,7 +956,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
reason = eReflowReason_StyleChange;
}
}
else if (type == nsIReflowCommand::ReflowDirty &&
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY)) {
reason = eReflowReason_Dirty;
}

View File

@ -1462,13 +1462,11 @@ nsObjectFrame::ContentChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged);
if (NS_SUCCEEDED(rv)) {
eReflowType_ContentChanged);
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
return rv;
}

View File

@ -39,7 +39,6 @@
#include "nsIContent.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"

View File

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsReflowType_h__
#define nsReflowType_h__
enum nsReflowType {
/**
* This reflow command is used when a leaf node's content changes
* (e.g. some text in a text run, an image's source, etc.). The
* target of the reflow command is the frame that changed (see
* nsIFrame#ContentChanged() for how the target frame is
* determined).
*/
eReflowType_ContentChanged,
/**
* This reflow command is used when the style for a frame has
* changed. This also implies that if the frame is a container
* that its childrens style has also changed. The target of the
* reflow command is the frame that changed style.
*/
eReflowType_StyleChanged,
/**
* Reflow dirty stuff (really a per-frame extension)
*/
eReflowType_ReflowDirty,
/**
* The pres shell ran out of time but will guaranteed the reflow
* command gets processed.
*/
eReflowType_Timeout,
/**
* Trap door for extensions.
*/
eReflowType_UserDefined
};
#endif // nsReflowType_h__

View File

@ -38,7 +38,6 @@
#include "nsReadableUtils.h"
#include "nsSimplePageSequence.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsIStyleContext.h"
#include "nsHTMLAtoms.h"

View File

@ -43,7 +43,7 @@
#include "nsIScrollableFrame.h"
#include "nsIDeviceContext.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresShell.h"
@ -209,12 +209,11 @@ ViewportFrame::AppendFrames(nsIPresContext* aPresContext,
mFixedFrames.AppendFrames(nsnull, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::fixedList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
@ -243,12 +242,11 @@ ViewportFrame::InsertFrames(nsIPresContext* aPresContext,
mFixedFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::fixedList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
@ -456,14 +454,14 @@ nsresult
ViewportFrame::IncrementalReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState)
{
nsIReflowCommand::ReflowType type;
nsReflowType type;
// Get the type of reflow command
aReflowState.reflowCommand->GetType(type);
// The only type of reflow command we expect is that we have dirty
// child frames to reflow
NS_ASSERTION(nsIReflowCommand::ReflowDirty, "unexpected reflow type");
NS_ASSERTION(eReflowType_ReflowDirty, "unexpected reflow type");
// Calculate how much room is available for the fixed items. That means
// determining if the viewport is scrollable and whether the vertical and/or
@ -513,11 +511,11 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame* nextFrame = nsnull;
PRBool isHandled = PR_FALSE;
nsIReflowCommand::ReflowType reflowType = nsIReflowCommand::ContentChanged;
nsReflowType reflowType = eReflowType_ContentChanged;
if (aReflowState.reflowCommand) {
aReflowState.reflowCommand->GetType(reflowType);
}
if (reflowType == nsIReflowCommand::UserDefined) {
if (reflowType == eReflowType_UserDefined) {
// Reflow the fixed frames to account for changed scrolled area size
ReflowFixedFrames(aPresContext, aReflowState);
isHandled = PR_TRUE;

View File

@ -38,11 +38,10 @@
#include "nsAbsoluteContainingBlock.h"
#include "nsContainerFrame.h"
#include "nsHTMLIIDs.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsIViewManager.h"
#include "nsLayoutAtoms.h"
#include "nsIReflowCommand.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
@ -88,12 +87,11 @@ nsAbsoluteContainingBlock::AppendFrames(nsIFrame* aDelegatingFrame,
mAbsoluteFrames.AppendFrames(nsnull, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return rv;
@ -116,12 +114,11 @@ nsAbsoluteContainingBlock::InsertFrames(nsIFrame* aDelegatingFrame,
mAbsoluteFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return rv;
@ -306,14 +303,14 @@ nsAbsoluteContainingBlock::IncrementalReflow(nsIFrame* aDelegatin
NS_IF_RELEASE(listName);
if (isAbsoluteChild) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
// Get the type of reflow command
aReflowState.reflowCommand->GetType(type);
// The only type of reflow command we expect is that we have dirty
// child frames to reflow
NS_ASSERTION(nsIReflowCommand::ReflowDirty, "unexpected reflow type");
NS_ASSERTION(eReflowType_ReflowDirty, "unexpected reflow type");
// Walk the positioned frames and reflow the dirty frames
for (nsIFrame* f = mAbsoluteFrames.FirstChild(); f; f->GetNextSibling(&f)) {

View File

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsAreaFrame.h"
#include "nsBlockBandData.h"
#include "nsIReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"

View File

@ -54,7 +54,7 @@
#include "nsIFrameManager.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsIView.h"
#include "nsIFontMetrics.h"
@ -84,6 +84,7 @@
#include "nsIDOMHTMLHtmlElement.h"
#ifdef DEBUG
#include "nsPrintfCString.h"
#include "nsBlockDebugFlags.h"
@ -182,10 +183,11 @@ nsBlockFrame::InitDebugFlags()
// Debugging support code
#ifdef DEBUG
static const char* kReflowCommandType[] = {
const char* nsBlockFrame::kReflowCommandType[] = {
"ContentChanged",
"StyleChanged",
"ReflowDirty",
"Timeout",
"UserDefined",
};
#endif
@ -600,10 +602,27 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
#ifdef DEBUG
if (gNoisyReflow) {
nsCAutoString reflow;
reflow.Append(nsHTMLReflowState::ReasonToString(aReflowState.reason));
if (aReflowState.reason == eReflowReason_Incremental) {
reflow += " (";
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
reflow += kReflowCommandType[type];
nsIFrame* target;
aReflowState.reflowCommand->GetTarget(target);
reflow += nsPrintfCString("@%p", target);
reflow += ")";
}
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": begin %s reflow availSize=%d,%d computedSize=%d,%d\n",
nsHTMLReflowState::ReasonToString(aReflowState.reason),
reflow.get(),
aReflowState.availableWidth, aReflowState.availableHeight,
aReflowState.mComputedWidth, aReflowState.mComputedHeight);
}
@ -759,24 +778,26 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
mState &= ~NS_FRAME_FIRST_REFLOW;
break;
case eReflowReason_Dirty:
case eReflowReason_Dirty:
// Do nothing; the dirty lines will already have been marked.
break;
case eReflowReason_Incremental: // should call GetNext() ?
aReflowState.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
#ifdef NOISY_REFLOW_REASON
ListTag(stdout);
printf(": reflow=incremental type=%d\n", type);
#endif
switch (type) {
case nsIReflowCommand::StyleChanged:
case eReflowType_StyleChanged:
rv = PrepareStyleChangedReflow(state);
isStyleChange = PR_TRUE;
break;
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
// Do nothing; the dirty lines will already have been marked.
break;
default:
// Map any other incremental operations into full reflows
@ -2032,7 +2053,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
#ifdef DEBUG
if (gNoisyReflow) {
if (aState.mReflowState.reason == eReflowReason_Incremental) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aState.mReflowState.reflowCommand->GetType(type);
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
@ -2837,15 +2858,13 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged,
eReflowType_ContentChanged,
nsnull,
aAttribute);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
else if (nsHTMLAtoms::value == aAttribute) {
const nsStyleDisplay* styleDisplay;
@ -2875,15 +2894,13 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, blockParent,
nsIReflowCommand::ContentChanged,
eReflowType_ContentChanged,
nsnull,
aAttribute);
if (NS_SUCCEEDED(rv)) {
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
}
}
@ -5822,13 +5839,12 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
// although we should. We can't use the NS_FRAME_HAS_DIRTY_CHILDREN
// flag, because that's used to indicate whether in-flow children are
// dirty...
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ReflowDirty);
eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
aPresShell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
#ifdef DEBUG
@ -5870,7 +5886,7 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
nsFrame::CreateAndPostReflowCommand(aPresShell, this,
nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull);
eReflowType_ReflowDirty, nsnull, nsnull, nsnull);
#ifdef DEBUG
if (gNoisyReflow) {
@ -5885,7 +5901,7 @@ nsBlockFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
mState |= NS_FRAME_IS_DIRTY;
// Cancel the dirty children reflow command you posted earlier
nsIReflowCommand::ReflowType type = nsIReflowCommand::ReflowDirty;
nsReflowType type = eReflowType_ReflowDirty;
aPresShell->CancelReflowCommand(this, &type);
#ifdef DEBUG

View File

@ -519,6 +519,8 @@ public:
static PRInt32 gNoiseIndent;
static const char* kReflowCommandType[];
protected:
static void InitDebugFlags();
#endif

View File

@ -44,7 +44,7 @@
#include "nsIPresContext.h"
#include "nsIContent.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLContainerFrame.h"
#include "nsBlockFrame.h"
#include "nsIDOMHTMLTableCellElement.h"
@ -282,18 +282,18 @@ nsBlockReflowContext::ReflowBlock(nsIFrame* aFrame,
// and it's target is the current block, then make sure we send
// StyleChange reflow reasons down to all the children so that
// they don't over-optimize their reflow.
nsIReflowCommand* rc = mOuterReflowState.reflowCommand;
nsHTMLReflowCommand* rc = mOuterReflowState.reflowCommand;
if (rc) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
rc->GetType(type);
if (type == nsIReflowCommand::StyleChanged) {
if (type == eReflowType_StyleChanged) {
nsIFrame* target;
rc->GetTarget(target);
if (target == mOuterReflowState.frame) {
reason = eReflowReason_StyleChange;
}
}
else if (type == nsIReflowCommand::ReflowDirty &&
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY)) {
reason = eReflowReason_Dirty;
}

View File

@ -136,6 +136,10 @@ protected:
nsIFrame* mFrame;
nsRect mSpace;
// For an incremental reflow that has not yet reached the target
// frame, this field contains the next frame along the reflow's
// path.
nsIFrame* mNextRCFrame;
// Spacing style for the frame we are reflowing; only valid after reflow

View File

@ -46,7 +46,7 @@
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsILoadGroup.h"
#include "nsIURL.h"
@ -1335,11 +1335,11 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame", aReflowState.reason);
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
if (eReflowReason_Incremental == aReflowState.reason) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
/* if the style changed, see if we need to load a new url */
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
nsCOMPtr<nsIURI> baseURI;
GetBaseURI(getter_AddRefs(baseURI));

View File

@ -48,7 +48,7 @@
#include "nsIScrollableView.h"
#include "nsVoidArray.h"
#include "nsISizeOfHandler.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLIIDs.h"
#include "nsHTMLContainerFrame.h"
#include "nsIFrameManager.h"
@ -353,7 +353,7 @@ nsContainerFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
nsFrame::CreateAndPostReflowCommand(aPresShell, aChild,
nsIReflowCommand::ReflowDirty, nsnull, nsnull, nsnull);
eReflowType_ReflowDirty, nsnull, nsnull, nsnull);
return NS_OK;
}

View File

@ -38,7 +38,6 @@
#include "nsHTMLContainerFrame.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIContent.h"
#include "nsLineLayout.h"
#include "nsHTMLAtoms.h"

View File

@ -1850,13 +1850,11 @@ nsFrame::ContentChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged);
if (NS_SUCCEEDED(rv)) {
eReflowType_ContentChanged);
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
return rv;
}
@ -3859,9 +3857,9 @@ nsFrame::GetAccessible(nsIAccessible** aAccessible)
#endif
NS_IMETHODIMP
nsFrame::ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded)
nsFrame::ReflowCommandNotify(nsIPresShell* aShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded)
{
return NS_OK;
@ -3972,12 +3970,12 @@ nsFrame::GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame)
}
}
nsresult nsFrame::CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName)
nsresult nsFrame::CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName)
{
nsresult rv;
@ -3985,8 +3983,8 @@ nsresult nsFrame::CreateAndPostReflowCommand(nsIPresShell* aPresS
rv = NS_ERROR_NULL_POINTER;
}
else {
nsCOMPtr<nsIReflowCommand> reflowCmd;
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), aTargetFrame,
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aTargetFrame,
aReflowType, aChildFrame,
aAttribute);
if (NS_SUCCEEDED(rv)) {

View File

@ -47,7 +47,7 @@
#endif
#include "nsIPresShell.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIFrameSelection.h"
#include "nsHTMLReflowState.h"
#include "nsHTMLReflowMetrics.h"
@ -273,9 +273,9 @@ public:
nsPeekOffsetStruct *aPos);
NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
NS_IMETHOD ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild);
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aPresShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded);
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aPresShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded);
#ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
@ -368,12 +368,12 @@ public:
nsIFrame *aFrame,
nsIView **aView);
static nsresult CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName);
static nsresult CreateAndPostReflowCommand(nsIPresShell* aPresShell,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute,
nsIAtom* aListName);
//Mouse Capturing code used by the frames to tell the view to capture all the following events
NS_IMETHOD CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);

View File

@ -37,7 +37,7 @@
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIDeviceContext.h"
#include "nsPageFrame.h"
#include "nsViewsCID.h"
@ -1371,7 +1371,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
// force a reflow of the fixed children
nsFrame::CreateAndPostReflowCommand(presShell, parentFrame,
nsIReflowCommand::UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
eReflowType_UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
}
}
}

View File

@ -56,7 +56,6 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsViewsCID.h"
#include "nsIReflowCommand.h"
#include "nsHTMLIIDs.h"
#include "nsIDOMEvent.h"
#include "nsIScrollableView.h"

View File

@ -39,7 +39,7 @@
#include "nsHTMLContainerFrame.h"
#include "nsCSSRendering.h"
#include "nsIDocument.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsViewsCID.h"
@ -310,11 +310,10 @@ CanvasFrame::AppendFrames(nsIPresContext* aPresContext,
mFrames.AppendFrame(nsnull, aFrameList);
// Generate a reflow command to reflow the newly inserted frame
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
@ -366,11 +365,10 @@ CanvasFrame::RemoveFrame(nsIPresContext* aPresContext,
mFrames.DestroyFrame(aPresContext, aOldFrame);
// Generate a reflow command so we get reflowed
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
} else {
@ -417,7 +415,6 @@ CanvasFrame::Paint(nsIPresContext* aPresContext,
#endif
if (mDoPaintFocus) {
PRBool clipEmpty;
nsRect focusRect;
GetRect(focusRect);
/////////////////////
@ -506,15 +503,15 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
aReflowState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) {
// Get the reflow type
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
switch (reflowType) {
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
isDirtyChildReflow = PR_TRUE;
break;
case nsIReflowCommand::StyleChanged:
case eReflowType_StyleChanged:
// Remember it's a style change so we can set the reflow reason below
isStyleChange = PR_TRUE;
break;

View File

@ -39,13 +39,15 @@
#include "nscore.h"
#include "nsISupports.h"
#include "nsIReflowCommand.h"
#include "nsReflowType.h"
class nsHTMLReflowCommand;
class nsIArena;
class nsIAtom;
class nsINodeInfo;
class nsIContent;
class nsIContentIterator;
class nsIDocument;
class nsIFrame;
class nsIHTMLContent;
class nsIHTMLContentSink;
class nsIHTMLFragmentContentSink;
@ -213,10 +215,10 @@ extern nsresult NS_NewHTMLFragmentContentSink(nsIHTMLFragmentContentSink** aInst
/** Create a new HTML reflow command */
extern nsresult
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
NS_NewHTMLReflowCommand(nsHTMLReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
#endif /* nsHTMLParts_h___ */

View File

@ -49,11 +49,11 @@
nsresult
NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
NS_NewHTMLReflowCommand(nsHTMLReflowCommand** aInstancePtrResult,
nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
{
NS_ASSERTION(aInstancePtrResult,
"null result passed to NS_NewHTMLReflowCommand");
@ -64,8 +64,6 @@ NS_NewHTMLReflowCommand(nsIReflowCommand** aInstancePtrResult,
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(*aInstancePtrResult);
return NS_OK;
}
@ -107,20 +105,20 @@ mPathStats gmPathStats;
// Construct a reflow command given a target frame, reflow command type,
// and optional child frame
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
ReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame,
nsIAtom* aAttribute)
: mType(aReflowType), mTargetFrame(aTargetFrame), mChildFrame(aChildFrame),
mPrevSiblingFrame(nsnull),
mAttribute(aAttribute),
mListName(nsnull),
mFlags(0)
{
MOZ_COUNT_CTOR(nsHTMLReflowCommand);
NS_PRECONDITION(mTargetFrame != nsnull, "null target frame");
if (nsnull!=mAttribute)
NS_ADDREF(mAttribute);
NS_INIT_REFCNT();
#ifdef DEBUG_jesup
gReflows++;
gReflowsInUse++;
@ -131,6 +129,7 @@ nsHTMLReflowCommand::nsHTMLReflowCommand(nsIFrame* aTargetFrame,
nsHTMLReflowCommand::~nsHTMLReflowCommand()
{
MOZ_COUNT_DTOR(nsHTMLReflowCommand);
#ifdef DEBUG_jesup
if (mPath.GetArraySize() == 0)
gReflowsMaxZero++;
@ -145,8 +144,6 @@ nsHTMLReflowCommand::~nsHTMLReflowCommand()
NS_IF_RELEASE(mListName);
}
NS_IMPL_ISUPPORTS1(nsHTMLReflowCommand, nsIReflowCommand)
nsIFrame* nsHTMLReflowCommand::GetContainingBlock(nsIFrame* aFloater) const
{
nsIFrame* containingBlock;
@ -255,7 +252,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::SetTarget(nsIFrame* aTargetFrame)
return NS_OK;
}
NS_IMETHODIMP nsHTMLReflowCommand::GetType(ReflowType& aReflowType) const
NS_IMETHODIMP nsHTMLReflowCommand::GetType(nsReflowType& aReflowType) const
{
aReflowType = mType;
return NS_OK;
@ -374,3 +371,4 @@ nsHTMLReflowCommand::SetFlags(PRInt32 aFlags)
mFlags = aFlags;
return NS_OK;
}

View File

@ -36,60 +36,141 @@
* ***** END LICENSE BLOCK ***** */
#ifndef nsHTMLReflowCommand_h___
#define nsHTMLReflowCommand_h___
#include "nsIReflowCommand.h"
#include "nsReflowType.h"
#include "nsVoidArray.h"
class nsIAtom;
class nsIAtom;
class nsIFrame;
class nsIPresContext;
class nsIRenderingContext;
struct nsHTMLReflowMetrics;
struct nsSize;
// Reflow command flags
#define NS_RC_CREATED_DURING_DOCUMENT_LOAD 0x0001
/**
* An HTML reflow command
* A reflow command is an object that is generated in response to a content
* model change notification. The reflow command is given to a presentation
* shell where it is queued and then dispatched by invoking the reflow
* commands's Dispatch() member function.
*
* Reflow command processing follows a path from the root frame down to the
* target frame (the frame for which the reflow command is destined). Reflow
* commands are processed by invoking the frame's Reflow() member function.
*
* The typical flow of control for a given reflow command starts with a content
* change notification. The content notifications are sent to document observers.
* The presentation shell forwards the notifications to the style set. The style
* system responds to the notifications by creating new frame (or destroying
* existing frames) as appropriate, and then generating a reflow command.
*
* @see nsIDocumentObserver
* @see nsIStyleSet
* @see nsIFrameReflow#Reflow()
* @see nsIPresShell#AppendReflowCommand()
* @see nsIPresShell#ProcessReflowCommands()
*/
class nsHTMLReflowCommand : public nsIReflowCommand {
class nsHTMLReflowCommand {
public:
/**
* Construct an HTML reflow command of type aReflowType and with target
* frame aTargetFrame. You can also specify an optional child frame, e.g.
* to indicate the inserted child frame
*/
nsHTMLReflowCommand(nsIFrame* aTargetFrame,
ReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
nsHTMLReflowCommand(nsIFrame* aTargetFrame,
nsReflowType aReflowType,
nsIFrame* aChildFrame = nsnull,
nsIAtom* aAttribute = nsnull);
virtual ~nsHTMLReflowCommand();
~nsHTMLReflowCommand();
// nsISupports
NS_DECL_ISUPPORTS
/**
* Dispatch the reflow command.
*
* Builds a path from the target frame back to the root frame, and then
* invokes the root frame's Reflow() member function.
*
* @see nsIFrame#Reflow()
*/
nsresult Dispatch(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize,
nsIRenderingContext& aRendContext);
// nsIReflowCommand
NS_IMETHOD Dispatch(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsSize& aMaxSize,
nsIRenderingContext& aRendContext);
NS_IMETHOD GetNext(nsIFrame*& aNextFrame, PRBool aRemove);
NS_IMETHOD GetTarget(nsIFrame*& aTargetFrame) const;
NS_IMETHOD SetTarget(nsIFrame* aTargetFrame);
NS_IMETHOD GetType(ReflowType& aReflowType) const;
/**
* Get the next frame in the command processing path. If requested removes the
* the frame from the path. You must remove the frame from the path before
* dispatching the reflow command to the next frame in the chain.
*/
nsresult GetNext(nsIFrame*& aNextFrame, PRBool aRemove = PR_TRUE);
/** can return nsnull. If nsnull is not returned, the caller must NS_RELEASE aAttribute */
NS_IMETHOD GetAttribute(nsIAtom *& aAttribute) const;
/**
* Get the target of the reflow command.
*/
nsresult GetTarget(nsIFrame*& aTargetFrame) const;
NS_IMETHOD GetChildFrame(nsIFrame*& aChildFrame) const;
NS_IMETHOD GetChildListName(nsIAtom*& aListName) const;
NS_IMETHOD SetChildListName(nsIAtom* aListName);
NS_IMETHOD GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
NS_IMETHOD List(FILE* out) const;
/**
* Change the target of the reflow command.
*/
nsresult SetTarget(nsIFrame* aTargetFrame);
NS_IMETHOD GetFlags(PRInt32* aFlags);
NS_IMETHOD SetFlags(PRInt32 aFlags);
/**
* Get the type of reflow command.
*/
nsresult GetType(nsReflowType& aReflowType) const;
/**
* Can return nsnull. If nsnull is not returned, the caller must NS_RELEASE aAttribute
*/
nsresult GetAttribute(nsIAtom *& aAttribute) const;
/**
* Get the child frame associated with the reflow command.
*/
nsresult GetChildFrame(nsIFrame*& aChildFrame) const;
/**
* Returns the name of the child list to which the child frame belongs.
* Only used for reflow command types FrameAppended, FrameInserted, and
* FrameRemoved
*
* Returns nsnull if the child frame is associated with the unnamed
* principal child list
*/
nsresult GetChildListName(nsIAtom*& aListName) const;
/**
* Sets the name of the child list to which the child frame belongs.
* Only used for reflow command types FrameAppended, FrameInserted, and
* FrameRemoved
*/
nsresult SetChildListName(nsIAtom* aListName);
/**
* Get the previous sibling frame associated with the reflow command.
* This is used for FrameInserted reflow commands.
*/
nsresult GetPrevSiblingFrame(nsIFrame*& aSiblingFrame) const;
/**
* Dump out the reflow-command to out
*/
nsresult List(FILE* out) const;
/**
* Get/set reflow command flags
*/
nsresult GetFlags(PRInt32* aFlags);
nsresult SetFlags(PRInt32 aFlags);
protected:
void BuildPath();
nsIFrame* GetContainingBlock(nsIFrame* aFloater) const;
private:
ReflowType mType;
nsReflowType mType;
nsIFrame* mTargetFrame;
nsIFrame* mChildFrame;
nsIFrame* mPrevSiblingFrame;

View File

@ -108,7 +108,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
// reflow.
nsHTMLReflowState::nsHTMLReflowState(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIReflowCommand& aReflowCommand,
nsHTMLReflowCommand& aReflowCommand,
nsIRenderingContext* aRenderingContext,
const nsSize& aAvailableSpace)
: mReflowDepth(0)

View File

@ -142,10 +142,10 @@ nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
{
/*
// Generate a reflow command with this frame as the target frame
nsIReflowCommand* cmd;
nsHTMLReflowCommand* cmd;
nsresult rv;
rv = NS_NewHTMLReflowCommand(&cmd, this, nsIReflowCommand::ContentChanged);
rv = NS_NewHTMLReflowCommand(&cmd, this, eReflowType_ContentChanged);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext->GetShell(getter_AddRefs(shell));

View File

@ -495,7 +495,7 @@ nsLineBox::GetCombinedArea(nsRect* aResult)
if (aResult) {
*aResult = mData ? mData->mCombinedArea : mBounds;
#ifdef VERY_NOISY_REFLOW
printf("nsLB::SetCombinedArea(1) %p (%d, %d, %d, %d)\n",
printf("nsLineBox::GetCombinedArea(1) %p (%d,%d,%d,%d)\n",
this, aResult->x, aResult->y, aResult->width, aResult->height);
#endif
}

View File

@ -52,7 +52,7 @@
#include "nsIRenderingContext.h"
#include "nsLayoutAtoms.h"
#include "nsPlaceholderFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIDocument.h"
#include "nsIHTMLDocument.h"
#include "nsIContent.h"
@ -942,11 +942,11 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// it's target is the current span, then make sure we send
// StyleChange reflow reasons down to the children so that they
// don't over-optimize their reflow.
nsIReflowCommand* rc = rs->reflowCommand;
nsHTMLReflowCommand* rc = rs->reflowCommand;
if (rc) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
rc->GetType(type);
if (type == nsIReflowCommand::StyleChanged) {
if (type == eReflowType_StyleChanged) {
nsIFrame* parentFrame = psd->mFrame
? psd->mFrame->mFrame
: mBlockReflowState->frame;
@ -956,7 +956,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
reason = eReflowReason_StyleChange;
}
}
else if (type == nsIReflowCommand::ReflowDirty &&
else if (type == eReflowType_ReflowDirty &&
(state & NS_FRAME_IS_DIRTY)) {
reason = eReflowReason_Dirty;
}

View File

@ -1462,13 +1462,11 @@ nsObjectFrame::ContentChanged(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged);
if (NS_SUCCEEDED(rv)) {
eReflowType_ContentChanged);
if (NS_SUCCEEDED(rv))
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
return rv;
}

View File

@ -39,7 +39,6 @@
#include "nsIContent.h"
#include "nsIPresContext.h"
#include "nsIStyleContext.h"
#include "nsIReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"

View File

@ -49,7 +49,7 @@
#include "nsINameSpaceManager.h" // for Pref-related rule management (bugs 22963,20760,31816)
#include "nsIServiceManager.h"
#include "nsFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIViewManager.h"
#include "nsCRT.h"
#include "prlog.h"
@ -876,15 +876,15 @@ public:
nsIContent** aContent) const;
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame** aPlaceholderFrame) const;
NS_IMETHOD AppendReflowCommand(nsIReflowCommand* aReflowCommand);
NS_IMETHOD AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
NS_IMETHOD AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand);
NS_IMETHOD AppendReflowCommandInternal(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
NS_IMETHOD CancelReflowCommand(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType);
NS_IMETHOD CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest = PR_TRUE);
nsReflowType* aCmdType);
NS_IMETHOD CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest = PR_TRUE);
NS_IMETHOD CancelAllReflowCommands();
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush);
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews);
@ -1092,8 +1092,8 @@ protected:
*/
nsresult NotifyReflowObservers(const char *aData);
nsresult ReflowCommandAdded(nsIReflowCommand* aRC);
nsresult ReflowCommandRemoved(nsIReflowCommand* aRC);
nsresult ReflowCommandAdded(nsHTMLReflowCommand* aRC);
nsresult ReflowCommandRemoved(nsHTMLReflowCommand* aRC);
// This method should be called after a reflow commands have been
// removed from the queue, but after the state in the presshell is
@ -1118,8 +1118,8 @@ protected:
nsresult GetReflowEventStatus(PRBool* aPending);
nsresult SetReflowEventStatus(PRBool aPending);
void PostReflowEvent();
PRBool AlreadyInQueue(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
PRBool AlreadyInQueue(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue);
friend struct ReflowEvent;
// utility to determine if we're in the middle of a drag
@ -3526,8 +3526,8 @@ PresShell::EndReflow(nsIDocument *aDocument, nsIPresShell* aShell)
// frame it targets is targeted by a pre-existing reflow command in
// the queue.
PRBool
PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
PresShell::AlreadyInQueue(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
{
PRInt32 i, n = aQueue.Count();
nsIFrame* targetFrame;
@ -3536,12 +3536,12 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand,
if (NS_SUCCEEDED(aReflowCommand->GetTarget(targetFrame))) {
// Iterate over the reflow commands and compare the targeted frames.
for (i = 0; i < n; i++) {
nsIReflowCommand* rc = (nsIReflowCommand*) aQueue.ElementAt(i);
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*) aQueue.ElementAt(i);
if (rc) {
nsIFrame* targetOfQueuedRC;
if (NS_SUCCEEDED(rc->GetTarget(targetOfQueuedRC))) {
nsIReflowCommand::ReflowType RCType;
nsIReflowCommand::ReflowType queuedRCType;
nsReflowType RCType;
nsReflowType queuedRCType;
aReflowCommand->GetType(RCType);
rc->GetType(queuedRCType);
if (targetFrame == targetOfQueuedRC &&
@ -3564,9 +3564,9 @@ PresShell::AlreadyInQueue(nsIReflowCommand* aReflowCommand,
}
void
NotifyAncestorFramesOfReflowCommand(nsIPresShell* aPresShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded)
NotifyAncestorFramesOfReflowCommand(nsIPresShell* aPresShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded)
{
if (aRC) {
nsIFrame* target;
@ -3583,8 +3583,8 @@ NotifyAncestorFramesOfReflowCommand(nsIPresShell* aPresShell,
}
NS_IMETHODIMP
PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
PresShell::AppendReflowCommandInternal(nsHTMLReflowCommand* aReflowCommand,
nsVoidArray& aQueue)
{
// If we've not yet done the initial reflow, then don't bother
// enqueuing a reflow command yet.
@ -3616,11 +3616,14 @@ PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
// who call SendInterruptNotificationTo to make sure there are no duplicates
if ((&aQueue == &mTimeoutReflowCommands) ||
((&aQueue == &mReflowCommands) && !AlreadyInQueue(aReflowCommand, aQueue))) {
NS_ADDREF(aReflowCommand);
rv = (aQueue.AppendElement(aReflowCommand) ? NS_OK : NS_ERROR_OUT_OF_MEMORY);
ReflowCommandAdded(aReflowCommand);
NotifyAncestorFramesOfReflowCommand(this, aReflowCommand, PR_TRUE);
}
else {
// We're not going to process this reflow command.
delete aReflowCommand;
}
// For async reflow during doc load, post a reflow event if we are not batching reflow commands.
// For sync reflow during doc load, post a reflow event if we are not batching reflow commands
@ -3637,7 +3640,7 @@ PresShell::AppendReflowCommandInternal(nsIReflowCommand* aReflowCommand,
}
NS_IMETHODIMP
PresShell::AppendReflowCommand(nsIReflowCommand* aReflowCommand)
PresShell::AppendReflowCommand(nsHTMLReflowCommand* aReflowCommand)
{
return AppendReflowCommandInternal(aReflowCommand, mReflowCommands);
}
@ -3665,14 +3668,14 @@ PresShell :: IsDragInProgress ( ) const
NS_IMETHODIMP
PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest)
PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFrame,
nsReflowType* aCmdType,
nsVoidArray& aQueue,
PRBool aProcessDummyLayoutRequest)
{
PRInt32 i, n = aQueue.Count();
for (i = 0; i < n; i++) {
nsIReflowCommand* rc = (nsIReflowCommand*) aQueue.ElementAt(i);
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*) aQueue.ElementAt(i);
if (rc) {
nsIFrame* target;
if (NS_SUCCEEDED(rc->GetTarget(target))) {
@ -3680,7 +3683,7 @@ PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFram
if (aCmdType != NULL) {
// If aCmdType is specified, only remove reflow commands
// of that type
nsIReflowCommand::ReflowType type;
nsReflowType type;
if (NS_SUCCEEDED(rc->GetType(type))) {
if (type != *aCmdType)
continue;
@ -3696,7 +3699,7 @@ PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFram
aQueue.RemoveElementAt(i);
ReflowCommandRemoved(rc);
NotifyAncestorFramesOfReflowCommand(this, rc, PR_FALSE);
NS_RELEASE(rc);
delete rc;
n--;
i--;
continue;
@ -3713,8 +3716,8 @@ PresShell::CancelReflowCommandInternal(nsIFrame* aTargetFram
}
NS_IMETHODIMP
PresShell::CancelReflowCommand(nsIFrame* aTargetFrame,
nsIReflowCommand::ReflowType* aCmdType)
PresShell::CancelReflowCommand(nsIFrame* aTargetFrame,
nsReflowType* aCmdType)
{
return CancelReflowCommandInternal(aTargetFrame, aCmdType, mReflowCommands);
}
@ -3724,21 +3727,21 @@ NS_IMETHODIMP
PresShell::CancelAllReflowCommands()
{
PRInt32 n = mReflowCommands.Count();
nsIReflowCommand* rc;
nsHTMLReflowCommand* rc;
PRInt32 i;
for (i = 0; i < n; i++) {
rc = NS_STATIC_CAST(nsIReflowCommand*, mReflowCommands.ElementAt(0));
rc = NS_STATIC_CAST(nsHTMLReflowCommand*, mReflowCommands.ElementAt(0));
mReflowCommands.RemoveElementAt(0);
ReflowCommandRemoved(rc);
NS_RELEASE(rc);
delete rc;
}
n = mTimeoutReflowCommands.Count();
for (i = 0; i < n; i++) {
rc = NS_STATIC_CAST(nsIReflowCommand*, mTimeoutReflowCommands.ElementAt(0));
rc = NS_STATIC_CAST(nsHTMLReflowCommand*, mTimeoutReflowCommands.ElementAt(0));
mTimeoutReflowCommands.RemoveElementAt(0);
ReflowCommandRemoved(rc);
NS_RELEASE(rc);
delete rc;
}
DoneRemovingReflowCommands();
@ -6043,7 +6046,7 @@ PresShell::ProcessReflowCommand(nsVoidArray& aQueue,
{
// Use RemoveElementAt in case the reflowcommand dispatches a
// new one during its execution.
nsIReflowCommand* rc = (nsIReflowCommand*)aQueue.ElementAt(0);
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*)aQueue.ElementAt(0);
aQueue.RemoveElementAt(0);
// Dispatch the reflow command
@ -6055,7 +6058,7 @@ PresShell::ProcessReflowCommand(nsVoidArray& aQueue,
afterReflow = PR_Now();
ReflowCommandRemoved(rc);
NS_RELEASE(rc);
delete rc;
VERIFY_STYLE_TREE;
if (aAccumulateTime) {
@ -6095,7 +6098,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
PRInt32 i, n = mReflowCommands.Count();
printf("\nPresShell::ProcessReflowCommands: this=%p, count=%d\n", (void*)this, n);
for (i = 0; i < n; i++) {
nsIReflowCommand* rc = (nsIReflowCommand*)
nsHTMLReflowCommand* rc = (nsHTMLReflowCommand*)
mReflowCommands.ElementAt(i);
rc->List(stdout);
}
@ -6200,16 +6203,15 @@ PresShell::SendInterruptNotificationTo(nsIFrame* aFrame,
nsIPresShell::InterruptType aInterruptType)
{
// create a reflow command targeted at aFrame
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv;
// Target the reflow comamnd at aFrame
rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::Timeout);
eReflowType_Timeout);
if (NS_SUCCEEDED(rv)) {
// Add the reflow command
AppendReflowCommandInternal(reflowCmd, mTimeoutReflowCommands);
NS_RELEASE(reflowCmd);
}
return rv;
}
@ -6293,7 +6295,7 @@ PresShell::CloneStyleSet(nsIStyleSet* aSet, nsIStyleSet** aResult)
nsresult
PresShell::ReflowCommandAdded(nsIReflowCommand* aRC)
PresShell::ReflowCommandAdded(nsHTMLReflowCommand* aRC)
{
if (gAsyncReflowDuringDocLoad) {
@ -6333,7 +6335,7 @@ PresShell::ReflowCommandAdded(nsIReflowCommand* aRC)
}
nsresult
PresShell::ReflowCommandRemoved(nsIReflowCommand* aRC)
PresShell::ReflowCommandRemoved(nsHTMLReflowCommand* aRC)
{
if (gAsyncReflowDuringDocLoad) {
NS_PRECONDITION(mRCCreatedDuringLoad >= 0, "PresShell's reflow command queue is in a bad state.");
@ -7505,7 +7507,6 @@ static void RecurseIndiTotals(nsIPresContext* aPresContext,
//------------------------------------------------------------------
PRIntn ReflowCountMgr::DoSingleIndi(PLHashEntry *he, PRIntn i, void *arg)
{
char *str = (char *)he->key;
IndiReflowCounter * counter = (IndiReflowCounter *)he->value;
if (counter && !counter->mHasBeenOutput) {
char * name = ToNewCString(counter->mName);

View File

@ -38,7 +38,7 @@
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIDeviceContext.h"
#include "nsPageFrame.h"
#include "nsViewsCID.h"
@ -675,12 +675,12 @@ nsScrollFrame::Reflow(nsIPresContext* aPresContext,
// See whether we're the target of the reflow command
aReflowState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
// The only type of reflow command we expect to get is a style
// change reflow command
aReflowState.reflowCommand->GetType(type);
NS_ASSERTION(nsIReflowCommand::StyleChanged == type, "unexpected reflow type");
NS_ASSERTION(eReflowType_StyleChanged == type, "unexpected reflow type");
// Make a copy of the reflow state (with a different reflow reason) and
// then recurse
@ -907,7 +907,7 @@ nsScrollFrame::Reflow(nsIPresContext* aPresContext,
// force a reflow of the fixed children
nsFrame::CreateAndPostReflowCommand(presShell, parentFrame,
nsIReflowCommand::UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
eReflowType_UserDefined, nsnull, nsnull, nsLayoutAtoms::fixedList);
}
}
}

View File

@ -38,7 +38,6 @@
#include "nsReadableUtils.h"
#include "nsSimplePageSequence.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsIRenderingContext.h"
#include "nsIStyleContext.h"
#include "nsHTMLAtoms.h"

View File

@ -43,7 +43,7 @@
#include "nsIScrollableFrame.h"
#include "nsIDeviceContext.h"
#include "nsIPresContext.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresShell.h"
@ -209,12 +209,11 @@ ViewportFrame::AppendFrames(nsIPresContext* aPresContext,
mFixedFrames.AppendFrames(nsnull, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::fixedList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
@ -243,12 +242,11 @@ ViewportFrame::InsertFrames(nsIPresContext* aPresContext,
mFixedFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
// Generate a reflow command to reflow the dirty frames
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
reflowCmd->SetChildListName(nsLayoutAtoms::fixedList);
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
@ -456,14 +454,14 @@ nsresult
ViewportFrame::IncrementalReflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState)
{
nsIReflowCommand::ReflowType type;
nsReflowType type;
// Get the type of reflow command
aReflowState.reflowCommand->GetType(type);
// The only type of reflow command we expect is that we have dirty
// child frames to reflow
NS_ASSERTION(nsIReflowCommand::ReflowDirty, "unexpected reflow type");
NS_ASSERTION(eReflowType_ReflowDirty, "unexpected reflow type");
// Calculate how much room is available for the fixed items. That means
// determining if the viewport is scrollable and whether the vertical and/or
@ -513,11 +511,11 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame* nextFrame = nsnull;
PRBool isHandled = PR_FALSE;
nsIReflowCommand::ReflowType reflowType = nsIReflowCommand::ContentChanged;
nsReflowType reflowType = eReflowType_ContentChanged;
if (aReflowState.reflowCommand) {
aReflowState.reflowCommand->GetType(reflowType);
}
if (reflowType == nsIReflowCommand::UserDefined) {
if (reflowType == eReflowType_UserDefined) {
// Reflow the fixed frames to account for changed scrolled area size
ReflowFixedFrames(aPresContext, aReflowState);
isHandled = PR_TRUE;

View File

@ -293,7 +293,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsReflowReason reason = aReflowState.reason;
if ( aReflowState.reason == eReflowReason_Incremental ) {
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
// See if it's targeted at us
@ -303,7 +303,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
if (this == targetFrame) {
switch (reflowType) {
case nsIReflowCommand::StyleChanged:
case eReflowType_StyleChanged:
{
nsHTMLReflowState newState(aReflowState);
newState.reason = eReflowReason_StyleChange;
@ -312,7 +312,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
break;
// if its a dirty type then reflow us with a dirty reflow
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
{
nsHTMLReflowState newState(aReflowState);
newState.reason = eReflowReason_Dirty;

View File

@ -85,7 +85,7 @@
#include "nsIDOMNSHTMLFormElement.h"
#include "nsDOMError.h"
#include "nsHTMLParts.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsICategoryManager.h"
#include "nsIFormSubmitObserver.h"
@ -665,12 +665,11 @@ nsFormFrame::StyleChangeReflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::StyleChanged);
eReflowType_StyleChanged);
if (NS_SUCCEEDED(rv)) {
shell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}

View File

@ -319,9 +319,9 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
if (this == targetFrame) {
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
if (nsIReflowCommand::StyleChanged == reflowType) {
if (eReflowType_StyleChanged == reflowType) {
reflowState.reason = eReflowReason_StyleChange;
}
else {

View File

@ -598,9 +598,9 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
if (this == targetFrame) {
Invalidate(aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
if (nsIReflowCommand::StyleChanged == reflowType) {
if (eReflowType_StyleChanged == reflowType) {
reflowState.reason = eReflowReason_StyleChange;
}
else {

View File

@ -58,7 +58,7 @@
#include "nsIScrollableView.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsWidgetsCID.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIDOMEventReceiver.h"
@ -784,7 +784,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
nsIFrame* targetFrame;
firstPassState.reflowCommand->GetTarget(targetFrame);
if (this == targetFrame) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
firstPassState.reason = eReflowReason_StyleChange;
firstPassState.reflowCommand = nsnull;
@ -798,7 +798,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
NS_ASSERTION(aDesiredSize.height < 100000, "Height is still NS_UNCONSTRAINEDSIZE");
return res;
}
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
firstPassState.reason = eReflowReason_StyleChange;
firstPassState.reflowCommand = nsnull;

View File

@ -419,13 +419,19 @@ GetIBContainingBlockFor(nsIFrame* aFrame)
nsIFrame* parentFrame;
do {
aFrame->GetParent(&parentFrame);
if (!parentFrame || !IsFrameSpecial(parentFrame))
if (! parentFrame) {
NS_ERROR("no unsplit block frame in IB hierarchy");
return aFrame;
}
if (!IsFrameSpecial(parentFrame))
break;
aFrame = parentFrame;
} while (1);
return aFrame;
return parentFrame;
}
//----------------------------------------------------------------------
@ -8605,6 +8611,17 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
nsLayoutAtoms::fixedList,
state.mFixedItems.childList);
}
#ifdef DEBUG
if (gReallyNoisyContentUpdates && docElementFrame) {
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(docElementFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentInserted: resulting frame model:\n");
fdbg->List(aPresContext, stdout, 0);
}
}
#endif
}
nsCOMPtr<nsIBindingManager> bm;
@ -9904,9 +9921,9 @@ nsCSSFrameConstructor::StyleChangeReflow(nsIPresContext* aPresContext,
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsCOMPtr<nsIReflowCommand> reflowCmd;
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), aFrame,
nsIReflowCommand::StyleChanged,
nsHTMLReflowCommand *reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
eReflowType_StyleChanged,
nsnull,
aAttribute);
@ -13461,6 +13478,12 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
aFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&) parentDisplay);
if (NS_STYLE_DISPLAY_INLINE == parentDisplay->mDisplay) {
if (!AreAllKidsInline(aFrameList)) {
// XXXwaterson temporary code until we figure out why bug 102931
// is really happening.
NS_ASSERTION(aBlockContent != nsnull, "ack, inline without a containing block");
if (! aBlockContent)
return PR_FALSE;
// Ok, reverse tracks: wipe out the frames we just created
nsCOMPtr<nsIPresShell> presShell;
nsCOMPtr<nsIFrameManager> frameManager;

View File

@ -60,7 +60,7 @@ FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_HTML
DEFINES += -D_IMPL_NS_HTML -DDEBUG_TABLE_REFLOW_off
INCLUDES += \
-I$(srcdir)/../../base/src \

View File

@ -40,7 +40,7 @@
#include "nsTableCellFrame.h"
#include "nsTableFrame.h"
#include "nsTableRowGroupFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
@ -858,9 +858,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
rv = aReflowState.reflowCommand->GetTarget(target);
if ((PR_TRUE==NS_SUCCEEDED(rv)) && target) {
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
isStyleChanged = PR_TRUE;
}
else {

View File

@ -37,7 +37,6 @@
#include "nsCOMPtr.h"
#include "nsTableColFrame.h"
#include "nsContainerFrame.h"
#include "nsIReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"

View File

@ -39,7 +39,7 @@
#include "nsTableFrame.h"
#include "nsIHTMLTableColElement.h"
#include "nsIDOMHTMLTableColElement.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
@ -551,7 +551,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext* aPresCont
{
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
nsIFrame *objectFrame;
aReflowState.reflowCommand->GetChildFrame(objectFrame);
@ -560,11 +560,11 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext* aPresCont
objectFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
switch (type)
{
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;

View File

@ -63,7 +63,7 @@
#include "nsIView.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsLayoutAtoms.h"
#include "nsIDeviceContext.h"
#include "nsIStyleSet.h"
@ -295,7 +295,7 @@ nsTableFrame::Destroy(nsIPresContext* aPresContext)
NS_IMETHODIMP
nsTableFrame::ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded)
{
@ -305,14 +305,14 @@ nsTableFrame::ReflowCommandNotify(nsIPresShell* aShell,
}
#ifndef TABLE_REFLOW_COALESCING_OFF
nsIReflowCommand::ReflowType type;
nsReflowType type;
aRC->GetType(type);
if ((type == nsIReflowCommand::ContentChanged) ||
(type == nsIReflowCommand::StyleChanged) ||
(type == nsIReflowCommand::ReflowDirty)) {
if ((type == eReflowType_ContentChanged) ||
(type == eReflowType_StyleChanged) ||
(type == eReflowType_ReflowDirty)) {
mNumDescendantReflowsPending += (aCommandAdded) ? 1 : -1;
}
else if (type == nsIReflowCommand::Timeout) {
else if (type == eReflowType_Timeout) {
if (aCommandAdded) {
mNumDescendantTimeoutReflowsPending++;
if (RequestedTimeoutReflow()) {
@ -389,13 +389,12 @@ nsTableFrame::AppendDirtyReflowCommand(nsIPresShell* aPresShell,
frameState |= NS_FRAME_IS_DIRTY; // mark the table frame as dirty
aFrame->SetFrameState(frameState);
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::ReflowDirty);
eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
// Add the reflow command
rv = aPresShell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return rv;
@ -1607,9 +1606,9 @@ PRBool nsTableFrame::NeedsReflow(const nsHTMLReflowState& aReflowState)
#ifndef TABLE_REFLOW_COALESCING_OFF
nsIFrame* reflowTarget;
aReflowState.reflowCommand->GetTarget(reflowTarget);
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
if (reflowType == nsIReflowCommand::Timeout) {
if (reflowType == eReflowType_Timeout) {
result = PR_FALSE;
if (this == reflowTarget) {
if (mNumDescendantTimeoutReflowsPending <= 0) {
@ -2032,9 +2031,9 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
// determine if we need to reset DescendantReflowedNotTimeout and/or
// RequestedTimeoutReflow after a timeout reflow.
if (aReflowState.reflowCommand) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::Timeout == type) {
if (eReflowType_Timeout == type) {
nsIFrame* target = nsnull;
aReflowState.reflowCommand->GetTarget(target);
if (target == this) { // target is me
@ -2682,7 +2681,7 @@ nsTableFrame::IncrementalReflow(nsIPresContext* aPresContext,
nsIFrame* target = nsnull;
rv = aReflowState.reflowCommand->GetTarget(target);
if (NS_SUCCEEDED(rv) && target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
// this is the target if target is either this or the outer table frame containing this inner frame
nsIFrame* outerTableFrame = nsnull;
@ -2713,18 +2712,18 @@ nsTableFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
switch (type) {
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;
case nsIReflowCommand::ReflowDirty: {
case eReflowType_ReflowDirty: {
// reflow the dirty children
nsTableReflowState reflowState(aReflowState.reflowState, *this, eReflowReason_Initial,
aReflowState.availSize.width, aReflowState.availSize.height);
@ -2735,7 +2734,7 @@ nsTableFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
SetNeedStrategyInit(PR_TRUE);
}
break;
case nsIReflowCommand::Timeout: {
case eReflowType_Timeout: {
// for a timeout reflow, don't do anything here
break;
}
@ -2864,9 +2863,9 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
#ifndef TABLE_REFLOW_COALESCING_OFF
// update the descendant reflow counts and determine if we need to request a timeout reflow
PRBool needToRequestTimeoutReflow = PR_FALSE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::Timeout == type) {
if (eReflowType_Timeout == type) {
mNumDescendantTimeoutReflowsPending--;
NS_ASSERTION(mNumDescendantTimeoutReflowsPending >= 0, "invalid descendant reflow count");
}
@ -4877,9 +4876,9 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame,
timer->mComputedWidth = aState.mComputedWidth;
timer->mComputedHeight = aState.mComputedHeight;
timer->mCount = gRflCount++;
nsIReflowCommand* reflowCommand = aState.reflowCommand;
nsHTMLReflowCommand* reflowCommand = aState.reflowCommand;
if (reflowCommand) {
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
reflowCommand->GetType(reflowType);
timer->mReflowType = reflowType;
}

View File

@ -562,9 +562,9 @@ public:
// increment or decrement the count of pending reflow commands targeted at
// descendants. Only rebalance the table when this count goes to 0 or the
// reflow is the last one in a batch (limited by the pres shell).
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded);
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded);
PRBool IsRowInserted() const;
void SetRowInserted(PRBool aValue);

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsTableOuterFrame.h"
#include "nsTableFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
@ -260,13 +260,11 @@ nsTableOuterFrame::AppendFrames(nsIPresContext* aPresContext,
// Reflow the new caption frame. It's already marked dirty, so generate a reflow
// command that tells us to reflow our dirty child frames
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
if (NS_SUCCEEDED(rv)) {
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv))
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
}
else {
@ -319,13 +317,11 @@ nsTableOuterFrame::RemoveFrame(nsIPresContext* aPresContext,
}
// Generate a reflow command so we get reflowed
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
if (NS_SUCCEEDED(rv)) {
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv))
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return NS_OK;
}
@ -1112,9 +1108,9 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex
nsSize containSize = GetContainingBlockSize(aOuterRS);
// for now just reflow the table if a style changed. This should be improved
nsIReflowCommand::ReflowType reflowCommandType;
nsReflowType reflowCommandType;
aOuterRS.reflowCommand->GetType(reflowCommandType);
PRBool needInnerReflow = (nsIReflowCommand::StyleChanged == reflowCommandType)
PRBool needInnerReflow = (eReflowType_StyleChanged == reflowCommandType)
? PR_TRUE : PR_FALSE;
if (mMinCaptionWidth != captionMES.width) {
@ -1234,21 +1230,21 @@ nsresult nsTableOuterFrame::IR_TargetIsMe(nsIPresContext* aPresContext
nsReflowStatus& aStatus)
{
nsresult rv = NS_OK;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
nsIFrame* objectFrame;
aReflowState.reflowCommand->GetChildFrame(objectFrame);
switch (type) {
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
rv = IR_ReflowDirty(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::StyleChanged :
case nsIReflowCommand::Timeout :
case eReflowType_StyleChanged :
case eReflowType_Timeout :
rv = IR_InnerTableReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;
@ -1288,9 +1284,9 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext,
nsIFrame* target = nsnull;
aOuterRS.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aOuterRS.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
ReflowReason = eReflowReason_StyleChange;
}
}

View File

@ -47,7 +47,7 @@
#include "nsTableFrame.h"
#include "nsTableCellFrame.h"
#include "nsIView.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsCSSRendering.h"
#include "nsHTMLIIDs.h"
#include "nsLayoutAtoms.h"
@ -924,9 +924,9 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) {
aReflowState.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
notifyStyleChange = PR_TRUE;
}
}
@ -1166,17 +1166,17 @@ nsTableRowFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
{
nsresult rv = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
switch (type) {
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
// Reflow the dirty child frames. Typically this is newly added frames.
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus, PR_TRUE);
break;
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;

View File

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIContent.h"
#include "nsIView.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLIIDs.h"
#include "nsIDeviceContext.h"
#include "nsHTMLAtoms.h"
@ -430,9 +430,9 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) {
aReflowState.reflowState.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
reason = eReflowReason_StyleChange;
}
}
@ -1356,11 +1356,11 @@ nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
nsresult rv = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
switch (type) {
case nsIReflowCommand::ReflowDirty: {
case eReflowType_ReflowDirty: {
nsRowGroupReflowState state(aReflowState);
state.reason = eReflowReason_Resize;
// Reflow the dirty child frames. Typically this is newly added frames.
@ -1370,10 +1370,10 @@ nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState, firstRowReflowed);
break;
}
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;

View File

@ -1070,10 +1070,10 @@ nsMathMLContainerFrame::AttributeChanged(nsIPresContext* aPresContext,
aNameSpaceID, aAttribute, aModType, aHint);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIReflowCommand> reflowCmd;
nsCOMPtr<nsHTMLReflowCommand> reflowCmd;
aPresContext->GetShell(getter_AddRefs(shell));
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this,
nsIReflowCommand::ContentChanged,
eReflowType_ContentChanged,
nsnull, aAttribute);
if (NS_SUCCEEDED(rv) && shell) shell->AppendReflowCommand(reflowCmd);
return rv;

View File

@ -563,8 +563,8 @@ nsSVGOuterSVGFrame::AppendFrames(nsIPresContext* aPresContext,
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
// Generate a reflow command to reflow the dirty frames
//nsIReflowCommand* reflowCmd;
//rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
//nsHTMLReflowCommand* reflowCmd;
//rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
//if (NS_SUCCEEDED(rv)) {
// reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
// aPresShell.AppendReflowCommand(reflowCmd);
@ -624,8 +624,8 @@ nsSVGOuterSVGFrame::InsertFrames(nsIPresContext* aPresContext,
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
// Generate a reflow command to reflow the dirty frames
//nsIReflowCommand* reflowCmd;
//rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
//nsHTMLReflowCommand* reflowCmd;
//rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
//if (NS_SUCCEEDED(rv)) {
// reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
// aPresShell.AppendReflowCommand(reflowCmd);
@ -683,8 +683,8 @@ nsSVGOuterSVGFrame::RemoveFrame(nsIPresContext* aPresContext,
vm->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
// Generate a reflow command to reflow the dirty frames
//nsIReflowCommand* reflowCmd;
//rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, nsIReflowCommand::ReflowDirty);
//nsHTMLReflowCommand* reflowCmd;
//rv = NS_NewHTMLReflowCommand(&reflowCmd, aDelegatingFrame, eReflowType_ReflowDirty);
//if (NS_SUCCEEDED(rv)) {
// reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList);
// aPresShell.AppendReflowCommand(reflowCmd);
@ -1048,8 +1048,8 @@ void nsSVGOuterSVGFrame::InitiateReflow()
mNeedsReflow = PR_FALSE;
// Generate a reflow command to reflow ourselves
nsCOMPtr<nsIReflowCommand> reflowCmd;
NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this, nsIReflowCommand::ReflowDirty);
nsCOMPtr<nsHTMLReflowCommand> reflowCmd;
NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this, eReflowType_ReflowDirty);
if (!reflowCmd) {
NS_ERROR("error creating reflow command object");
return;

View File

@ -40,7 +40,7 @@
#include "nsTableCellFrame.h"
#include "nsTableFrame.h"
#include "nsTableRowGroupFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
@ -858,9 +858,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
rv = aReflowState.reflowCommand->GetTarget(target);
if ((PR_TRUE==NS_SUCCEEDED(rv)) && target) {
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
isStyleChanged = PR_TRUE;
}
else {

View File

@ -37,7 +37,6 @@
#include "nsCOMPtr.h"
#include "nsTableColFrame.h"
#include "nsContainerFrame.h"
#include "nsIReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"

View File

@ -39,7 +39,7 @@
#include "nsTableFrame.h"
#include "nsIHTMLTableColElement.h"
#include "nsIDOMHTMLTableColElement.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
@ -551,7 +551,7 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext* aPresCont
{
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
nsIFrame *objectFrame;
aReflowState.reflowCommand->GetChildFrame(objectFrame);
@ -560,11 +560,11 @@ NS_METHOD nsTableColGroupFrame::IR_TargetIsMe(nsIPresContext* aPresCont
objectFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
switch (type)
{
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;

View File

@ -63,7 +63,7 @@
#include "nsIView.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLIIDs.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsLayoutAtoms.h"
#include "nsIDeviceContext.h"
#include "nsIStyleSet.h"
@ -295,7 +295,7 @@ nsTableFrame::Destroy(nsIPresContext* aPresContext)
NS_IMETHODIMP
nsTableFrame::ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded)
{
@ -305,14 +305,14 @@ nsTableFrame::ReflowCommandNotify(nsIPresShell* aShell,
}
#ifndef TABLE_REFLOW_COALESCING_OFF
nsIReflowCommand::ReflowType type;
nsReflowType type;
aRC->GetType(type);
if ((type == nsIReflowCommand::ContentChanged) ||
(type == nsIReflowCommand::StyleChanged) ||
(type == nsIReflowCommand::ReflowDirty)) {
if ((type == eReflowType_ContentChanged) ||
(type == eReflowType_StyleChanged) ||
(type == eReflowType_ReflowDirty)) {
mNumDescendantReflowsPending += (aCommandAdded) ? 1 : -1;
}
else if (type == nsIReflowCommand::Timeout) {
else if (type == eReflowType_Timeout) {
if (aCommandAdded) {
mNumDescendantTimeoutReflowsPending++;
if (RequestedTimeoutReflow()) {
@ -389,13 +389,12 @@ nsTableFrame::AppendDirtyReflowCommand(nsIPresShell* aPresShell,
frameState |= NS_FRAME_IS_DIRTY; // mark the table frame as dirty
aFrame->SetFrameState(frameState);
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
nsresult rv = NS_NewHTMLReflowCommand(&reflowCmd, aFrame,
nsIReflowCommand::ReflowDirty);
eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv)) {
// Add the reflow command
rv = aPresShell->AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return rv;
@ -1607,9 +1606,9 @@ PRBool nsTableFrame::NeedsReflow(const nsHTMLReflowState& aReflowState)
#ifndef TABLE_REFLOW_COALESCING_OFF
nsIFrame* reflowTarget;
aReflowState.reflowCommand->GetTarget(reflowTarget);
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
aReflowState.reflowCommand->GetType(reflowType);
if (reflowType == nsIReflowCommand::Timeout) {
if (reflowType == eReflowType_Timeout) {
result = PR_FALSE;
if (this == reflowTarget) {
if (mNumDescendantTimeoutReflowsPending <= 0) {
@ -2032,9 +2031,9 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
// determine if we need to reset DescendantReflowedNotTimeout and/or
// RequestedTimeoutReflow after a timeout reflow.
if (aReflowState.reflowCommand) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::Timeout == type) {
if (eReflowType_Timeout == type) {
nsIFrame* target = nsnull;
aReflowState.reflowCommand->GetTarget(target);
if (target == this) { // target is me
@ -2682,7 +2681,7 @@ nsTableFrame::IncrementalReflow(nsIPresContext* aPresContext,
nsIFrame* target = nsnull;
rv = aReflowState.reflowCommand->GetTarget(target);
if (NS_SUCCEEDED(rv) && target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
// this is the target if target is either this or the outer table frame containing this inner frame
nsIFrame* outerTableFrame = nsnull;
@ -2713,18 +2712,18 @@ nsTableFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
aStatus = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
switch (type) {
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;
case nsIReflowCommand::ReflowDirty: {
case eReflowType_ReflowDirty: {
// reflow the dirty children
nsTableReflowState reflowState(aReflowState.reflowState, *this, eReflowReason_Initial,
aReflowState.availSize.width, aReflowState.availSize.height);
@ -2735,7 +2734,7 @@ nsTableFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
SetNeedStrategyInit(PR_TRUE);
}
break;
case nsIReflowCommand::Timeout: {
case eReflowType_Timeout: {
// for a timeout reflow, don't do anything here
break;
}
@ -2864,9 +2863,9 @@ nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
#ifndef TABLE_REFLOW_COALESCING_OFF
// update the descendant reflow counts and determine if we need to request a timeout reflow
PRBool needToRequestTimeoutReflow = PR_FALSE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::Timeout == type) {
if (eReflowType_Timeout == type) {
mNumDescendantTimeoutReflowsPending--;
NS_ASSERTION(mNumDescendantTimeoutReflowsPending >= 0, "invalid descendant reflow count");
}
@ -4877,9 +4876,9 @@ void nsTableFrame::DebugReflow(nsIFrame* aFrame,
timer->mComputedWidth = aState.mComputedWidth;
timer->mComputedHeight = aState.mComputedHeight;
timer->mCount = gRflCount++;
nsIReflowCommand* reflowCommand = aState.reflowCommand;
nsHTMLReflowCommand* reflowCommand = aState.reflowCommand;
if (reflowCommand) {
nsIReflowCommand::ReflowType reflowType;
nsReflowType reflowType;
reflowCommand->GetType(reflowType);
timer->mReflowType = reflowType;
}

View File

@ -562,9 +562,9 @@ public:
// increment or decrement the count of pending reflow commands targeted at
// descendants. Only rebalance the table when this count goes to 0 or the
// reflow is the last one in a batch (limited by the pres shell).
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsIReflowCommand* aRC,
PRBool aCommandAdded);
NS_IMETHOD ReflowCommandNotify(nsIPresShell* aShell,
nsHTMLReflowCommand* aRC,
PRBool aCommandAdded);
PRBool IsRowInserted() const;
void SetRowInserted(PRBool aValue);

View File

@ -37,7 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsTableOuterFrame.h"
#include "nsTableFrame.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
@ -260,13 +260,11 @@ nsTableOuterFrame::AppendFrames(nsIPresContext* aPresContext,
// Reflow the new caption frame. It's already marked dirty, so generate a reflow
// command that tells us to reflow our dirty child frames
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
if (NS_SUCCEEDED(rv)) {
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv))
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
}
}
else {
@ -319,13 +317,11 @@ nsTableOuterFrame::RemoveFrame(nsIPresContext* aPresContext,
}
// Generate a reflow command so we get reflowed
nsIReflowCommand* reflowCmd;
nsHTMLReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, nsIReflowCommand::ReflowDirty);
if (NS_SUCCEEDED(rv)) {
rv = NS_NewHTMLReflowCommand(&reflowCmd, this, eReflowType_ReflowDirty);
if (NS_SUCCEEDED(rv))
aPresShell.AppendReflowCommand(reflowCmd);
NS_RELEASE(reflowCmd);
}
return NS_OK;
}
@ -1112,9 +1108,9 @@ nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext* aPresContex
nsSize containSize = GetContainingBlockSize(aOuterRS);
// for now just reflow the table if a style changed. This should be improved
nsIReflowCommand::ReflowType reflowCommandType;
nsReflowType reflowCommandType;
aOuterRS.reflowCommand->GetType(reflowCommandType);
PRBool needInnerReflow = (nsIReflowCommand::StyleChanged == reflowCommandType)
PRBool needInnerReflow = (eReflowType_StyleChanged == reflowCommandType)
? PR_TRUE : PR_FALSE;
if (mMinCaptionWidth != captionMES.width) {
@ -1234,21 +1230,21 @@ nsresult nsTableOuterFrame::IR_TargetIsMe(nsIPresContext* aPresContext
nsReflowStatus& aStatus)
{
nsresult rv = NS_OK;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
nsIFrame* objectFrame;
aReflowState.reflowCommand->GetChildFrame(objectFrame);
switch (type) {
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
rv = IR_ReflowDirty(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::StyleChanged :
case nsIReflowCommand::Timeout :
case eReflowType_StyleChanged :
case eReflowType_Timeout :
rv = IR_InnerTableReflow(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;
@ -1288,9 +1284,9 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext,
nsIFrame* target = nsnull;
aOuterRS.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aOuterRS.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
ReflowReason = eReflowReason_StyleChange;
}
}

View File

@ -47,7 +47,7 @@
#include "nsTableFrame.h"
#include "nsTableCellFrame.h"
#include "nsIView.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsCSSRendering.h"
#include "nsHTMLIIDs.h"
#include "nsLayoutAtoms.h"
@ -924,9 +924,9 @@ nsTableRowFrame::ReflowChildren(nsIPresContext* aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) {
aReflowState.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
notifyStyleChange = PR_TRUE;
}
}
@ -1166,17 +1166,17 @@ nsTableRowFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
{
nsresult rv = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowCommand->GetType(type);
switch (type) {
case nsIReflowCommand::ReflowDirty:
case eReflowType_ReflowDirty:
// Reflow the dirty child frames. Typically this is newly added frames.
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus, PR_TRUE);
break;
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;

View File

@ -45,7 +45,7 @@
#include "nsStyleConsts.h"
#include "nsIContent.h"
#include "nsIView.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLIIDs.h"
#include "nsIDeviceContext.h"
#include "nsHTMLAtoms.h"
@ -430,9 +430,9 @@ nsTableRowGroupFrame::ReflowChildren(nsIPresContext* aPresContext,
if (eReflowReason_Incremental == aReflowState.reason) {
aReflowState.reflowState.reflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
if (nsIReflowCommand::StyleChanged == type) {
if (eReflowType_StyleChanged == type) {
reason = eReflowReason_StyleChange;
}
}
@ -1356,11 +1356,11 @@ nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
nsresult rv = NS_FRAME_COMPLETE;
nsIReflowCommand::ReflowType type;
nsReflowType type;
aReflowState.reflowState.reflowCommand->GetType(type);
switch (type) {
case nsIReflowCommand::ReflowDirty: {
case eReflowType_ReflowDirty: {
nsRowGroupReflowState state(aReflowState);
state.reason = eReflowReason_Resize;
// Reflow the dirty child frames. Typically this is newly added frames.
@ -1370,10 +1370,10 @@ nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
CalculateRowHeights(aPresContext, aDesiredSize, aReflowState.reflowState, firstRowReflowed);
break;
}
case nsIReflowCommand::StyleChanged :
case eReflowType_StyleChanged :
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
break;
case nsIReflowCommand::ContentChanged :
case eReflowType_ContentChanged :
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
rv = NS_ERROR_ILLEGAL_VALUE;
break;

View File

@ -328,7 +328,7 @@ nsBox::MarkStyleChange(nsBoxLayoutState& aState)
nsIFrame* frame = nsnull;
GetFrame(&frame);
nsFrame::CreateAndPostReflowCommand(shell, frame,
nsIReflowCommand::StyleChange, nsnull, nsnull, nsnull);
nsHTMLReflowCommand::StyleChange, nsnull, nsnull, nsnull);
return NS_OK;
*/
nsIFrame* frame = nsnull;
@ -423,7 +423,7 @@ nsBox::RelayoutStyleChange(nsBoxLayoutState& aState, nsIBox* aChild)
nsIFrame* frame = nsnull;
aChild->GetFrame(&frame);
nsFrame::CreateAndPostReflowCommand(shell, frame,
nsIReflowCommand::StyleChanged, nsnull, nsnull, nsnull);
eReflowType_StyleChanged, nsnull, nsnull, nsnull);
return NS_OK;
}
} else {

View File

@ -73,7 +73,6 @@
#include "nsINameSpaceManager.h"
#include "nsHTMLAtoms.h"
#include "nsXULAtoms.h"
#include "nsIReflowCommand.h"
#include "nsIContent.h"
#include "nsSpaceManager.h"
#include "nsHTMLParts.h"

View File

@ -43,7 +43,7 @@
//
#include "nsBoxLayoutState.h"
#include "nsIReflowCommand.h"
#include "nsHTMLReflowCommand.h"
#include "nsBoxFrame.h"
#include "nsIStyleContext.h"
#include "nsHTMLAtoms.h"
@ -186,13 +186,13 @@ nsBoxLayoutState::HandleReflow(nsIBox* aRootBox)
void
nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox)
nsBoxLayoutState::UnWind(nsHTMLReflowCommand* aCommand, nsIBox* aBox)
{
// if incremental unwindow the chain
nsIFrame* incrementalChild = nsnull;
nsIFrame* target = nsnull;
aCommand->GetTarget(target);
nsIReflowCommand::ReflowType type;
nsReflowType type;
mReflowState->reflowCommand->GetType(type);
while(1)
@ -227,7 +227,7 @@ nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox)
// mark it dirty generating a new reflow command targeted
// at us and coelesce out this one.
if (type == nsIReflowCommand::StyleChanged) {
if (type == eReflowType_StyleChanged) {
ibox->MarkStyleChange(*this);
// could be a visiblity change. Like collapse so we need to dirty
@ -290,7 +290,7 @@ nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox)
/*
void
nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox)
nsBoxLayoutState::UnWind(nsHTMLReflowCommand* aCommand, nsIBox* aBox)
{
nsFrameState state;
@ -333,7 +333,7 @@ nsBoxLayoutState::UnWind(nsIReflowCommand* aCommand, nsIBox* aBox)
*/
nsIBox*
nsBoxLayoutState::GetTargetBox(nsIReflowCommand* mCommand, PRBool& aIsAdaptor)
nsBoxLayoutState::GetTargetBox(nsHTMLReflowCommand* mCommand, PRBool& aIsAdaptor)
{
nsIFrame* target = nsnull;
mReflowState->reflowCommand->GetTarget(target);

View File

@ -56,7 +56,7 @@ class nsCalculatedBoxInfo;
struct nsHTMLReflowMetrics;
class nsString;
class nsIBox;
class nsIReflowCommand;
class nsHTMLReflowCommand;
class nsBoxLayoutState
{
@ -104,8 +104,8 @@ public:
private:
//void DirtyAllChildren(nsBoxLayoutState& aState, nsIBox* aBox);
void UnWind(nsIReflowCommand* aCommand, nsIBox* aRootBox);
nsIBox* GetTargetBox(nsIReflowCommand* mCommand, PRBool& aIsAdaptor);
void UnWind(nsHTMLReflowCommand* aCommand, nsIBox* aRootBox);
nsIBox* GetTargetBox(nsHTMLReflowCommand* mCommand, PRBool& aIsAdaptor);
nsIBox* GetBoxForFrame(nsIFrame* aFrame, PRBool& aIsAdaptor);
nsCOMPtr<nsIPresContext> mPresContext;

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