Get rid of nsIFrameManager abstract interface to the frame manager. Bug 233972, r+sr=roc.

This commit is contained in:
bryner%brianryner.com 2004-02-23 21:29:06 +00:00
parent 0fd39581ea
commit 225298a99e
71 changed files with 2353 additions and 2837 deletions

View File

@ -99,7 +99,6 @@
#include "nsIFrameDebug.h"
#include "nsILayoutHistoryState.h"
#include "nsLayoutAtoms.h"
#include "nsIFrameManager.h"
#include "nsIParser.h"
#include "nsIPrintContext.h"
#include "nsGUIEvent.h"

View File

@ -159,7 +159,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIFrameDebug.h"
#include "nsILayoutHistoryState.h"
#include "nsLayoutAtoms.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIParser.h"
#include "nsIPrintContext.h"
#include "nsGUIEvent.h"
@ -2690,11 +2690,8 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
nsCOMPtr<nsIWidget> widget = mParentWidget;
// the top nsPrintObject's widget will always have scrollbars
if (aPO->mParent != nsnull && aPO->mContent) {
nsCOMPtr<nsIFrameManager> frameMan;
aPO->mParent->mPresShell->GetFrameManager(getter_AddRefs(frameMan));
NS_ASSERTION(frameMan, "No Frame manager!");
nsIFrame* frame;
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
nsFrameManager *frameMan = aPO->mParent->mPresShell->FrameManager();
nsIFrame* frame = frameMan->GetPrimaryFrameFor(aPO->mContent);
if (frame) {
nsIView* view = frame->GetView();
@ -3057,35 +3054,31 @@ nsPrintEngine::PrintDocContent(nsPrintObject* aPO, nsresult& aStatus)
static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY)
{
if (aPO->mParent != nsnull) {
nsCOMPtr<nsIFrameManager> frameMan;
// we would not have gotten here if any of these ptrs were null
aPO->mParent->mPresShell->GetFrameManager(getter_AddRefs(frameMan));
NS_ASSERTION(frameMan, "No Frame manager!");
if (frameMan) {
// This gets out HTMLIFrame
nsIFrame* frame;
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
NS_ASSERTION(frame, "no primary frame for IFRAME");
// find the offset to the content rect
if (!frame)
return;
nsFrameManager *frameMan = aPO->mParent->mPresShell->FrameManager();
nsMargin borderPadding(0, 0, 0, 0);
frame->CalcBorderPadding(borderPadding);
aX += borderPadding.left;
aY += borderPadding.top;
// This gets our HTMLIFrame
nsIFrame* frame = frameMan->GetPrimaryFrameFor(aPO->mContent);
NS_ASSERTION(frame, "no primary frame for IFRAME");
if (!frame)
return;
// traverse out to the pageContentFrame
do {
nsPoint pt = frame->GetPosition();
aX += pt.x;
aY += pt.y;
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
break;
}
frame = frame->GetParent();
} while (frame);
}
// find the offset to the content rect
nsMargin borderPadding(0, 0, 0, 0);
frame->CalcBorderPadding(borderPadding);
aX += borderPadding.left;
aY += borderPadding.top;
// traverse out to the pageContentFrame
do {
nsPoint pt = frame->GetPosition();
aX += pt.x;
aY += pt.y;
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
break;
}
frame = frame->GetParent();
} while (frame);
}
}

View File

@ -88,7 +88,6 @@
#include "nsIPresState.h"
#include "nsILayoutHistoryState.h"
#include "nsIFrameManager.h"
#include "nsHTMLParts.h"
#include "nsContentUtils.h"

View File

@ -63,7 +63,6 @@
#include "nsIEnumerator.h"
#include "nsCOMPtr.h"
#include "nsIFrameManager.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"

View File

@ -57,7 +57,6 @@
#include "nsISupportsArray.h"
#include "nsIFrame.h"
#include "nsIDocShell.h"
#include "nsIFrameManager.h"
#include "nsCOMPtr.h"
#include "nsIView.h"
#include "nsLayoutAtoms.h"

View File

@ -43,6 +43,7 @@ nsCSSKeywords.h \
nsCSSPropList.h \
nsCSSProperty.h \
nsCSSProps.h \
nsFrameManager.h \
nsHTMLAtomList.h \
nsHTMLAtoms.h \
nsHTMLValue.h \

View File

@ -0,0 +1,328 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim:cindent:ts=2:et:sw=2:
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Brian Ryner <bryner@brianryner.com>
*
* This Original Code has been modified by IBM Corporation. Modifications made
* by IBM described herein are Copyright (c) International Business Machines
* Corporation, 2000. Modifications to Mozilla code or documentation identified
* per MPL Section 3.3
*
* Date Modified by Description of modification
* 04/20/2000 IBM Corp. OS/2 VisualAge build.
*/
#ifndef _nsFrameManager_h_
#define _nsFrameManager_h_
#include "nsIFrame.h"
#include "nsIStatefulFrame.h"
#include "nsChangeHint.h"
#include "pldhash.h"
class nsIPresShell;
class nsStyleSet;
class nsIContent;
class nsPlaceholderFrame;
class nsStyleContext;
class nsIAtom;
class nsStyleChangeList;
class nsILayoutHistoryState;
// Option flags for GetFrameProperty() member function
#define NS_IFRAME_MGR_REMOVE_PROP 0x0001
/**
* Frame manager interface. The frame manager serves two purposes:
* <li>provides a service for mapping from content to frame and from
* out-of-flow frame to placeholder frame.
* <li>handles structural modifications to the frame model. If the frame model
* lock can be acquired, then the changes are processed immediately; otherwise,
* they're queued and processed later.
*/
class nsFrameManager
{
public:
nsFrameManager() NS_HIDDEN;
~nsFrameManager() NS_HIDDEN;
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
// Initialization
NS_HIDDEN_(nsresult) Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet);
/*
* After Destroy is called, it is an error to call any FrameManager methods.
* Destroy should be called when the frame tree managed by the frame
* manager is no longer being displayed.
*/
NS_HIDDEN_(void) Destroy();
/*
* Gets and sets the root frame (typically the viewport). The lifetime of the
* root frame is controlled by the frame manager. When the frame manager is
* destroyed, it destroys the entire frame hierarchy.
*/
NS_HIDDEN_(nsIFrame*) GetRootFrame() { return mRootFrame; }
NS_HIDDEN_(void) SetRootFrame(nsIFrame* aRootFrame)
{
NS_ASSERTION(!mRootFrame, "already have a root frame");
mRootFrame = aRootFrame;
}
/*
* Get the canvas frame, searching from the root frame down.
* The canvas frame may or may not exist, so this may return null.
*/
NS_HIDDEN_(nsIFrame*) GetCanvasFrame();
// Primary frame functions
NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent);
NS_HIDDEN_(nsresult) SetPrimaryFrameFor(nsIContent* aContent,
nsIFrame* aPrimaryFrame);
NS_HIDDEN_(void) ClearPrimaryFrameMap();
// Placeholder frame functions
NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame);
NS_HIDDEN_(nsresult)
RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
NS_HIDDEN_(void)
UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
NS_HIDDEN_(void) ClearPlaceholderFrameMap();
// Mapping undisplayed content
NS_HIDDEN_(nsStyleContext*) GetUndisplayedContent(nsIContent* aContent);
NS_HIDDEN_(void) SetUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext);
NS_HIDDEN_(void) ChangeUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext);
NS_HIDDEN_(void) ClearUndisplayedContentIn(nsIContent* aContent,
nsIContent* aParentContent);
NS_HIDDEN_(void) ClearAllUndisplayedContentIn(nsIContent* aParentContent);
NS_HIDDEN_(void) ClearUndisplayedContentMap();
// Functions for manipulating the frame model
NS_HIDDEN_(nsresult) AppendFrames(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
return aParentFrame->AppendFrames(GetPresContext(), *GetPresShell(),
aListName, aFrameList);
}
NS_HIDDEN_(nsresult) InsertFrames(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
NS_HIDDEN_(nsresult) RemoveFrame(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_HIDDEN_(nsresult) ReplaceFrame(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
return aParentFrame->ReplaceFrame(GetPresContext(), *GetPresShell(),
aListName, aOldFrame, aNewFrame);
}
// Notification that we were unable to render a replaced element
NS_HIDDEN_(nsresult) CantRenderReplacedElement(nsIFrame* aFrame);
/*
* Notification that a frame is about to be destroyed. This allows any
* outstanding references to the frame to be cleaned up.
*/
NS_HIDDEN_(void) NotifyDestroyingFrame(nsIFrame* aFrame);
/*
* Reparent the style contexts of this frame subtree to live under the new
* given parent style context. The StyleContextParent of aFrame should be
* changed _before_ this method is called, so that style tree verification
* can take place correctly.
*/
NS_HIDDEN_(nsresult) ReParentStyleContext(nsIFrame* aFrame,
nsStyleContext* aNewParentContext);
/*
* Re-resolve the style contexts for a frame tree. Returns the top-level
* change hint resulting from the style re-resolution.
*/
NS_HIDDEN_(nsChangeHint)
ComputeStyleChangeFor(nsIFrame* aFrame,
nsStyleChangeList* aChangeList,
nsChangeHint aMinChange);
// Determine whether an attribute affects style
NS_HIDDEN_(nsReStyleHint) HasAttributeDependentStyle(nsIContent *aContent,
nsIAtom *aAttribute,
PRInt32 aModType);
/*
* Capture/restore frame state for the frame subtree rooted at aFrame.
* aState is the document state storage object onto which each frame
* stores its state.
*/
NS_HIDDEN_(void) CaptureFrameState(nsIFrame* aFrame,
nsILayoutHistoryState* aState);
NS_HIDDEN_(void) RestoreFrameState(nsIFrame* aFrame,
nsILayoutHistoryState* aState);
/*
* Add/restore state for one frame
* (special, global type, like scroll position)
*/
NS_HIDDEN_(void) CaptureFrameStateFor(nsIFrame* aFrame,
nsILayoutHistoryState* aState,
nsIStatefulFrame::SpecialStateID aID =
nsIStatefulFrame::eNoID);
NS_HIDDEN_(void) RestoreFrameStateFor(nsIFrame* aFrame,
nsILayoutHistoryState* aState,
nsIStatefulFrame::SpecialStateID aID =
nsIStatefulFrame::eNoID);
/**
* Gets a property value for a given frame.
*
* @param aFrame the frame with the property
* @param aPropertyName property name as an atom
* @param aOptions optional flags
* NS_IFRAME_MGR_REMOVE_PROP removes the property
* @param aResult NS_OK if the property is set,
* NS_IFRAME_MGR_PROP_NOT_THERE is it is not set
* @param aPropertyValue the property value or 0 if the
property is not set
* @return The property value or 0 if the property is not set
*/
NS_HIDDEN_(void*) GetFrameProperty(const nsIFrame* aFrame,
nsIAtom* aPropertyName,
PRUint32 aOptions,
nsresult* aResult = nsnull);
/**
* Sets the property value for a given frame.
*
* A frame may only have one property value at a time for a given property
* name. The existing property value (if there is one) is overwritten, and
* the old value destroyed
*
* @param aFrame the frame to set the property on
* @param aPropertyName property name as an atom
* @param aPropertyValue the property value
* @param aPropertyDtorFunc when setting a property you can specify the
* dtor function (can be NULL) that will be used
* to destroy the property value. There can be
* only one dtor function for a given property
* name
* @return NS_OK if successful,
* NS_IFRAME_MGR_PROP_OVERWRITTEN if there is an existing property
* value that was overwritten,
* NS_ERROR_INVALID_ARG if the dtor function does not match the
* existing dtor function
*/
NS_HIDDEN_(nsresult) SetFrameProperty(const nsIFrame* aFrame,
nsIAtom* aPropertyName,
void* aPropertyValue,
NSFramePropertyDtorFunc aPropDtorFunc);
/**
* Removes a property and destroys its property value by calling the dtor
* function associated with the property name.
*
* When a frame is destroyed any remaining properties are automatically
* removed.
*
* @param aFrame the frame to set the property on
* @param aPropertyName property name as an atom
* @return NS_OK if the property is successfully removed,
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
*/
NS_HIDDEN_(nsresult) RemoveFrameProperty(const nsIFrame* aFrame,
nsIAtom* aPropertyName);
#ifdef NS_DEBUG
/**
* DEBUG ONLY method to verify integrity of style tree versus frame tree
*/
NS_HIDDEN_(void) DebugVerifyStyleTree(nsIFrame* aFrame);
#endif
struct PropertyList;
private:
class UndisplayedMap;
friend struct CantRenderReplacedElementEvent;
NS_HIDDEN_(nsIPresShell*) GetPresShell() const { return mPresShell; }
NS_HIDDEN_(nsIPresContext*) GetPresContext() const {
return mPresShell->GetPresContext();
}
// weak link, because the pres shell owns us
nsIPresShell* mPresShell;
// the pres shell owns the style set
nsStyleSet* mStyleSet;
nsIFrame* mRootFrame;
PLDHashTable mPrimaryFrameMap;
PLDHashTable mPlaceholderMap;
UndisplayedMap* mUndisplayedMap;
CantRenderReplacedElementEvent* mPostedEvents;
PropertyList* mPropertyList;
PRBool mIsDestroyingFrames;
NS_HIDDEN_(nsChangeHint)
ReResolveStyleContext(nsIPresContext *aPresContext,
nsIFrame *aFrame,
nsIContent *aParentContent,
nsStyleChangeList *aChangeList,
nsChangeHint aMinChange);
NS_HIDDEN_(nsresult) RevokePostedEvents();
NS_HIDDEN_(CantRenderReplacedElementEvent**)
FindPostedEventFor(nsIFrame* aFrame);
NS_HIDDEN_(void) DequeuePostedEventFor(nsIFrame* aFrame);
NS_HIDDEN_(void) DestroyPropertyList(nsIPresContext* aPresContext);
NS_HIDDEN_(PropertyList*) GetPropertyListFor(nsIAtom* aPropertyName) const;
NS_HIDDEN_(void) RemoveAllPropertiesFor(nsIPresContext *aPresContext,
nsIFrame *aFrame);
static NS_HIDDEN_(void)
HandlePLEvent(CantRenderReplacedElementEvent* aEvent);
static NS_HIDDEN_(void)
DestroyPLEvent(CantRenderReplacedElementEvent* aEvent);
};
#endif

View File

@ -54,7 +54,7 @@
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsXBLAtoms.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsStyleContext.h"
#include "nsXBLPrototypeBinding.h"
@ -276,9 +276,9 @@ nsXBLResourceLoader::NotifyBoundElements()
shell->GetPrimaryFrameFor(content, &childFrame);
if (!childFrame) {
// Check to see if it's in the undisplayed content map.
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
nsStyleContext* sc = frameManager->GetUndisplayedContent(content);
nsStyleContext* sc =
shell->FrameManager()->GetUndisplayedContent(content);
if (!sc) {
nsCOMPtr<nsIDocumentObserver> obs(do_QueryInterface(shell));
obs->ContentInserted(doc, parent, content, index);

View File

@ -85,7 +85,7 @@
#include "nsIPresShell.h"
#include "nsIDocumentObserver.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsStyleContext.h"
#include "nsIScriptSecurityManager.h"
@ -170,9 +170,9 @@ public:
shell->GetPrimaryFrameFor(mBoundElement, &childFrame);
if (!childFrame) {
// Check to see if it's in the undisplayed content map.
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
nsStyleContext* sc = frameManager->GetUndisplayedContent(mBoundElement);
nsStyleContext* sc =
shell->FrameManager()->GetUndisplayedContent(mBoundElement);
if (!sc) {
nsCOMPtr<nsIDocumentObserver> obs(do_QueryInterface(shell));
obs->ContentInserted(doc, parent, mBoundElement, index);

View File

@ -46,7 +46,7 @@
#include "nsIPresContext.h"
#include "nsIRenderingContext.h"
#include "nsIServiceManager.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsBidiFrames.h"
#include "nsBidiUtils.h"
@ -810,25 +810,24 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIPresContext* aPresContext,
nsIFrame* thisFramesNextBidiFrame;
nsIFrame* previousFramesNextBidiFrame;
nsIFrameManager* frameManager = presShell->GetFrameManager();
if (frameManager) {
frameManager->GetFrameProperty(aFrame, nsLayoutAtoms::nextBidi,
0, (void**) &thisFramesNextBidiFrame);
if (thisFramesNextBidiFrame) {
// Remove nextBidi property, associated with the current frame
// and with all of its prev-in-flow.
frame = aFrame;
do {
frameManager->RemoveFrameProperty(frame, nsLayoutAtoms::nextBidi);
frame->GetPrevInFlow(&frame);
if (!frame) {
break;
}
frameManager->GetFrameProperty(frame, nsLayoutAtoms::nextBidi,
0, (void**) &previousFramesNextBidiFrame);
} while (thisFramesNextBidiFrame == previousFramesNextBidiFrame);
} // if (thisFramesNextBidiFrame)
} // if (frameManager)
nsFrameManager* frameManager = presShell->FrameManager();
thisFramesNextBidiFrame = NS_STATIC_CAST(nsIFrame*,
frameManager->GetFrameProperty(aFrame, nsLayoutAtoms::nextBidi, 0));
if (thisFramesNextBidiFrame) {
// Remove nextBidi property, associated with the current frame
// and with all of its prev-in-flow.
frame = aFrame;
do {
frameManager->RemoveFrameProperty(frame, nsLayoutAtoms::nextBidi);
frame->GetPrevInFlow(&frame);
if (!frame) {
break;
}
previousFramesNextBidiFrame = NS_STATIC_CAST(nsIFrame*,
frameManager->GetFrameProperty(frame, nsLayoutAtoms::nextBidi, 0));
} while (thisFramesNextBidiFrame == previousFramesNextBidiFrame);
} // if (thisFramesNextBidiFrame)
}
nsresult

View File

@ -90,7 +90,7 @@
#include "nsTextFragment.h"
#include "nsISupportsArray.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsLegendFrame.h"
@ -368,19 +368,21 @@ IsFrameSpecial(nsIFrame* aFrame)
}
static void
GetSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** aResult)
GetSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** aResult)
{
// We only store the "special sibling" annotation with the first
// frame in the flow. Walk back to find that frame now.
aFrame = aFrame->GetFirstInFlow();
void* value;
aFrameManager->GetFrameProperty(aFrame, nsLayoutAtoms::IBSplitSpecialSibling, 0, &value);
void* value =
aFrameManager->GetFrameProperty(aFrame,
nsLayoutAtoms::IBSplitSpecialSibling, 0);
*aResult = NS_STATIC_CAST(nsIFrame*, value);
}
static nsIFrame*
GetLastSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame)
GetLastSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame)
{
for (nsIFrame *frame = aFrame, *next; ; frame = next) {
GetSpecialSibling(aFrameManager, frame, &next);
@ -394,7 +396,7 @@ GetLastSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame)
// Get the frame's next-in-flow, or, if it doesn't have one,
// its special sibling.
static nsIFrame*
GetNifOrSpecialSibling(nsIFrameManager *aFrameManager, nsIFrame *aFrame)
GetNifOrSpecialSibling(nsFrameManager *aFrameManager, nsIFrame *aFrame)
{
nsIFrame *result;
aFrame->GetNextInFlow(&result);
@ -407,7 +409,7 @@ GetNifOrSpecialSibling(nsIFrameManager *aFrameManager, nsIFrame *aFrame)
}
static void
SetFrameIsSpecial(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aSpecialSibling)
SetFrameIsSpecial(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aSpecialSibling)
{
NS_PRECONDITION(aFrameManager && aFrame, "bad args!");
@ -555,7 +557,7 @@ FindLastBlock(nsIPresContext* aPresContext, nsIFrame* aKid)
*/
inline void
MarkIBSpecialPrevSibling(nsIPresContext* aPresContext,
nsIFrameManager *aFrameManager,
nsFrameManager *aFrameManager,
nsIFrame *aAnonymousFrame,
nsIFrame *aSpecialParent)
{
@ -737,7 +739,7 @@ private:
class nsFrameConstructorState {
public:
nsCOMPtr<nsIPresShell> mPresShell;
nsCOMPtr<nsIFrameManager> mFrameManager;
nsFrameManager *mFrameManager;
// Containing block information for out-of-flow frammes
nsAbsoluteItems mFixedItems;
@ -789,7 +791,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresCon
mPseudoFrames()
{
mPresShell = aPresContext->PresShell();
mPresShell->GetFrameManager(getter_AddRefs(mFrameManager));
mFrameManager = mPresShell->FrameManager();
}
nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresContext,
@ -804,7 +806,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresCon
mPseudoFrames()
{
mPresShell = aPresContext->PresShell();
mPresShell->GetFrameManager(getter_AddRefs(mFrameManager));
mFrameManager = mPresShell->FrameManager();
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell)
@ -1038,8 +1040,8 @@ MoveChildrenTo(nsIPresContext* aPresContext,
// anonymous block frame, but oddly they aren't -- need to
// investigate that...)
if (aNewParentSC)
aPresContext->GetFrameManager()->ReParentStyleContext(aFrameList,
aNewParentSC);
aPresContext->FrameManager()->ReParentStyleContext(aFrameList,
aNewParentSC);
#endif
aFrameList = aFrameList->GetNextSibling();
@ -2758,7 +2760,7 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, aStyleContext, nsnull, aNewFrame);
// if the parent frame was anonymous then reparent the style context
if (aIsPseudoParent) {
aPresContext->GetFrameManager()->
aPresContext->FrameManager()->
ReParentStyleContext(aNewFrame, parentFrame->GetStyleContext());
}
@ -3901,7 +3903,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
nsresult
nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame* aFrame,
nsStyleContext* aStyleContext,
@ -5519,8 +5521,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::defaultz, defaultTooltip);
if (defaultTooltip.EqualsIgnoreCase("true")) {
// Locate the root frame and tell it about the tooltip.
nsIFrame* rootFrame = nsnull;
aState.mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aState.mFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -5629,8 +5630,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
else if (isPopup) {
// Locate the root popup set and add ourselves to the popup set's list
// of popup frames.
nsIFrame* rootFrame;
aState.mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aState.mFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -5666,8 +5666,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::tooltip, value) !=
NS_CONTENT_ATTR_NOT_THERE)
{
nsIFrame* rootFrame = nsnull;
aState.mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aState.mFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -7141,11 +7140,11 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchy(nsIPresContext* aPresConte
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
nsnull, nsnull, mTempFrameTreeState);
nsIFrame* docElementFrame;
// Get the frame that corresponds to the document element
state.mFrameManager->GetPrimaryFrameFor(rootContent, &docElementFrame);
// Get the frame that corresponds to the document element
nsIFrame* docElementFrame =
state.mFrameManager->GetPrimaryFrameFor(rootContent);
// Clear the hash tables that map from content to frame and out-of-flow
// frame to placeholder frame
state.mFrameManager->ClearPrimaryFrameMap();
@ -7406,7 +7405,7 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIPresContext* aPresContext,
nsresult
nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContainer,
nsIFrame* aParentFrame,
nsIFrame* aFrameList)
@ -7534,9 +7533,8 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
// The frame may be a special frame (a split inline frame that
// contains a block). Get the last part of that split.
if (IsFrameSpecial(prevSibling)) {
nsCOMPtr<nsIFrameManager> fm;
aPresShell->GetFrameManager(getter_AddRefs(fm));
prevSibling = GetLastSpecialSibling(fm, prevSibling);
prevSibling = GetLastSpecialSibling(aPresShell->FrameManager(),
prevSibling);
}
// The frame may have a continuation. If so, we want the
@ -7548,7 +7546,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
const nsStyleDisplay* display = prevSibling->GetStyleDisplay();
if (display->IsFloating() || display->IsAbsolutelyPositioned()) {
nsIFrame* placeholderFrame;
nsIFrame *placeholderFrame;
aPresShell->GetPlaceholderFrameFor(prevSibling, &placeholderFrame);
NS_ASSERTION(placeholderFrame, "no placeholder for out-of-flow frame");
prevSibling = placeholderFrame;
@ -7731,9 +7729,8 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
// The frame may be a special frame (a split inline frame that
// contains a block). Get the last part of that split.
if (IsFrameSpecial(prevSibling)) {
nsCOMPtr<nsIFrameManager> fm;
aPresShell->GetFrameManager(getter_AddRefs(fm));
prevSibling = GetLastSpecialSibling(fm, prevSibling);
prevSibling = GetLastSpecialSibling(aPresShell->FrameManager(),
prevSibling);
}
// The frame may have a continuation. Get the last-in-flow
@ -8116,8 +8113,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
// Since we're appending, we'll walk to the last anonymous frame
// that was created for the broken inline frame.
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = shell->FrameManager();
while (1) {
nsIFrame* sibling;
@ -8364,11 +8360,8 @@ nsCSSFrameConstructor::AddDummyFrameToSelect(nsIPresContext* aPresContext,
if (aChildItems) {
aChildItems->AddChild(generatedFrame);
} else {
nsCOMPtr<nsIFrameManager> frameManager;
aPresShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
frameManager->AppendFrames(aParentFrame, nsnull, generatedFrame);
}
aPresShell->FrameManager()->AppendFrames(aParentFrame, nsnull,
generatedFrame);
}
listFrame->SetDummyFrame(generatedFrame);
@ -8385,7 +8378,7 @@ nsCSSFrameConstructor::AddDummyFrameToSelect(nsIPresContext* aPresContext,
static nsresult
DeletingFrameSubtree(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame);
nsresult
@ -8416,8 +8409,7 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
// get the child's parent frame (which ought to be the list frame)
nsIFrame* parentFrame = dummyFrame->GetParent();
nsCOMPtr<nsIFrameManager> frameManager;
aPresShell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = aPresShell->FrameManager();
DeletingFrameSubtree(aPresContext, aPresShell, frameManager,
dummyFrame);
frameManager->RemoveFrame(parentFrame, nsnull, dummyFrame);
@ -9021,7 +9013,7 @@ nsCSSFrameConstructor::ContentReplaced(nsIPresContext* aPresContext,
static nsresult
DoDeletingFrameSubtree(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsVoidArray& aDestroyQueue,
nsIFrame* aRemovedFrame,
nsIFrame* aFrame)
@ -9095,7 +9087,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
static nsresult
DeletingFrameSubtree(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame)
{
// If there's no frame manager it's probably because the pres shell is
@ -9137,8 +9129,7 @@ DeletingFrameSubtree(nsIPresContext* aPresContext,
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP) {
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
nsIFrame* rootFrame;
aFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -9181,13 +9172,12 @@ nsCSSFrameConstructor::RemoveMappingsForFrameSubtree(nsIPresContext* aPresContex
nsILayoutHistoryState* aFrameState)
{
nsIPresShell *presShell = aPresContext->PresShell();
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
// Save the frame tree's state before deleting it
CaptureStateFor(aPresContext, aRemovedFrame, mTempFrameTreeState);
return DeletingFrameSubtree(aPresContext, presShell, frameManager, aRemovedFrame);
return DeletingFrameSubtree(aPresContext, presShell,
presShell->FrameManager(), aRemovedFrame);
}
nsresult
@ -9213,8 +9203,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
#endif
nsIPresShell *shell = aPresContext->PresShell();
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = shell->FrameManager();
nsresult rv = NS_OK;
// Find the child frame that maps the content
@ -9360,130 +9349,128 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
nsPlaceholderFrame* placeholderFrame = nsnull;
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP)
// Get the placeholder frame
frameManager->GetPlaceholderFrameFor(childFrame,
(nsIFrame**)&placeholderFrame);
if (placeholderFrame) {
// Remove the mapping from the frame to its placeholder
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
placeholderFrame = frameManager->GetPlaceholderFrameFor(childFrame);
if (placeholderFrame) {
// Remove the mapping from the frame to its placeholder
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
nsIFrame* rootFrame;
frameManager->GetRootFrame(&rootFrame);
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
nsIFrame* rootFrame = frameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
#ifdef MOZ_XUL
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
if (rootBox) {
nsIFrame* popupSetFrame;
rootBox->GetPopupSetFrame(&popupSetFrame);
if (popupSetFrame) {
nsCOMPtr<nsIPopupSetFrame> popupSet(do_QueryInterface(popupSetFrame));
if (popupSet)
popupSet->RemovePopupFrame(childFrame);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
if (rootBox) {
nsIFrame* popupSetFrame;
rootBox->GetPopupSetFrame(&popupSetFrame);
if (popupSetFrame) {
nsCOMPtr<nsIPopupSetFrame> popupSet(do_QueryInterface(popupSetFrame));
if (popupSet)
popupSet->RemovePopupFrame(childFrame);
}
}
#endif
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
return NS_OK;
}
}
#endif
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
return NS_OK;
}
}
else if (display->IsFloating()) {
else if (display->IsFloating()) {
#ifdef NOISY_FIRST_LETTER
printf(" ==> child display is still floating!\n");
printf(" ==> child display is still floating!\n");
#endif
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame;
frameManager->GetPlaceholderFrameFor(childFrame,
(nsIFrame**)&placeholderFrame);
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame =
frameManager->GetPlaceholderFrameFor(childFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Now we remove the floating frame
// Now we remove the floating frame
// XXX has to be done first for now: the blocks line list
// contains an array of pointers to the placeholder - we have to
// remove the float first (which gets rid of the lines
// reference to the placeholder and float) and then remove the
// placeholder
rv = frameManager->RemoveFrame(parentFrame,
nsLayoutAtoms::floatList, childFrame);
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
// XXX has to be done first for now: the blocks line list
// contains an array of pointers to the placeholder - we have to
// remove the float first (which gets rid of the lines
// reference to the placeholder and float) and then remove the
// placeholder
rv = frameManager->RemoveFrame(parentFrame,
nsnull, placeholderFrame);
nsLayoutAtoms::floatList, childFrame);
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
rv = frameManager->RemoveFrame(parentFrame,
nsnull, placeholderFrame);
}
}
}
// See if it's absolutely or fixed positioned
else if (display->IsAbsolutelyPositioned()) {
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame;
frameManager->GetPlaceholderFrameFor(childFrame,
(nsIFrame**)&placeholderFrame);
// See if it's absolutely or fixed positioned
else if (display->IsAbsolutelyPositioned()) {
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame =
frameManager->GetPlaceholderFrameFor(childFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Generate two notifications. First for the absolutely positioned
// frame
rv = frameManager->RemoveFrame(parentFrame,
(NS_STYLE_POSITION_FIXED == display->mPosition) ?
nsLayoutAtoms::fixedList : nsLayoutAtoms::absoluteList, childFrame);
// Generate two notifications. First for the absolutely positioned
// frame
rv = frameManager->RemoveFrame(parentFrame,
(NS_STYLE_POSITION_FIXED == display->mPosition) ?
nsLayoutAtoms::fixedList : nsLayoutAtoms::absoluteList, childFrame);
// Now the placeholder frame
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
rv = frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
// Now the placeholder frame
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
rv = frameManager->RemoveFrame(parentFrame, nsnull,
placeholderFrame);
}
} else {
// Notify the parent frame that it should delete the frame
// check for a table caption which goes on an additional child list with a different parent
nsIFrame* outerTableFrame;
if (GetCaptionAdjustedParent(parentFrame, childFrame, &outerTableFrame)) {
rv = frameManager->RemoveFrame(outerTableFrame,
nsLayoutAtoms::captionList,
childFrame);
}
else {
rv = frameManager->RemoveFrame(insertionPoint, nsnull, childFrame);
}
}
} else {
// Notify the parent frame that it should delete the frame
// check for a table caption which goes on an additional child list with a different parent
nsIFrame* outerTableFrame;
if (GetCaptionAdjustedParent(parentFrame, childFrame, &outerTableFrame)) {
rv = frameManager->RemoveFrame(outerTableFrame,
nsLayoutAtoms::captionList, childFrame);
if (mInitialContainingBlock == childFrame) {
mInitialContainingBlock = nsnull;
}
else {
rv = frameManager->RemoveFrame(insertionPoint, nsnull, childFrame);
if (haveFLS && mInitialContainingBlock) {
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext,
parentFrame),
GetFloatContainingBlock(aPresContext,
parentFrame));
RecoverLetterFrames(shell, aPresContext, state, containingBlock);
}
}
if (mInitialContainingBlock == childFrame) {
mInitialContainingBlock = nsnull;
}
if (haveFLS && mInitialContainingBlock) {
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext,
parentFrame),
GetFloatContainingBlock(aPresContext,
parentFrame));
RecoverLetterFrames(shell, aPresContext, state, containingBlock);
}
#ifdef DEBUG
if (gReallyNoisyContentUpdates && parentFrame) {
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentRemoved: resulting frame model:\n");
fdbg->List(aPresContext, stdout, 0);
if (gReallyNoisyContentUpdates && parentFrame) {
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentRemoved: resulting frame model:\n");
fdbg->List(aPresContext, stdout, 0);
}
}
}
#endif
}
@ -9500,12 +9487,12 @@ static void
DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIViewManager* aViewManager,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsChangeHint aChange);
static void
UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
nsIViewManager* aViewManager, nsIFrameManager* aFrameManager,
nsIViewManager* aViewManager, nsFrameManager* aFrameManager,
nsRect& aBoundsRect, nsChangeHint aChange)
{
NS_PRECONDITION(gInApplyRenderingChangeToTree,
@ -9561,7 +9548,7 @@ static void
DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIViewManager* aViewManager,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsChangeHint aChange)
{
NS_PRECONDITION(gInApplyRenderingChangeToTree,
@ -9643,14 +9630,11 @@ ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
viewManager->BeginUpdateViewBatch();
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
#ifdef DEBUG
gInApplyRenderingChangeToTree = PR_TRUE;
#endif
DoApplyRenderingChangeToTree(aPresContext, aFrame, viewManager,
frameManager, aChange);
shell->FrameManager(), aChange);
#ifdef DEBUG
gInApplyRenderingChangeToTree = PR_FALSE;
#endif
@ -9782,8 +9766,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
if (!count)
return NS_OK;
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = aPresContext->FrameManager();
// Mark frames so that we skip frames that die along the way, bug 123049.
// A frame can be in the list multiple times with different hints. Further
@ -9807,9 +9790,13 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
// skip any frame that has been destroyed due to a ripple effect
if (frame) {
void* dummy;
nsresult res = frameManager->GetFrameProperty(frame,
nsLayoutAtoms::changeListProperty, 0, &dummy);
nsresult res;
void* dummy =
frameManager->GetFrameProperty(frame,
nsLayoutAtoms::changeListProperty, 0,
&res);
if (NS_IFRAME_MGR_PROP_NOT_THERE == res)
continue;
}
@ -9832,9 +9819,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
nsIPresShell *shell = aPresContext->PresShell();
shell->GetPrimaryFrameFor(content, &frame);
if (frame) {
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
frameManager->DebugVerifyStyleTree(frame);
shell->FrameManager()->DebugVerifyStyleTree(frame);
}
} else {
NS_WARNING("Unable to test style tree integrity -- no content node");
@ -9864,10 +9849,8 @@ nsCSSFrameConstructor::RestyleElement(nsIPresContext *aPresContext,
{
if (aPrimaryFrame) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
aPresContext->GetPresShell()->GetFrameManager()->
ComputeStyleChangeFor(aPrimaryFrame, changeList,
NS_STYLE_HINT_NONE, frameChange);
nsChangeHint frameChange = aPresContext->GetPresShell()->FrameManager()->
ComputeStyleChangeFor(aPrimaryFrame, &changeList, NS_STYLE_HINT_NONE);
if (frameChange & nsChangeHint_ReconstructFrame) {
RecreateFramesForContent(aPresContext, aContent);
@ -10037,10 +10020,11 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
}
}
nsIFrameManager *frameManager = shell->GetFrameManager();
nsReStyleHint rshint = nsReStyleHint(0);
frameManager->HasAttributeDependentStyle(aContent,
aAttribute, aModType, &rshint);
nsFrameManager *frameManager = shell->FrameManager();
nsReStyleHint rshint = frameManager->HasAttributeDependentStyle(aContent,
aAttribute,
aModType);
if (reframe) {
result = RecreateFramesForContent(aPresContext, aContent);
} else if (primaryFrame) {
@ -10050,8 +10034,8 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
// there is an effect, so compute it
if (rshint & eReStyle_Self) {
frameManager->ComputeStyleChangeFor(primaryFrame,
changeList, hint, hint);
hint = frameManager->ComputeStyleChangeFor(primaryFrame, &changeList,
hint);
}
// hint is for primary only
@ -10263,7 +10247,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
nsPlaceholderFrame* placeholderFrame = nsnull;
nsIPresShell *presShell = aPresContext->PresShell();
if (listName) {
presShell->GetPlaceholderFrameFor(aFrame, (nsIFrame**)&placeholderFrame);
presShell->GetPlaceholderFrameFor(aFrame, (nsIFrame**) &placeholderFrame);
}
// Get the previous sibling frame
@ -10281,8 +10265,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
parentFrame, nsnull, newFrame);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = presShell->FrameManager();
// Replace the old frame with the new frame
@ -10745,10 +10728,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
if (!oofContFrame)
return NS_ERROR_NULL_POINTER;
// create a continuing placeholder frame
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
NS_ASSERTION(frameManager, "no frame manager");
CreatePlaceholderFrameFor(shell, aPresContext, frameManager, content,
CreatePlaceholderFrameFor(shell, aPresContext,
shell->FrameManager(), content,
oofContFrame, styleContext, aParentFrame, &newFrame);
if (!newFrame)
return NS_ERROR_NULL_POINTER;
@ -10850,7 +10831,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
// for a frame that maps the specified content object
nsIFrame*
nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent,
@ -10884,7 +10865,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext,
kidFrame = aHint->mPrimaryFrameForPrevSibling;
// But if it's out of flow, start from its placeholder.
if (kidFrame && (kidFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
aFrameManager->GetPlaceholderFrameFor(kidFrame, &kidFrame);
kidFrame = aFrameManager->GetPlaceholderFrameFor(kidFrame);
}
if (kidFrame) {
@ -10999,7 +10980,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext,
// the pres shell hash table
nsresult
nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame** aFrame,
nsFindFrameHint* aHint)
@ -11024,7 +11005,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
// call us back if there is no mapping in the hash table
nsCOMPtr<nsIContent> parentContent = aContent->GetParent(); // Get this once
if (parentContent) {
aFrameManager->GetPrimaryFrameFor(parentContent, &parentFrame);
parentFrame = aFrameManager->GetPrimaryFrameFor(parentContent);
while (parentFrame) {
// Search the child frames for a match
*aFrame = FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
@ -11189,19 +11170,13 @@ nsCSSFrameConstructor::CaptureStateFor(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsILayoutHistoryState* aHistoryState)
{
nsresult rv = NS_OK;
if (aFrame && aPresContext && aHistoryState) {
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
rv = presShell->GetFrameManager(getter_AddRefs(frameManager));
if (NS_SUCCEEDED(rv) && frameManager) {
rv = frameManager->CaptureFrameState(aFrame, aHistoryState);
}
presShell->FrameManager()->CaptureFrameState(aFrame, aHistoryState);
}
}
return rv;
return NS_OK;
}
nsresult
@ -11210,7 +11185,7 @@ nsCSSFrameConstructor::MaybeRecreateFramesForContent(nsIPresContext* aPresContex
{
nsresult result = NS_OK;
nsIPresShell *shell = aPresContext->PresShell();
nsIFrameManager *frameManager = shell->GetFrameManager();
nsFrameManager *frameManager = shell->FrameManager();
nsStyleContext *oldContext = frameManager->GetUndisplayedContent(aContent);
if (oldContext) {
@ -11478,8 +11453,8 @@ ReparentFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
aFrame->SetParent(aNewParentFrame);
aPresContext->GetFrameManager()->ReParentStyleContext(aFrame,
aParentStyleContext);
aPresContext->FrameManager()->ReParentStyleContext(aFrame,
aParentStyleContext);
}
// Special routine to handle placing a list of frames into a block
@ -12130,7 +12105,7 @@ nsresult
nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame,
PRBool* aStopLooking)
{
@ -12157,9 +12132,9 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
// Discover the placeholder frame for the letter frame
nsIFrame* parentFrame;
nsPlaceholderFrame* placeholderFrame;
aFrameManager->GetPlaceholderFrameFor(floatFrame,
(nsIFrame**)&placeholderFrame);
nsPlaceholderFrame* placeholderFrame =
aFrameManager->GetPlaceholderFrameFor(floatFrame);
if (!placeholderFrame) {
// Somethings really wrong
return NS_OK;
@ -12244,7 +12219,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsresult
nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame,
PRBool* aStopLooking)
{
@ -12278,7 +12253,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
textFrame->Init(aPresContext, textContent, aFrame, newSC, nsnull);
// Next rip out the kid and replace it with the text frame
nsIFrameManager* frameManager = aFrameManager;
nsFrameManager* frameManager = aFrameManager;
DeletingFrameSubtree(aPresContext, aPresShell, frameManager, kid);
frameManager->RemoveFrame(aFrame, nsnull, kid);
@ -12308,7 +12283,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsresult
nsCSSFrameConstructor::RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame)
{
PRBool stopLooking = PR_FALSE;
@ -12822,7 +12797,7 @@ nsCSSFrameConstructor::ProcessInlineChildren(nsIPresShell* aPresShell,
// added to the frame hierarchy
static void
DoCleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrameIn)
{
nsIContent* content = aFrameIn->GetContent();
@ -12853,7 +12828,7 @@ DoCleanupFrameReferences(nsIPresContext* aPresContext,
// Helper function that walks a frame list and calls DoCleanupFrameReference()
static void
CleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
while (aFrameList) {
@ -12888,10 +12863,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
return PR_FALSE;
// Ok, reverse tracks: wipe out the frames we just created
nsCOMPtr<nsIPresShell> presShell;
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = aPresContext->FrameManager();
// Destroy the frames. As we do make sure any content to frame mappings
// or entries in the undisplayed content map are removed
@ -13260,9 +13232,9 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF
return ReconstructDocElementHierarchy(aPresContext);
}
nsresult nsCSSFrameConstructor::RemoveFixedItems(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager)
nsresult nsCSSFrameConstructor::RemoveFixedItems(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsFrameManager* aFrameManager)
{
nsresult rv=NS_OK;

View File

@ -51,7 +51,7 @@ struct nsStyleContent;
struct nsStyleDisplay;
class nsIPresShell;
class nsVoidArray;
class nsIFrameManager;
class nsFrameManager;
class nsFrameConstructorState;
class nsIDOMHTMLSelectElement;
class nsIPresContext;
@ -148,7 +148,7 @@ public:
// This is typically called by the pres shell when there is no mapping in
// the pres shell hash table
nsresult FindPrimaryFrameFor(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame** aFrame,
nsFindFrameHint* aHint);
@ -248,7 +248,7 @@ protected:
nsresult AppendFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContainer,
nsIFrame* aParentFrame,
nsIFrame* aFrameList);
@ -453,7 +453,7 @@ protected:
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame* aFrame,
nsStyleContext* aStyleContext,
@ -657,7 +657,7 @@ protected:
PRBool IsScrollable(nsIPresContext* aPresContext, const nsStyleDisplay* aDisplay);
nsIFrame* GetFrameFor(nsIPresShell* aFrameManager,
nsIFrame* GetFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aContent);
@ -876,7 +876,7 @@ protected:
* @param aHint an optional hint used to make the search for aFrame faster
*/
nsIFrame* FindFrameWithContent(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent,
@ -933,20 +933,20 @@ protected:
//
nsresult RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame);
// Recursive helper for RemoveLetterFrames
nsresult RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame,
PRBool* aStopLooking);
// Special remove method for those pesky floating first-letter frames
nsresult RemoveFloatingFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame,
PRBool* aStopLooking);
@ -989,7 +989,7 @@ protected:
nsresult RemoveFixedItems(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager);
nsFrameManager* aFrameManager);
// Find the ``rightmost'' frame for the content immediately preceding
// aIndexInContainer, following continuations if necessary. If aChild is

View File

@ -99,7 +99,6 @@
#include "nsIFrameDebug.h"
#include "nsILayoutHistoryState.h"
#include "nsLayoutAtoms.h"
#include "nsIFrameManager.h"
#include "nsIParser.h"
#include "nsIPrintContext.h"
#include "nsGUIEvent.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,328 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim:cindent:ts=2:et:sw=2:
*
* 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 Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Brian Ryner <bryner@brianryner.com>
*
* This Original Code has been modified by IBM Corporation. Modifications made
* by IBM described herein are Copyright (c) International Business Machines
* Corporation, 2000. Modifications to Mozilla code or documentation identified
* per MPL Section 3.3
*
* Date Modified by Description of modification
* 04/20/2000 IBM Corp. OS/2 VisualAge build.
*/
#ifndef _nsFrameManager_h_
#define _nsFrameManager_h_
#include "nsIFrame.h"
#include "nsIStatefulFrame.h"
#include "nsChangeHint.h"
#include "pldhash.h"
class nsIPresShell;
class nsStyleSet;
class nsIContent;
class nsPlaceholderFrame;
class nsStyleContext;
class nsIAtom;
class nsStyleChangeList;
class nsILayoutHistoryState;
// Option flags for GetFrameProperty() member function
#define NS_IFRAME_MGR_REMOVE_PROP 0x0001
/**
* Frame manager interface. The frame manager serves two purposes:
* <li>provides a service for mapping from content to frame and from
* out-of-flow frame to placeholder frame.
* <li>handles structural modifications to the frame model. If the frame model
* lock can be acquired, then the changes are processed immediately; otherwise,
* they're queued and processed later.
*/
class nsFrameManager
{
public:
nsFrameManager() NS_HIDDEN;
~nsFrameManager() NS_HIDDEN;
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
// Initialization
NS_HIDDEN_(nsresult) Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet);
/*
* After Destroy is called, it is an error to call any FrameManager methods.
* Destroy should be called when the frame tree managed by the frame
* manager is no longer being displayed.
*/
NS_HIDDEN_(void) Destroy();
/*
* Gets and sets the root frame (typically the viewport). The lifetime of the
* root frame is controlled by the frame manager. When the frame manager is
* destroyed, it destroys the entire frame hierarchy.
*/
NS_HIDDEN_(nsIFrame*) GetRootFrame() { return mRootFrame; }
NS_HIDDEN_(void) SetRootFrame(nsIFrame* aRootFrame)
{
NS_ASSERTION(!mRootFrame, "already have a root frame");
mRootFrame = aRootFrame;
}
/*
* Get the canvas frame, searching from the root frame down.
* The canvas frame may or may not exist, so this may return null.
*/
NS_HIDDEN_(nsIFrame*) GetCanvasFrame();
// Primary frame functions
NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent);
NS_HIDDEN_(nsresult) SetPrimaryFrameFor(nsIContent* aContent,
nsIFrame* aPrimaryFrame);
NS_HIDDEN_(void) ClearPrimaryFrameMap();
// Placeholder frame functions
NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame);
NS_HIDDEN_(nsresult)
RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
NS_HIDDEN_(void)
UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame);
NS_HIDDEN_(void) ClearPlaceholderFrameMap();
// Mapping undisplayed content
NS_HIDDEN_(nsStyleContext*) GetUndisplayedContent(nsIContent* aContent);
NS_HIDDEN_(void) SetUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext);
NS_HIDDEN_(void) ChangeUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext);
NS_HIDDEN_(void) ClearUndisplayedContentIn(nsIContent* aContent,
nsIContent* aParentContent);
NS_HIDDEN_(void) ClearAllUndisplayedContentIn(nsIContent* aParentContent);
NS_HIDDEN_(void) ClearUndisplayedContentMap();
// Functions for manipulating the frame model
NS_HIDDEN_(nsresult) AppendFrames(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
return aParentFrame->AppendFrames(GetPresContext(), *GetPresShell(),
aListName, aFrameList);
}
NS_HIDDEN_(nsresult) InsertFrames(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
NS_HIDDEN_(nsresult) RemoveFrame(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_HIDDEN_(nsresult) ReplaceFrame(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
return aParentFrame->ReplaceFrame(GetPresContext(), *GetPresShell(),
aListName, aOldFrame, aNewFrame);
}
// Notification that we were unable to render a replaced element
NS_HIDDEN_(nsresult) CantRenderReplacedElement(nsIFrame* aFrame);
/*
* Notification that a frame is about to be destroyed. This allows any
* outstanding references to the frame to be cleaned up.
*/
NS_HIDDEN_(void) NotifyDestroyingFrame(nsIFrame* aFrame);
/*
* Reparent the style contexts of this frame subtree to live under the new
* given parent style context. The StyleContextParent of aFrame should be
* changed _before_ this method is called, so that style tree verification
* can take place correctly.
*/
NS_HIDDEN_(nsresult) ReParentStyleContext(nsIFrame* aFrame,
nsStyleContext* aNewParentContext);
/*
* Re-resolve the style contexts for a frame tree. Returns the top-level
* change hint resulting from the style re-resolution.
*/
NS_HIDDEN_(nsChangeHint)
ComputeStyleChangeFor(nsIFrame* aFrame,
nsStyleChangeList* aChangeList,
nsChangeHint aMinChange);
// Determine whether an attribute affects style
NS_HIDDEN_(nsReStyleHint) HasAttributeDependentStyle(nsIContent *aContent,
nsIAtom *aAttribute,
PRInt32 aModType);
/*
* Capture/restore frame state for the frame subtree rooted at aFrame.
* aState is the document state storage object onto which each frame
* stores its state.
*/
NS_HIDDEN_(void) CaptureFrameState(nsIFrame* aFrame,
nsILayoutHistoryState* aState);
NS_HIDDEN_(void) RestoreFrameState(nsIFrame* aFrame,
nsILayoutHistoryState* aState);
/*
* Add/restore state for one frame
* (special, global type, like scroll position)
*/
NS_HIDDEN_(void) CaptureFrameStateFor(nsIFrame* aFrame,
nsILayoutHistoryState* aState,
nsIStatefulFrame::SpecialStateID aID =
nsIStatefulFrame::eNoID);
NS_HIDDEN_(void) RestoreFrameStateFor(nsIFrame* aFrame,
nsILayoutHistoryState* aState,
nsIStatefulFrame::SpecialStateID aID =
nsIStatefulFrame::eNoID);
/**
* Gets a property value for a given frame.
*
* @param aFrame the frame with the property
* @param aPropertyName property name as an atom
* @param aOptions optional flags
* NS_IFRAME_MGR_REMOVE_PROP removes the property
* @param aResult NS_OK if the property is set,
* NS_IFRAME_MGR_PROP_NOT_THERE is it is not set
* @param aPropertyValue the property value or 0 if the
property is not set
* @return The property value or 0 if the property is not set
*/
NS_HIDDEN_(void*) GetFrameProperty(const nsIFrame* aFrame,
nsIAtom* aPropertyName,
PRUint32 aOptions,
nsresult* aResult = nsnull);
/**
* Sets the property value for a given frame.
*
* A frame may only have one property value at a time for a given property
* name. The existing property value (if there is one) is overwritten, and
* the old value destroyed
*
* @param aFrame the frame to set the property on
* @param aPropertyName property name as an atom
* @param aPropertyValue the property value
* @param aPropertyDtorFunc when setting a property you can specify the
* dtor function (can be NULL) that will be used
* to destroy the property value. There can be
* only one dtor function for a given property
* name
* @return NS_OK if successful,
* NS_IFRAME_MGR_PROP_OVERWRITTEN if there is an existing property
* value that was overwritten,
* NS_ERROR_INVALID_ARG if the dtor function does not match the
* existing dtor function
*/
NS_HIDDEN_(nsresult) SetFrameProperty(const nsIFrame* aFrame,
nsIAtom* aPropertyName,
void* aPropertyValue,
NSFramePropertyDtorFunc aPropDtorFunc);
/**
* Removes a property and destroys its property value by calling the dtor
* function associated with the property name.
*
* When a frame is destroyed any remaining properties are automatically
* removed.
*
* @param aFrame the frame to set the property on
* @param aPropertyName property name as an atom
* @return NS_OK if the property is successfully removed,
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
*/
NS_HIDDEN_(nsresult) RemoveFrameProperty(const nsIFrame* aFrame,
nsIAtom* aPropertyName);
#ifdef NS_DEBUG
/**
* DEBUG ONLY method to verify integrity of style tree versus frame tree
*/
NS_HIDDEN_(void) DebugVerifyStyleTree(nsIFrame* aFrame);
#endif
struct PropertyList;
private:
class UndisplayedMap;
friend struct CantRenderReplacedElementEvent;
NS_HIDDEN_(nsIPresShell*) GetPresShell() const { return mPresShell; }
NS_HIDDEN_(nsIPresContext*) GetPresContext() const {
return mPresShell->GetPresContext();
}
// weak link, because the pres shell owns us
nsIPresShell* mPresShell;
// the pres shell owns the style set
nsStyleSet* mStyleSet;
nsIFrame* mRootFrame;
PLDHashTable mPrimaryFrameMap;
PLDHashTable mPlaceholderMap;
UndisplayedMap* mUndisplayedMap;
CantRenderReplacedElementEvent* mPostedEvents;
PropertyList* mPropertyList;
PRBool mIsDestroyingFrames;
NS_HIDDEN_(nsChangeHint)
ReResolveStyleContext(nsIPresContext *aPresContext,
nsIFrame *aFrame,
nsIContent *aParentContent,
nsStyleChangeList *aChangeList,
nsChangeHint aMinChange);
NS_HIDDEN_(nsresult) RevokePostedEvents();
NS_HIDDEN_(CantRenderReplacedElementEvent**)
FindPostedEventFor(nsIFrame* aFrame);
NS_HIDDEN_(void) DequeuePostedEventFor(nsIFrame* aFrame);
NS_HIDDEN_(void) DestroyPropertyList(nsIPresContext* aPresContext);
NS_HIDDEN_(PropertyList*) GetPropertyListFor(nsIAtom* aPropertyName) const;
NS_HIDDEN_(void) RemoveAllPropertiesFor(nsIPresContext *aPresContext,
nsIFrame *aFrame);
static NS_HIDDEN_(void)
HandlePLEvent(CantRenderReplacedElementEvent* aEvent);
static NS_HIDDEN_(void)
DestroyPLEvent(CantRenderReplacedElementEvent* aEvent);
};
#endif

View File

@ -63,7 +63,7 @@ class nsStringArray;
class nsICaret;
class nsStyleContext;
class nsIFrameSelection;
class nsIFrameManager;
class nsFrameManager;
class nsILayoutHistoryState;
class nsIReflowCallback;
class nsISupportsArray;
@ -163,10 +163,10 @@ public:
{
return mFrameConstructor;
}
#endif
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const = 0;
nsIFrameManager* GetFrameManager() { return mFrameManager; }
nsFrameManager* FrameManager() { return mFrameManager; }
#endif
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
@ -658,7 +658,7 @@ protected:
nsStyleSet* mStyleSet; // [OWNS]
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
nsIFrameManager* mFrameManager; // [STRONG]
nsFrameManager* mFrameManager; // [OWNS]
};
/**

View File

@ -41,7 +41,6 @@
#include "nsILinkHandler.h"
#include "nsIDocShellTreeItem.h"
#include "nsStyleSet.h"
#include "nsIFrameManager.h"
#include "nsImageLoader.h"
#include "nsIContent.h"
#include "nsIFrame.h"

View File

@ -61,7 +61,7 @@ class nsIDocument;
class nsIDeviceContext;
class nsIFontMetrics;
class nsIFrame;
class nsIFrameManager;
class nsFrameManager;
class nsIImage;
class nsILinkHandler;
class nsIPresShell;
@ -145,9 +145,10 @@ public:
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
#ifdef _IMPL_NS_LAYOUT
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
nsFrameManager* FrameManager()
{ return GetPresShell()->FrameManager(); }
#endif
nsIFrameManager* GetFrameManager()
{ return GetPresShell()->GetFrameManager(); }
/**
* Access compatibility mode for this context

View File

@ -98,7 +98,7 @@
#include "nsIDOMNSHTMLInputElement.h" //optimization for ::DoXXX commands
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsViewsCID.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsILayoutHistoryState.h"
@ -1119,8 +1119,6 @@ public:
NS_IMETHOD SetIgnoreFrameDestruction(PRBool aIgnore);
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame);
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const;
NS_IMETHOD DoCopy();
NS_IMETHOD GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocationString);
NS_IMETHOD GetImageLocation(nsIDOMNode* aNode, nsAString& aLocationString);
@ -1439,12 +1437,10 @@ PRLogModuleInfo* PresShell::gLog;
#ifdef NS_DEBUG
static void
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager)
VerifyStyleTree(nsIPresContext* aPresContext, nsFrameManager* aFrameManager)
{
if (aFrameManager && nsIFrameDebug::GetVerifyStyleTreeEnable()) {
nsIFrame* rootFrame;
aFrameManager->GetRootFrame(&rootFrame);
if (nsIFrameDebug::GetVerifyStyleTreeEnable()) {
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
aFrameManager->DebugVerifyStyleTree(rootFrame);
}
}
@ -1711,14 +1707,12 @@ PresShell::Init(nsIDocument* aDocument,
return result;
// Create and initialize the frame manager
result = NS_NewFrameManager(&mFrameManager);
if (NS_FAILED(result)) {
return result;
mFrameManager = new nsFrameManager();
if (!mFrameManager) {
return NS_ERROR_OUT_OF_MEMORY;
}
result = mFrameManager->Init(this, mStyleSet);
if (NS_FAILED(result)) {
return result;
}
NS_ENSURE_SUCCESS(result, result);
result = mSelection->Init((nsIFocusTracker *) this, nsnull);
if (NS_FAILED(result))
@ -1877,7 +1871,8 @@ PresShell::Destroy()
// Destroy the frame manager. This will destroy the frame hierarchy
if (mFrameManager) {
mFrameManager->Destroy();
NS_RELEASE(mFrameManager);
delete mFrameManager;
mFrameManager = nsnull;
}
// Let the style set do its cleanup.
@ -2753,8 +2748,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
nsIContent *root = mDocument ? mDocument->GetRootContent() : nsnull;
// Get the root frame from the frame manager
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (root) {
MOZ_TIMER_DEBUGLOG(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n",
@ -2918,8 +2912,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
// If we don't have a root frame yet, that means we haven't had our initial
// reflow...
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
// Kick off a top-down reflow
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
@ -3078,22 +3071,12 @@ PresShell::NotifyDestroyingFrame(nsIFrame* aFrame)
CancelReflowCommandInternal(aFrame, nsnull);
// Notify the frame manager
if (mFrameManager) {
mFrameManager->NotifyDestroyingFrame(aFrame);
}
mFrameManager->NotifyDestroyingFrame(aFrame);
}
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetFrameManager(nsIFrameManager** aFrameManager) const
{
*aFrameManager = mFrameManager;
NS_IF_ADDREF(mFrameManager);
return NS_OK;
}
// note that this can return a null caret, but NS_OK
NS_IMETHODIMP PresShell::GetCaret(nsICaret **outCaret)
{
@ -3444,8 +3427,7 @@ PresShell::StyleChangeReflow()
WillCauseReflow();
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
// Kick off a top-down reflow
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
@ -3514,7 +3496,8 @@ PresShell::StyleChangeReflow()
NS_IMETHODIMP
PresShell::GetRootFrame(nsIFrame** aResult) const
{
return mFrameManager->GetRootFrame(aResult);
*aResult = mFrameManager->GetRootFrame();
return NS_OK;
}
NS_IMETHODIMP
@ -3525,11 +3508,10 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
return NS_ERROR_NULL_POINTER;
}
nsIFrame* rootFrame;
nsIPageSequenceFrame* pageSequence = nsnull;
// The page sequence frame is the child of the rootFrame
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame *rootFrame = mFrameManager->GetRootFrame();
nsIFrame* child = rootFrame->GetFirstChild(nsnull);
if (nsnull != child) {
@ -3602,8 +3584,7 @@ PresShell::EndLoad(nsIDocument *aDocument)
{
// Restore frame state for the root scroll frame
nsIFrame* rootFrame = nsnull;
GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
if (!container)
return;
@ -3914,11 +3895,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
NS_IMETHODIMP
PresShell::CantRenderReplacedElement(nsIFrame* aFrame)
{
if (mFrameManager) {
return mFrameManager->CantRenderReplacedElement(aFrame);
}
return NS_OK;
return mFrameManager->CantRenderReplacedElement(aFrame);
}
NS_IMETHODIMP
@ -4647,25 +4624,24 @@ PresShell::CaptureHistoryState(nsILayoutHistoryState** aState, PRBool aLeavingPa
NS_IF_ADDREF(*aState);
// Capture frame state for the entire frame hierarchy
nsIFrame* rootFrame = nsnull;
rv = GetRootFrame(&rootFrame);
if (NS_FAILED(rv) || nsnull == rootFrame) return rv;
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (!rootFrame) return NS_OK;
// Capture frame state for the root scroll frame
// Don't capture state when first creating doc element heirarchy
// As the scroll position is 0 and this will cause us to loose
// our previously saved place!
if (aLeavingPage) {
nsIFrame* scrollFrame = nsnull;
rv = GetRootScrollFrame(mPresContext, rootFrame, &scrollFrame);
GetRootScrollFrame(mPresContext, rootFrame, &scrollFrame);
if (scrollFrame) {
rv = mFrameManager->CaptureFrameStateFor(scrollFrame, historyState, nsIStatefulFrame::eDocumentScrollState);
mFrameManager->CaptureFrameStateFor(scrollFrame, historyState,
nsIStatefulFrame::eDocumentScrollState);
}
}
rv = mFrameManager->CaptureFrameState(rootFrame, historyState);
mFrameManager->CaptureFrameState(rootFrame, historyState);
return rv;
return NS_OK;
}
NS_IMETHODIMP
@ -4850,16 +4826,12 @@ PresShell::UnsuppressAndInvalidate()
}
}
NS_ASSERTION(mFrameManager, "frameManager is already gone");
if (mFrameManager) {
mPaintingSuppressed = PR_FALSE;
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
if (rootFrame) {
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
mPaintingSuppressed = PR_FALSE;
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
}
@ -5337,19 +5309,13 @@ PresShell::ReconstructStyleData()
{
mStylesHaveChanged = PR_FALSE;
nsIFrame* rootFrame;
GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (!rootFrame)
return NS_OK;
nsCOMPtr<nsIFrameManager> frameManager;
GetFrameManager(getter_AddRefs(frameManager));
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(rootFrame, changeList,
NS_STYLE_HINT_NONE,
frameChange);
mFrameManager->ComputeStyleChangeFor(rootFrame, &changeList,
NS_STYLE_HINT_NONE);
mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
@ -5424,17 +5390,8 @@ NS_IMETHODIMP
PresShell::GetPrimaryFrameFor(nsIContent* aContent,
nsIFrame** aResult) const
{
nsresult rv;
if (mFrameManager) {
rv = mFrameManager->GetPrimaryFrameFor(aContent, aResult);
} else {
*aResult = nsnull;
rv = NS_OK;
}
return rv;
*aResult = mFrameManager->GetPrimaryFrameFor(aContent);
return NS_OK;
}
NS_IMETHODIMP
@ -5460,11 +5417,8 @@ NS_IMETHODIMP
PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame** aResult) const
{
if (!mFrameManager) {
*aResult = nsnull;
return NS_OK;
}
return mFrameManager->GetPlaceholderFrameFor(aFrame, aResult);
*aResult = mFrameManager->GetPlaceholderFrameFor(aFrame);
return NS_OK;
}
#ifdef IBMBIDI
@ -5502,8 +5456,7 @@ NS_IMETHODIMP
PresShell::BidiStyleChangeReflow()
{
// Have the root frame's style context remap its style
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
mStyleSet->ClearStyleData(mPresContext);
ReconstructFrames();
@ -6340,8 +6293,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
if (0 != mReflowCommands.Count()) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsIRenderingContext* rcx;
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
nsSize maxSize = rootFrame->GetSize();
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
@ -6765,21 +6717,21 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
// verify that neither frame has a space manager,
// or they both do and the space managers are equivalent
nsCOMPtr<nsIFrameManager>fm1;
nsSpaceManager *sm1;
nsIPresShell *ps1 = aFirstPresContext->PresShell();
ps1->GetFrameManager(getter_AddRefs(fm1));
nsFrameManager *fm1 = aFirstPresContext->FrameManager();
NS_ASSERTION(fm1, "no frame manager for primary tree!");
fm1->GetFrameProperty((nsIFrame*)k1, nsLayoutAtoms::spaceManagerProperty,
0, (void **)&sm1);
nsSpaceManager *sm1 =
NS_STATIC_CAST(nsSpaceManager*, fm1->GetFrameProperty(k1,
nsLayoutAtoms::spaceManagerProperty, 0));
// look at the test frame
nsCOMPtr<nsIFrameManager>fm2;
nsSpaceManager *sm2;
nsIPresShell *ps2 = aSecondPresContext->PresShell();
ps2->GetFrameManager(getter_AddRefs(fm2));
nsFrameManager *fm2 = aSecondPresContext->FrameManager();
NS_ASSERTION(fm2, "no frame manager for test tree!");
fm2->GetFrameProperty((nsIFrame*)k2, nsLayoutAtoms::spaceManagerProperty,
0, (void **)&sm2);
nsSpaceManager *sm2 =
NS_STATIC_CAST(nsSpaceManager*, fm2->GetFrameProperty(k2,
nsLayoutAtoms::spaceManagerProperty, 0));
// now compare the space managers
if (((nsnull == sm1) && (nsnull != sm2)) ||
((nsnull != sm1) && (nsnull == sm2))) { // one is null, and the other is not
@ -7093,8 +7045,7 @@ PresShell::VerifyIncrementalReflow()
// Now that the document has been reflowed, use its frame tree to
// compare against our frame tree.
nsIFrame* root1;
GetRootFrame(&root1);
nsIFrame* root1 = mFrameManager->GetRootFrame();
nsIFrame* root2;
sh->GetRootFrame(&root2);
PRBool ok = CompareTrees(mPresContext, root1, cx, root2);

View File

@ -44,7 +44,6 @@ nsICaret.h \
nsIFocusTracker.h \
nsIFrame.h \
nsIFrameDebug.h \
nsIFrameManager.h \
nsIFrameSelection.h \
nsIFrameTraversal.h \
nsIFrameUtil.h \

View File

@ -1,248 +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 nsIFrameManager_h___
#define nsIFrameManager_h___
#include "nsISupports.h"
#include "nsIStatefulFrame.h"
#include "nsString.h"
#include "nsChangeHint.h"
#include "nsIFrame.h"
class nsIAtom;
class nsIContent;
class nsIPresContext;
class nsIPresShell;
class nsStyleSet;
class nsStyleContext;
class nsILayoutHistoryState;
class nsStyleChangeList;
class nsPlaceholderFrame;
#define NS_IFRAMEMANAGER_IID \
{ 0xa6cf9107, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
// Option flags for GetFrameProperty() member function
#define NS_IFRAME_MGR_REMOVE_PROP 0x0001
/**
* Frame manager interface. The frame manager serves two purposes:
* <li>provides a service for mapping from content to frame and from out-of-flow
* frame to placeholder frame.
* <li>handles structural modifications to the frame model. If the frame model
* lock can be acquired, then the changes are processed immediately; otherwise,
* they're queued and processed later.
*/
class nsIFrameManager : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFRAMEMANAGER_IID)
// Initialization
NS_IMETHOD Init(nsIPresShell* aPresShell, nsStyleSet* aStyleSet) = 0;
/**
* After Destroy is called, all methods should return
* NS_ERROR_NOT_AVAILABLE. Destroy should be called when the
* frame tree managed by the frame manager is no longer being
* displayed.
*/
NS_IMETHOD Destroy() = 0;
// Gets and sets the root frame (typically the viewport). The lifetime of the
// root frame is controlled by the frame manager. When the frame manager is
// destroyed it destroys the entire frame hierarchy.
NS_IMETHOD GetRootFrame(nsIFrame** aRootFrame) const = 0;
NS_IMETHOD SetRootFrame(nsIFrame* aRootFrame) = 0;
// Get the canvas frame. The canvas frame may or may not exist, so the
// argument aCanvasFrame may be nsnull.
NS_IMETHOD GetCanvasFrame(nsIFrame** aCanvasFrame) const = 0;
// Primary frame functions
NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aPrimaryFrame) = 0;
NS_IMETHOD SetPrimaryFrameFor(nsIContent* aContent,
nsIFrame* aPrimaryFrame) = 0;
NS_IMETHOD ClearPrimaryFrameMap() = 0;
// Placeholder frame functions
NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame** aPlaceholderFrame) const = 0;
NS_IMETHOD RegisterPlaceholderFrame(nsPlaceholderFrame *aPlaceholderFrame) = 0;
NS_IMETHOD UnregisterPlaceholderFrame(nsPlaceholderFrame *aPlaceholderFrame) = 0;
NS_IMETHOD ClearPlaceholderFrameMap() = 0;
// Mapping undisplayed content
virtual nsStyleContext* GetUndisplayedContent(nsIContent* aContent) = 0;
virtual void SetUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext) = 0;
virtual void ChangeUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext) = 0;
NS_IMETHOD ClearUndisplayedContentIn(nsIContent* aContent, nsIContent* aParentContent) = 0;
NS_IMETHOD ClearAllUndisplayedContentIn(nsIContent* aParentContent) = 0;
NS_IMETHOD ClearUndisplayedContentMap() = 0;
// Functions for manipulating the frame model
NS_IMETHOD AppendFrames(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aFrameList) = 0;
NS_IMETHOD InsertFrames(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList) = 0;
NS_IMETHOD RemoveFrame(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame) = 0;
NS_IMETHOD ReplaceFrame(nsIFrame* aParentFrame,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame) = 0;
// Notification that we were unable to render a replaced element
NS_IMETHOD CantRenderReplacedElement(nsIFrame* aFrame) = 0;
// Notification that a frame is about to be destroyed. This allows any outstanding
// references to the frame to be cleaned up
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
// reparent the style contexts of this frame sub tree to live under the
// new given parent style context. The StyleContextParent of aFrame
// should be changed _before_ this method is called, so that style tree
// verification can take place correctly.
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
nsStyleContext* aNewParentContext) = 0;
// Re-resolve style contexts for frame tree
NS_IMETHOD ComputeStyleChangeFor(nsIFrame* aFrame,
nsStyleChangeList& aChangeList,
nsChangeHint aMinChange,
nsChangeHint& aTopLevelChange) = 0;
// Determine whether an attribute affects style
NS_IMETHOD HasAttributeDependentStyle(nsIContent *aContent,
nsIAtom *aAttribute,
PRInt32 aModType,
nsReStyleHint *aResult) = 0;
/**
* Capture/restore frame state for the frame subtree rooted at aFrame.
* aState is the document state storage object onto which each frame
* stores its state.
*/
NS_IMETHOD CaptureFrameState(nsIFrame* aFrame,
nsILayoutHistoryState* aState) = 0;
NS_IMETHOD RestoreFrameState(nsIFrame* aFrame,
nsILayoutHistoryState* aState) = 0;
// Add/restore state for one frame (special, global type, like scroll position)
NS_IMETHOD CaptureFrameStateFor(nsIFrame* aFrame,
nsILayoutHistoryState* aState,
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
NS_IMETHOD RestoreFrameStateFor(nsIFrame* aFrame,
nsILayoutHistoryState* aState,
nsIStatefulFrame::SpecialStateID aID = nsIStatefulFrame::eNoID) = 0;
/**
* Gets a property value for a given frame.
*
* @param aFrame the frame with the property
* @param aPropertyName property name as an atom
* @param aOptions optional flags
* NS_IFRAME_MGR_REMOVE_PROP removes the property
* @param aPropertyValue the property value or 0 if the property is not set
* @return NS_OK if the property is set,
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
*/
NS_IMETHOD GetFrameProperty(nsIFrame* aFrame,
nsIAtom* aPropertyName,
PRUint32 aOptions,
void** aPropertyValue) = 0;
/**
* Sets the property value for a given frame.
*
* A frame may only have one property value at a time for a given property
* name. The existing property value (if there is one) is overwritten, and the
* old value destroyed
*
* @param aFrame the frame to set the property on
* @param aPropertyName property name as an atom
* @param aPropertyValue the property value
* @param aPropertyDtorFunc when setting a property you can specify the
* dtor function (can be NULL) that will be used
* to destroy the property value. There can be only
* one dtor function for a given property name
* @return NS_OK if successful,
* NS_IFRAME_MGR_PROP_OVERWRITTEN if there is an existing property
* value that was overwritten,
* NS_ERROR_INVALID_ARG if the dtor function does not match the
* existing dtor function
*/
NS_IMETHOD SetFrameProperty(nsIFrame* aFrame,
nsIAtom* aPropertyName,
void* aPropertyValue,
NSFramePropertyDtorFunc aPropertyDtorFunc) = 0;
/**
* Removes a property and destroys its property value by calling the dtor
* function associated with the property name.
*
* When a frame is destroyed any remaining properties are automatically removed
*
* @param aFrame the frame to set the property on
* @param aPropertyName property name as an atom
* @return NS_OK if the property is successfully removed,
* NS_IFRAME_MGR_PROP_NOT_THERE if the property is not set
*/
NS_IMETHOD RemoveFrameProperty(nsIFrame* aFrame,
nsIAtom* aPropertyName) = 0;
#ifdef NS_DEBUG
/**
* DEBUG ONLY method to verify integrity of style tree versus frame tree
*/
NS_IMETHOD DebugVerifyStyleTree(nsIFrame* aFrame) = 0;
#endif
};
/**
* Create a frame manager. Upon success, call Init() before attempting to
* use it.
*/
nsresult
NS_NewFrameManager(nsIFrameManager** aInstancePtrResult);
#endif /* nsIFrameManager_h___ */

View File

@ -61,7 +61,7 @@ class nsIDocument;
class nsIDeviceContext;
class nsIFontMetrics;
class nsIFrame;
class nsIFrameManager;
class nsFrameManager;
class nsIImage;
class nsILinkHandler;
class nsIPresShell;
@ -145,9 +145,10 @@ public:
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
#ifdef _IMPL_NS_LAYOUT
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
nsFrameManager* FrameManager()
{ return GetPresShell()->FrameManager(); }
#endif
nsIFrameManager* GetFrameManager()
{ return GetPresShell()->GetFrameManager(); }
/**
* Access compatibility mode for this context

View File

@ -63,7 +63,7 @@ class nsStringArray;
class nsICaret;
class nsStyleContext;
class nsIFrameSelection;
class nsIFrameManager;
class nsFrameManager;
class nsILayoutHistoryState;
class nsIReflowCallback;
class nsISupportsArray;
@ -163,10 +163,10 @@ public:
{
return mFrameConstructor;
}
#endif
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const = 0;
nsIFrameManager* GetFrameManager() { return mFrameManager; }
nsFrameManager* FrameManager() { return mFrameManager; }
#endif
NS_IMETHOD GetActiveAlternateStyleSheet(nsString& aSheetTitle) = 0;
@ -658,7 +658,7 @@ protected:
nsStyleSet* mStyleSet; // [OWNS]
nsCSSFrameConstructor* mFrameConstructor; // [OWNS]
nsIViewManager* mViewManager; // [WEAK] docViewer owns it so I don't have to
nsIFrameManager* mFrameManager; // [STRONG]
nsFrameManager* mFrameManager; // [OWNS]
};
/**

View File

@ -61,7 +61,7 @@ class nsIDocument;
class nsIDeviceContext;
class nsIFontMetrics;
class nsIFrame;
class nsIFrameManager;
class nsFrameManager;
class nsIImage;
class nsILinkHandler;
class nsIPresShell;
@ -145,9 +145,10 @@ public:
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
#ifdef _IMPL_NS_LAYOUT
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
nsFrameManager* FrameManager()
{ return GetPresShell()->FrameManager(); }
#endif
nsIFrameManager* GetFrameManager()
{ return GetPresShell()->GetFrameManager(); }
/**
* Access compatibility mode for this context

View File

@ -46,7 +46,7 @@
#include "nsIPresContext.h"
#include "nsIRenderingContext.h"
#include "nsIServiceManager.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsBidiFrames.h"
#include "nsBidiUtils.h"
@ -810,25 +810,24 @@ nsBidiPresUtils::RemoveBidiContinuation(nsIPresContext* aPresContext,
nsIFrame* thisFramesNextBidiFrame;
nsIFrame* previousFramesNextBidiFrame;
nsIFrameManager* frameManager = presShell->GetFrameManager();
if (frameManager) {
frameManager->GetFrameProperty(aFrame, nsLayoutAtoms::nextBidi,
0, (void**) &thisFramesNextBidiFrame);
if (thisFramesNextBidiFrame) {
// Remove nextBidi property, associated with the current frame
// and with all of its prev-in-flow.
frame = aFrame;
do {
frameManager->RemoveFrameProperty(frame, nsLayoutAtoms::nextBidi);
frame->GetPrevInFlow(&frame);
if (!frame) {
break;
}
frameManager->GetFrameProperty(frame, nsLayoutAtoms::nextBidi,
0, (void**) &previousFramesNextBidiFrame);
} while (thisFramesNextBidiFrame == previousFramesNextBidiFrame);
} // if (thisFramesNextBidiFrame)
} // if (frameManager)
nsFrameManager* frameManager = presShell->FrameManager();
thisFramesNextBidiFrame = NS_STATIC_CAST(nsIFrame*,
frameManager->GetFrameProperty(aFrame, nsLayoutAtoms::nextBidi, 0));
if (thisFramesNextBidiFrame) {
// Remove nextBidi property, associated with the current frame
// and with all of its prev-in-flow.
frame = aFrame;
do {
frameManager->RemoveFrameProperty(frame, nsLayoutAtoms::nextBidi);
frame->GetPrevInFlow(&frame);
if (!frame) {
break;
}
previousFramesNextBidiFrame = NS_STATIC_CAST(nsIFrame*,
frameManager->GetFrameProperty(frame, nsLayoutAtoms::nextBidi, 0));
} while (thisFramesNextBidiFrame == previousFramesNextBidiFrame);
} // if (thisFramesNextBidiFrame)
}
nsresult

View File

@ -41,7 +41,6 @@
#include "nsILinkHandler.h"
#include "nsIDocShellTreeItem.h"
#include "nsStyleSet.h"
#include "nsIFrameManager.h"
#include "nsImageLoader.h"
#include "nsIContent.h"
#include "nsIFrame.h"

View File

@ -39,7 +39,7 @@
#include "nsReadableUtils.h"
#include "nsComboboxControlFrame.h"
#include "nsIDOMEventReceiver.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsFormControlFrame.h"
#include "nsIHTMLContent.h"
#include "nsHTMLAtoms.h"
@ -2038,13 +2038,8 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
nsCOMPtr<nsIContent> content(do_QueryInterface(mDisplayContent));
mTextFrame->Init(aPresContext, content, mDisplayFrame, textStyleContext, nsnull);
mTextFrame->SetInitialChildList(aPresContext, nsnull, nsnull);
nsIPresShell *presShell = aPresContext->GetPresShell();
if (!presShell) { return NS_ERROR_NULL_POINTER; }
nsCOMPtr<nsIFrameManager> frameManager;
rv = presShell->GetFrameManager(getter_AddRefs(frameManager));
if (NS_FAILED(rv)) { return rv; }
if (!frameManager) { return NS_ERROR_NULL_POINTER; }
frameManager->SetPrimaryFrameFor(content, mTextFrame);
aPresContext->FrameManager()->SetPrimaryFrameFor(content, mTextFrame);
rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
if (NS_FAILED(rv)) { return rv; }

View File

@ -65,7 +65,7 @@
#include "nsIDocument.h"
#include "nsButtonFrameRenderer.h"
#include "nsFormControlFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsINameSpaceManager.h"
#include "nsReflowPath.h"
#include "nsIServiceManager.h"
@ -219,7 +219,7 @@ nsHTMLButtonControlFrame::GetValue(nsAString* aResult)
}
void
nsHTMLButtonControlFrame::ReParentFrameList(nsIFrameManager* aFrameManager,
nsHTMLButtonControlFrame::ReParentFrameList(nsFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
// get the new parent context from the first child: that is the
@ -333,7 +333,7 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame* aChildList)
{
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
ReParentFrameList(aPresContext->GetFrameManager(), aChildList);
ReParentFrameList(aPresContext->FrameManager(), aChildList);
return mFrames.FirstChild()->SetInitialChildList(aPresContext, nsnull, aChildList);
}
@ -719,7 +719,7 @@ nsHTMLButtonControlFrame::AppendFrames(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
ReParentFrameList(aPresContext->FrameManager(), aFrameList);
return mFrames.FirstChild()->AppendFrames(aPresContext,
aPresShell,
aListName,
@ -733,7 +733,7 @@ nsHTMLButtonControlFrame::InsertFrames(nsIPresContext* aPresContext,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
ReParentFrameList(aPresContext->FrameManager(), aFrameList);
return mFrames.FirstChild()->InsertFrames(aPresContext,
aPresShell,
aListName,
@ -760,7 +760,7 @@ nsHTMLButtonControlFrame::ReplaceFrame(nsIPresContext* aPresContext,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
ReParentFrameList(aPresContext->GetFrameManager(), aNewFrame);
ReParentFrameList(aPresContext->FrameManager(), aNewFrame);
return mFrames.FirstChild()->ReplaceFrame(aPresContext,
aPresShell,
aListName,

View File

@ -171,7 +171,7 @@ public:
NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight);
protected:
void ReParentFrameList(nsIFrameManager* aFrameManager, nsIFrame* aFrameList);
void ReParentFrameList(nsFrameManager* aFrameManager, nsIFrame* aFrameList);
virtual PRBool IsReset(PRInt32 type);
virtual PRBool IsSubmit(PRInt32 type);
void ReflowButtonContents(nsIPresContext* aPresContext,

View File

@ -43,7 +43,6 @@
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIFrameManager.h"
#ifdef DEBUG
#include "nsBlockFrame.h"

View File

@ -40,7 +40,6 @@
#include "nsHTMLReflowState.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIFrameManager.h"
#include "nsLayoutAtoms.h"
#include "nsVoidArray.h"

View File

@ -49,7 +49,7 @@
#include "nsLineLayout.h"
#include "nsPlaceholderFrame.h"
#include "nsStyleConsts.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsReflowPath.h"
@ -897,17 +897,13 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
// this is a leak of the space manager, but it's only in debug if verify reflow is enabled, so not a big deal
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
rv = frameManager->SetFrameProperty(
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
rv = shell->FrameManager()->SetFrameProperty(
this, nsLayoutAtoms::spaceManagerProperty,
reflowState.mSpaceManager,
nsnull /* should be nsSpaceManagerDestroyer*/);
autoSpaceManager.DebugOrphanSpaceManager();
}
autoSpaceManager.DebugOrphanSpaceManager();
}
}
#endif

View File

@ -41,7 +41,7 @@
#include "nsSpaceManager.h"
#include "nsIFontMetrics.h"
#include "nsIPresContext.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIContent.h"
#include "nsStyleContext.h"
#include "nsHTMLReflowCommand.h"
@ -382,11 +382,13 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
aComputedOffsets = aFrameRS.mComputedOffsets;
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
nsIFrameManager *frameManager = mPresContext->GetFrameManager();
nsPoint *offsets;
frameManager->GetFrameProperty(mFrame,
nsLayoutAtoms::computedOffsetProperty, 0,
(void**)&offsets);
nsFrameManager *frameManager = mPresContext->FrameManager();
nsPoint *offsets = NS_STATIC_CAST(nsPoint*,
frameManager->GetFrameProperty(mFrame,
nsLayoutAtoms::computedOffsetProperty,
0));
if (offsets)
offsets->MoveTo(aComputedOffsets.left, aComputedOffsets.top);
else {

View File

@ -46,7 +46,7 @@
#include "nsIPresContext.h"
#include "nsLayoutAtoms.h"
#include "nsIFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsINameSpaceManager.h"
#include "nsHTMLAtoms.h"
@ -494,9 +494,11 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
// accordingly so that we consider relatively positioned frames
// at their original position.
if (NS_STYLE_POSITION_RELATIVE == kid->GetStyleDisplay()->mPosition) {
nsPoint *offsets;
if (NS_OK == mPresContext->GetFrameManager()->GetFrameProperty(kid,
nsLayoutAtoms::computedOffsetProperty, 0, (void**)&offsets)) {
nsPoint *offsets = NS_STATIC_CAST(nsPoint*,
mPresContext->FrameManager()->GetFrameProperty(kid,
nsLayoutAtoms::computedOffsetProperty, 0));
if (offsets) {
tx -= offsets->x;
ty -= offsets->y;
}
@ -953,15 +955,14 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
if (prevInFlow) {
prevRect = prevInFlow->GetRect();
nsCOMPtr<nsIFrameManager> frameManager;
mPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *placeParentPrev, *prevPlace;
// If prevInFlow's placeholder is in a block that wasn't continued, we need to adjust
// prevRect.x to account for the missing frame offsets.
nsIFrame* placeParent = placeholder->GetParent();
placeParent->GetPrevInFlow(&placeParentPrev);
frameManager->GetPlaceholderFrameFor(prevInFlow, &prevPlace);
prevPlace =
mPresContext->FrameManager()->GetPlaceholderFrameFor(prevInFlow);
nsIFrame* prevPlaceParent = prevPlace->GetParent();
for (nsIFrame* ancestor = prevPlaceParent;

View File

@ -50,7 +50,7 @@
#include "nsVoidArray.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLContainerFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"
#include "nsLayoutAtoms.h"
@ -1120,26 +1120,14 @@ nsIFrame*
nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty) const
{
nsIPresShell *presShell = aPresContext->GetPresShell();
PRUint32 options = 0;
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
PRUint32 options = 0;
void* value;
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowProperty,
options, &value);
return (nsIFrame*)value;
}
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
return nsnull;
return (nsIFrame*) aPresContext->FrameManager()->
GetFrameProperty(this, nsLayoutAtoms::overflowProperty, options);
}
// Destructor function for the overflow frame property
@ -1160,22 +1148,12 @@ nsresult
nsContainerFrame::SetOverflowFrames(nsIPresContext* aPresContext,
nsIFrame* aOverflowFrames)
{
nsresult rv = NS_ERROR_FAILURE;
nsresult rv = aPresContext->FrameManager()->
SetFrameProperty(this, nsLayoutAtoms::overflowProperty,
aOverflowFrames, DestroyOverflowFrames);
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
rv = frameManager->SetFrameProperty(this, nsLayoutAtoms::overflowProperty,
aOverflowFrames, DestroyOverflowFrames);
// Verify that we didn't overwrite an existing overflow list
NS_ASSERTION(rv != NS_IFRAME_MGR_PROP_OVERWRITTEN,
"existing overflow list");
}
}
// Verify that we didn't overwrite an existing overflow list
NS_ASSERTION(rv != NS_IFRAME_MGR_PROP_OVERWRITTEN, "existing overflow list");
return rv;
}

View File

@ -44,7 +44,7 @@
#include "nsLayoutAtoms.h"
#include "nsAutoPtr.h"
#include "nsStyleSet.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#define nsFirstLetterFrameSuper nsHTMLContainerFrame
@ -161,7 +161,7 @@ nsFirstLetterFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame* aChildList)
{
mFrames.SetFrames(aChildList);
nsIFrameManager *frameManager = aPresContext->GetFrameManager();
nsFrameManager *frameManager = aPresContext->FrameManager();
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
frameManager->ReParentStyleContext(frame, mStyleContext);

View File

@ -57,7 +57,7 @@
#include "prlog.h"
#include "prprf.h"
#include <stdarg.h>
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsCSSRendering.h"
#ifdef ACCESSIBILITY
#include "nsIAccessible.h"
@ -2287,10 +2287,10 @@ nsIFrame::GetView() const
return nsnull;
// Check for a property on the frame
void* value;
nsresult rv = GetPresContext()->GetFrameManager()->
GetFrameProperty(NS_CONST_CAST(nsIFrame*, this),
nsLayoutAtoms::viewProperty, 0, &value);
nsresult rv;
void* value = GetPresContext()->FrameManager()->
GetFrameProperty(this, nsLayoutAtoms::viewProperty, 0, &rv);
NS_ENSURE_SUCCESS(rv, nsnull);
NS_ASSERTION(value, "frame state bit was set but frame has no view");
return NS_STATIC_CAST(nsIView*, value);
@ -2309,7 +2309,7 @@ nsIFrame::SetView(nsIView* aView)
aView->SetClientData(this);
// Set a property on the frame
nsresult rv = GetPresContext()->GetFrameManager()->
nsresult rv = GetPresContext()->FrameManager()->
SetFrameProperty(this, nsLayoutAtoms::viewProperty, aView, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
@ -3694,22 +3694,11 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
//if we are searching for a frame that is not in flow we will not find it.
//we must instead look for its placeholder
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell)
{
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager)
{
result = frameManager->GetPlaceholderFrameFor(thisBlock, &thisBlock);
if (!thisBlock)
return NS_ERROR_FAILURE;
if (NS_FAILED(result))
return result;
}
}
thisBlock =
aPresContext->FrameManager()->GetPlaceholderFrameFor(thisBlock);
if (!thisBlock)
return NS_ERROR_FAILURE;
}
result = iter->FindLineContaining(thisBlock, &thisLine);
@ -4249,30 +4238,23 @@ nsFrame::GetOverflowAreaProperty(nsIPresContext* aPresContext,
if (!((GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) || aCreateIfNecessary)) {
return nsnull;
}
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowAreaProperty,
0, &value);
if (value) {
return (nsRect*)value; // the property already exists
nsFrameManager *frameManager = aPresContext->FrameManager();
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new rect, set the property,
// and return the newly allocated rect
nsRect* overflow = new nsRect(0, 0, 0, 0);
void *value =
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowAreaProperty,
0);
frameManager->SetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowAreaProperty,
overflow, DestroyRectFunc);
return overflow;
}
}
if (value) {
return (nsRect*)value; // the property already exists
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new rect, set the property,
// and return the newly allocated rect
nsRect* overflow = new nsRect(0, 0, 0, 0);
frameManager->SetFrameProperty(this, nsLayoutAtoms::overflowAreaProperty,
overflow, DestroyRectFunc);
return overflow;
}
return nsnull;
@ -4296,14 +4278,8 @@ nsFrame::StoreOverflow(nsIPresContext* aPresContext,
else {
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
// remove the previously stored overflow area
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
frameManager->RemoveFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowAreaProperty);
}
}
aPresContext->FrameManager()->
RemoveFrameProperty(this, nsLayoutAtoms::overflowAreaProperty);
}
mState &= ~NS_FRAME_OUTSIDE_CHILDREN;
}
@ -4363,13 +4339,11 @@ GetIBSpecialSibling(nsIPresContext* aPresContext,
* property, which is only set on the anonymous block frames we're
* interested in.
*/
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *specialSibling;
nsresult rv =
frameManager->GetFrameProperty(aFrame,
nsLayoutAtoms::IBSplitSpecialPrevSibling,
0, (void**)&specialSibling);
nsresult rv;
nsIFrame *specialSibling = NS_STATIC_CAST(nsIFrame*,
aPresContext->FrameManager()->GetFrameProperty(aFrame,
nsLayoutAtoms::IBSplitSpecialPrevSibling, 0, &rv));
if (NS_OK == rv) {
NS_ASSERTION(specialSibling, "null special sibling");
*aSpecialSibling = specialSibling;
@ -4467,10 +4441,8 @@ nsFrame::DoGetParentStyleContextFrame(nsIPresContext* aPresContext,
// For out-of-flow frames, we must resolve underneath the
// placeholder's parent.
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *placeholder;
frameManager->GetPlaceholderFrameFor(this, &placeholder);
nsIFrame *placeholder =
aPresContext->FrameManager()->GetPlaceholderFrameFor(this);
if (!placeholder) {
NS_NOTREACHED("no placeholder frame for out-of-flow frame");
GetCorrectedParent(aPresContext, this, aProviderFrame);
@ -4594,18 +4566,9 @@ nsFrame::SetProperty(nsIPresContext* aPresContext,
void* aPropValue,
NSFramePropertyDtorFunc aPropDtorFunc)
{
nsresult rv = NS_ERROR_FAILURE;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
rv = frameManager->SetFrameProperty(this, aPropName, aPropValue, aPropDtorFunc);
}
}
return rv;
return aPresContext->FrameManager()->SetFrameProperty(this, aPropName,
aPropValue,
aPropDtorFunc);
}
void*
@ -4613,25 +4576,15 @@ nsFrame::GetProperty(nsIPresContext* aPresContext,
nsIAtom* aPropName,
PRBool aRemoveProp) const
{
void* value = nsnull;
PRUint32 options = 0;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
PRUint32 options = 0;
if (aRemoveProp) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty((nsIFrame*)this, aPropName, options, &value);
}
if (aRemoveProp) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
return value;
return aPresContext->FrameManager()->GetFrameProperty(this, aPropName,
options);
}
/* virtual */ const nsStyleStruct*
@ -4660,26 +4613,18 @@ NS_IMETHODIMP nsFrame::GetBidiProperty(nsIPresContext* aPresContext,
}
memset(aPropertyValue, 0, aSize);
void* val = nsnull;
void* val = aPresContext->FrameManager()->GetFrameProperty(this,
aPropertyName, 0);
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager) );
if (frameManager) {
frameManager->GetFrameProperty( (nsIFrame*)this, aPropertyName, 0, &val);
if (val) {
// to fix bidi on big endian. We need to copy the right bytes from the void*, not the first aSize bytes.
if (val) {
// to fix bidi on big endian. We need to copy the right bytes from the void*, not the first aSize bytes.
#if IS_BIG_ENDIAN
memcpy(aPropertyValue, ((char*)&val)+sizeof(void*) - aSize, aSize);
memcpy(aPropertyValue, ((char*)&val)+sizeof(void*) - aSize, aSize);
#else
memcpy(aPropertyValue, &val, aSize);
memcpy(aPropertyValue, &val, aSize);
#endif
}
}
}
return NS_OK;
}
@ -4687,17 +4632,9 @@ NS_IMETHODIMP nsFrame::SetBidiProperty(nsIPresContext* aPresContext,
nsIAtom* aPropertyName,
void* aPropertyValue)
{
nsresult rv = NS_ERROR_FAILURE;
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager) );
if (frameManager) {
rv = frameManager->SetFrameProperty( (nsIFrame*) this, aPropertyName, aPropertyValue, nsnull);
}
}
return rv;
return aPresContext->FrameManager()->SetFrameProperty(this, aPropertyName,
aPropertyValue,
nsnull);
}
#endif // IBMBIDI

View File

@ -50,7 +50,7 @@
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIComponentManager.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
@ -243,23 +243,14 @@ nsSubDocumentFrame::Init(nsIPresContext* aPresContext,
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
nsIFrame* contentParent = nsnull;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
rv = frameManager->GetFrameProperty(this,
contentParentAtom,
NS_IFRAME_MGR_REMOVE_PROP,
&value);
if (NS_SUCCEEDED(rv)) {
void *value =
aPresContext->FrameManager()->GetFrameProperty(this, contentParentAtom,
NS_IFRAME_MGR_REMOVE_PROP,
&rv);
if (NS_SUCCEEDED(rv)) {
contentParent = (nsIFrame*)value;
}
}
}
nsHTMLContainerFrame::CreateViewForFrame(this, contentParent, PR_TRUE);
}
nsIView* view = GetView();

View File

@ -73,7 +73,6 @@
#include "nsIDOMHTMLMapElement.h"
#include "nsLayoutAtoms.h"
#include "nsImageMapUtils.h"
#include "nsIFrameManager.h"
#include "nsIScriptSecurityManager.h"
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"

View File

@ -57,7 +57,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIViewManager.h"
#include "nsCoord.h"
#include "nsIImageMap.h"
@ -748,8 +748,7 @@ nsImageMap::GetBoundsForAreaContent(nsIContent *aContent,
void
nsImageMap::FreeAreas()
{
nsCOMPtr<nsIFrameManager> frameManager;
mPresShell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = mPresShell->FrameManager();
PRInt32 i, n = mAreas.Count();
for (i = 0; i < n; i++) {
@ -859,9 +858,7 @@ nsImageMap::AddArea(nsIContent* aArea)
rec->AddEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
}
nsCOMPtr<nsIFrameManager> frameManager;
mPresShell->GetFrameManager(getter_AddRefs(frameManager));
frameManager->SetPrimaryFrameFor(aArea, mImageFrame);
mPresShell->FrameManager()->SetPrimaryFrameFor(aArea, mImageFrame);
Area* area;
if (shape.IsEmpty() ||

View File

@ -49,7 +49,7 @@
#include "nsCSSAnonBoxes.h"
#include "nsReflowPath.h"
#include "nsAutoPtr.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#ifdef ACCESSIBILITY
#include "nsIServiceManager.h"
#include "nsIAccessibilityService.h"
@ -910,7 +910,7 @@ ReParentChildListStyle(nsIPresContext* aPresContext,
nsStyleContext* aParentStyleContext,
nsFrameList& aFrameList)
{
nsIFrameManager *frameManager = aPresContext->GetFrameManager();
nsFrameManager *frameManager = aPresContext->FrameManager();
for (nsIFrame* kid = aFrameList.FirstChild(); kid;
kid = kid->GetNextSibling()) {
@ -970,8 +970,7 @@ nsFirstLineFrame::PullOneFrame(nsIPresContext* aPresContext, InlineReflowState&
if (frame && !mPrevInFlow) {
// We are a first-line frame. Fixup the child frames
// style-context that we just pulled.
aPresContext->GetFrameManager()->ReParentStyleContext(frame,
mStyleContext);
aPresContext->FrameManager()->ReParentStyleContext(frame, mStyleContext);
}
return frame;
}

View File

@ -43,7 +43,6 @@
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsIPresContext.h"
#include "nsIFrameManager.h"
#ifdef DEBUG
#include "nsBlockFrame.h"

View File

@ -40,7 +40,6 @@
#include "nsHTMLReflowState.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIFrameManager.h"
#include "nsLayoutAtoms.h"
#include "nsVoidArray.h"

View File

@ -49,7 +49,7 @@
#include "nsLineLayout.h"
#include "nsPlaceholderFrame.h"
#include "nsStyleConsts.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsReflowPath.h"
@ -897,17 +897,13 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
// this is a leak of the space manager, but it's only in debug if verify reflow is enabled, so not a big deal
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
rv = frameManager->SetFrameProperty(
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
rv = shell->FrameManager()->SetFrameProperty(
this, nsLayoutAtoms::spaceManagerProperty,
reflowState.mSpaceManager,
nsnull /* should be nsSpaceManagerDestroyer*/);
autoSpaceManager.DebugOrphanSpaceManager();
}
autoSpaceManager.DebugOrphanSpaceManager();
}
}
#endif

View File

@ -41,7 +41,7 @@
#include "nsSpaceManager.h"
#include "nsIFontMetrics.h"
#include "nsIPresContext.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIContent.h"
#include "nsStyleContext.h"
#include "nsHTMLReflowCommand.h"
@ -382,11 +382,13 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
aComputedOffsets = aFrameRS.mComputedOffsets;
if (NS_STYLE_POSITION_RELATIVE == display->mPosition) {
nsIFrameManager *frameManager = mPresContext->GetFrameManager();
nsPoint *offsets;
frameManager->GetFrameProperty(mFrame,
nsLayoutAtoms::computedOffsetProperty, 0,
(void**)&offsets);
nsFrameManager *frameManager = mPresContext->FrameManager();
nsPoint *offsets = NS_STATIC_CAST(nsPoint*,
frameManager->GetFrameProperty(mFrame,
nsLayoutAtoms::computedOffsetProperty,
0));
if (offsets)
offsets->MoveTo(aComputedOffsets.left, aComputedOffsets.top);
else {

View File

@ -46,7 +46,7 @@
#include "nsIPresContext.h"
#include "nsLayoutAtoms.h"
#include "nsIFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsINameSpaceManager.h"
#include "nsHTMLAtoms.h"
@ -494,9 +494,11 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
// accordingly so that we consider relatively positioned frames
// at their original position.
if (NS_STYLE_POSITION_RELATIVE == kid->GetStyleDisplay()->mPosition) {
nsPoint *offsets;
if (NS_OK == mPresContext->GetFrameManager()->GetFrameProperty(kid,
nsLayoutAtoms::computedOffsetProperty, 0, (void**)&offsets)) {
nsPoint *offsets = NS_STATIC_CAST(nsPoint*,
mPresContext->FrameManager()->GetFrameProperty(kid,
nsLayoutAtoms::computedOffsetProperty, 0));
if (offsets) {
tx -= offsets->x;
ty -= offsets->y;
}
@ -953,15 +955,14 @@ nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
if (prevInFlow) {
prevRect = prevInFlow->GetRect();
nsCOMPtr<nsIFrameManager> frameManager;
mPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *placeParentPrev, *prevPlace;
// If prevInFlow's placeholder is in a block that wasn't continued, we need to adjust
// prevRect.x to account for the missing frame offsets.
nsIFrame* placeParent = placeholder->GetParent();
placeParent->GetPrevInFlow(&placeParentPrev);
frameManager->GetPlaceholderFrameFor(prevInFlow, &prevPlace);
prevPlace =
mPresContext->FrameManager()->GetPlaceholderFrameFor(prevInFlow);
nsIFrame* prevPlaceParent = prevPlace->GetParent();
for (nsIFrame* ancestor = prevPlaceParent;

View File

@ -50,7 +50,7 @@
#include "nsVoidArray.h"
#include "nsHTMLReflowCommand.h"
#include "nsHTMLContainerFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"
#include "nsLayoutAtoms.h"
@ -1120,26 +1120,14 @@ nsIFrame*
nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty) const
{
nsIPresShell *presShell = aPresContext->GetPresShell();
PRUint32 options = 0;
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
PRUint32 options = 0;
void* value;
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowProperty,
options, &value);
return (nsIFrame*)value;
}
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
return nsnull;
return (nsIFrame*) aPresContext->FrameManager()->
GetFrameProperty(this, nsLayoutAtoms::overflowProperty, options);
}
// Destructor function for the overflow frame property
@ -1160,22 +1148,12 @@ nsresult
nsContainerFrame::SetOverflowFrames(nsIPresContext* aPresContext,
nsIFrame* aOverflowFrames)
{
nsresult rv = NS_ERROR_FAILURE;
nsresult rv = aPresContext->FrameManager()->
SetFrameProperty(this, nsLayoutAtoms::overflowProperty,
aOverflowFrames, DestroyOverflowFrames);
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
rv = frameManager->SetFrameProperty(this, nsLayoutAtoms::overflowProperty,
aOverflowFrames, DestroyOverflowFrames);
// Verify that we didn't overwrite an existing overflow list
NS_ASSERTION(rv != NS_IFRAME_MGR_PROP_OVERWRITTEN,
"existing overflow list");
}
}
// Verify that we didn't overwrite an existing overflow list
NS_ASSERTION(rv != NS_IFRAME_MGR_PROP_OVERWRITTEN, "existing overflow list");
return rv;
}

View File

@ -44,7 +44,7 @@
#include "nsLayoutAtoms.h"
#include "nsAutoPtr.h"
#include "nsStyleSet.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#define nsFirstLetterFrameSuper nsHTMLContainerFrame
@ -161,7 +161,7 @@ nsFirstLetterFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame* aChildList)
{
mFrames.SetFrames(aChildList);
nsIFrameManager *frameManager = aPresContext->GetFrameManager();
nsFrameManager *frameManager = aPresContext->FrameManager();
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
frameManager->ReParentStyleContext(frame, mStyleContext);

View File

@ -57,7 +57,7 @@
#include "prlog.h"
#include "prprf.h"
#include <stdarg.h>
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsCSSRendering.h"
#ifdef ACCESSIBILITY
#include "nsIAccessible.h"
@ -2287,10 +2287,10 @@ nsIFrame::GetView() const
return nsnull;
// Check for a property on the frame
void* value;
nsresult rv = GetPresContext()->GetFrameManager()->
GetFrameProperty(NS_CONST_CAST(nsIFrame*, this),
nsLayoutAtoms::viewProperty, 0, &value);
nsresult rv;
void* value = GetPresContext()->FrameManager()->
GetFrameProperty(this, nsLayoutAtoms::viewProperty, 0, &rv);
NS_ENSURE_SUCCESS(rv, nsnull);
NS_ASSERTION(value, "frame state bit was set but frame has no view");
return NS_STATIC_CAST(nsIView*, value);
@ -2309,7 +2309,7 @@ nsIFrame::SetView(nsIView* aView)
aView->SetClientData(this);
// Set a property on the frame
nsresult rv = GetPresContext()->GetFrameManager()->
nsresult rv = GetPresContext()->FrameManager()->
SetFrameProperty(this, nsLayoutAtoms::viewProperty, aView, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
@ -3694,22 +3694,11 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
//if we are searching for a frame that is not in flow we will not find it.
//we must instead look for its placeholder
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell)
{
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager)
{
result = frameManager->GetPlaceholderFrameFor(thisBlock, &thisBlock);
if (!thisBlock)
return NS_ERROR_FAILURE;
if (NS_FAILED(result))
return result;
}
}
thisBlock =
aPresContext->FrameManager()->GetPlaceholderFrameFor(thisBlock);
if (!thisBlock)
return NS_ERROR_FAILURE;
}
result = iter->FindLineContaining(thisBlock, &thisLine);
@ -4249,30 +4238,23 @@ nsFrame::GetOverflowAreaProperty(nsIPresContext* aPresContext,
if (!((GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) || aCreateIfNecessary)) {
return nsnull;
}
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowAreaProperty,
0, &value);
if (value) {
return (nsRect*)value; // the property already exists
nsFrameManager *frameManager = aPresContext->FrameManager();
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new rect, set the property,
// and return the newly allocated rect
nsRect* overflow = new nsRect(0, 0, 0, 0);
void *value =
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowAreaProperty,
0);
frameManager->SetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowAreaProperty,
overflow, DestroyRectFunc);
return overflow;
}
}
if (value) {
return (nsRect*)value; // the property already exists
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new rect, set the property,
// and return the newly allocated rect
nsRect* overflow = new nsRect(0, 0, 0, 0);
frameManager->SetFrameProperty(this, nsLayoutAtoms::overflowAreaProperty,
overflow, DestroyRectFunc);
return overflow;
}
return nsnull;
@ -4296,14 +4278,8 @@ nsFrame::StoreOverflow(nsIPresContext* aPresContext,
else {
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
// remove the previously stored overflow area
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
frameManager->RemoveFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowAreaProperty);
}
}
aPresContext->FrameManager()->
RemoveFrameProperty(this, nsLayoutAtoms::overflowAreaProperty);
}
mState &= ~NS_FRAME_OUTSIDE_CHILDREN;
}
@ -4363,13 +4339,11 @@ GetIBSpecialSibling(nsIPresContext* aPresContext,
* property, which is only set on the anonymous block frames we're
* interested in.
*/
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *specialSibling;
nsresult rv =
frameManager->GetFrameProperty(aFrame,
nsLayoutAtoms::IBSplitSpecialPrevSibling,
0, (void**)&specialSibling);
nsresult rv;
nsIFrame *specialSibling = NS_STATIC_CAST(nsIFrame*,
aPresContext->FrameManager()->GetFrameProperty(aFrame,
nsLayoutAtoms::IBSplitSpecialPrevSibling, 0, &rv));
if (NS_OK == rv) {
NS_ASSERTION(specialSibling, "null special sibling");
*aSpecialSibling = specialSibling;
@ -4467,10 +4441,8 @@ nsFrame::DoGetParentStyleContextFrame(nsIPresContext* aPresContext,
// For out-of-flow frames, we must resolve underneath the
// placeholder's parent.
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsIFrame *placeholder;
frameManager->GetPlaceholderFrameFor(this, &placeholder);
nsIFrame *placeholder =
aPresContext->FrameManager()->GetPlaceholderFrameFor(this);
if (!placeholder) {
NS_NOTREACHED("no placeholder frame for out-of-flow frame");
GetCorrectedParent(aPresContext, this, aProviderFrame);
@ -4594,18 +4566,9 @@ nsFrame::SetProperty(nsIPresContext* aPresContext,
void* aPropValue,
NSFramePropertyDtorFunc aPropDtorFunc)
{
nsresult rv = NS_ERROR_FAILURE;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
rv = frameManager->SetFrameProperty(this, aPropName, aPropValue, aPropDtorFunc);
}
}
return rv;
return aPresContext->FrameManager()->SetFrameProperty(this, aPropName,
aPropValue,
aPropDtorFunc);
}
void*
@ -4613,25 +4576,15 @@ nsFrame::GetProperty(nsIPresContext* aPresContext,
nsIAtom* aPropName,
PRBool aRemoveProp) const
{
void* value = nsnull;
PRUint32 options = 0;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
PRUint32 options = 0;
if (aRemoveProp) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty((nsIFrame*)this, aPropName, options, &value);
}
if (aRemoveProp) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
return value;
return aPresContext->FrameManager()->GetFrameProperty(this, aPropName,
options);
}
/* virtual */ const nsStyleStruct*
@ -4660,26 +4613,18 @@ NS_IMETHODIMP nsFrame::GetBidiProperty(nsIPresContext* aPresContext,
}
memset(aPropertyValue, 0, aSize);
void* val = nsnull;
void* val = aPresContext->FrameManager()->GetFrameProperty(this,
aPropertyName, 0);
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager) );
if (frameManager) {
frameManager->GetFrameProperty( (nsIFrame*)this, aPropertyName, 0, &val);
if (val) {
// to fix bidi on big endian. We need to copy the right bytes from the void*, not the first aSize bytes.
if (val) {
// to fix bidi on big endian. We need to copy the right bytes from the void*, not the first aSize bytes.
#if IS_BIG_ENDIAN
memcpy(aPropertyValue, ((char*)&val)+sizeof(void*) - aSize, aSize);
memcpy(aPropertyValue, ((char*)&val)+sizeof(void*) - aSize, aSize);
#else
memcpy(aPropertyValue, &val, aSize);
memcpy(aPropertyValue, &val, aSize);
#endif
}
}
}
return NS_OK;
}
@ -4687,17 +4632,9 @@ NS_IMETHODIMP nsFrame::SetBidiProperty(nsIPresContext* aPresContext,
nsIAtom* aPropertyName,
void* aPropertyValue)
{
nsresult rv = NS_ERROR_FAILURE;
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager) );
if (frameManager) {
rv = frameManager->SetFrameProperty( (nsIFrame*) this, aPropertyName, aPropertyValue, nsnull);
}
}
return rv;
return aPresContext->FrameManager()->SetFrameProperty(this, aPropertyName,
aPropertyValue,
nsnull);
}
#endif // IBMBIDI

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,6 @@
#include "nsIDOMHTMLMapElement.h"
#include "nsLayoutAtoms.h"
#include "nsImageMapUtils.h"
#include "nsIFrameManager.h"
#include "nsIScriptSecurityManager.h"
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"

View File

@ -57,7 +57,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIViewManager.h"
#include "nsCoord.h"
#include "nsIImageMap.h"
@ -748,8 +748,7 @@ nsImageMap::GetBoundsForAreaContent(nsIContent *aContent,
void
nsImageMap::FreeAreas()
{
nsCOMPtr<nsIFrameManager> frameManager;
mPresShell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = mPresShell->FrameManager();
PRInt32 i, n = mAreas.Count();
for (i = 0; i < n; i++) {
@ -859,9 +858,7 @@ nsImageMap::AddArea(nsIContent* aArea)
rec->AddEventListenerByIID(this, NS_GET_IID(nsIDOMFocusListener));
}
nsCOMPtr<nsIFrameManager> frameManager;
mPresShell->GetFrameManager(getter_AddRefs(frameManager));
frameManager->SetPrimaryFrameFor(aArea, mImageFrame);
mPresShell->FrameManager()->SetPrimaryFrameFor(aArea, mImageFrame);
Area* area;
if (shape.IsEmpty() ||

View File

@ -49,7 +49,7 @@
#include "nsCSSAnonBoxes.h"
#include "nsReflowPath.h"
#include "nsAutoPtr.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#ifdef ACCESSIBILITY
#include "nsIServiceManager.h"
#include "nsIAccessibilityService.h"
@ -910,7 +910,7 @@ ReParentChildListStyle(nsIPresContext* aPresContext,
nsStyleContext* aParentStyleContext,
nsFrameList& aFrameList)
{
nsIFrameManager *frameManager = aPresContext->GetFrameManager();
nsFrameManager *frameManager = aPresContext->FrameManager();
for (nsIFrame* kid = aFrameList.FirstChild(); kid;
kid = kid->GetNextSibling()) {
@ -970,8 +970,7 @@ nsFirstLineFrame::PullOneFrame(nsIPresContext* aPresContext, InlineReflowState&
if (frame && !mPrevInFlow) {
// We are a first-line frame. Fixup the child frames
// style-context that we just pulled.
aPresContext->GetFrameManager()->ReParentStyleContext(frame,
mStyleContext);
aPresContext->FrameManager()->ReParentStyleContext(frame, mStyleContext);
}
return frame;
}

View File

@ -98,7 +98,7 @@
#include "nsIDOMNSHTMLInputElement.h" //optimization for ::DoXXX commands
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsViewsCID.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsILayoutHistoryState.h"
@ -1119,8 +1119,6 @@ public:
NS_IMETHOD SetIgnoreFrameDestruction(PRBool aIgnore);
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame);
NS_IMETHOD GetFrameManager(nsIFrameManager** aFrameManager) const;
NS_IMETHOD DoCopy();
NS_IMETHOD GetLinkLocation(nsIDOMNode* aNode, nsAString& aLocationString);
NS_IMETHOD GetImageLocation(nsIDOMNode* aNode, nsAString& aLocationString);
@ -1439,12 +1437,10 @@ PRLogModuleInfo* PresShell::gLog;
#ifdef NS_DEBUG
static void
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager)
VerifyStyleTree(nsIPresContext* aPresContext, nsFrameManager* aFrameManager)
{
if (aFrameManager && nsIFrameDebug::GetVerifyStyleTreeEnable()) {
nsIFrame* rootFrame;
aFrameManager->GetRootFrame(&rootFrame);
if (nsIFrameDebug::GetVerifyStyleTreeEnable()) {
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
aFrameManager->DebugVerifyStyleTree(rootFrame);
}
}
@ -1711,14 +1707,12 @@ PresShell::Init(nsIDocument* aDocument,
return result;
// Create and initialize the frame manager
result = NS_NewFrameManager(&mFrameManager);
if (NS_FAILED(result)) {
return result;
mFrameManager = new nsFrameManager();
if (!mFrameManager) {
return NS_ERROR_OUT_OF_MEMORY;
}
result = mFrameManager->Init(this, mStyleSet);
if (NS_FAILED(result)) {
return result;
}
NS_ENSURE_SUCCESS(result, result);
result = mSelection->Init((nsIFocusTracker *) this, nsnull);
if (NS_FAILED(result))
@ -1877,7 +1871,8 @@ PresShell::Destroy()
// Destroy the frame manager. This will destroy the frame hierarchy
if (mFrameManager) {
mFrameManager->Destroy();
NS_RELEASE(mFrameManager);
delete mFrameManager;
mFrameManager = nsnull;
}
// Let the style set do its cleanup.
@ -2753,8 +2748,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
nsIContent *root = mDocument ? mDocument->GetRootContent() : nsnull;
// Get the root frame from the frame manager
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (root) {
MOZ_TIMER_DEBUGLOG(("Reset and start: Frame Creation: PresShell::InitialReflow(), this=%p\n",
@ -2918,8 +2912,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
// If we don't have a root frame yet, that means we haven't had our initial
// reflow...
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
// Kick off a top-down reflow
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
@ -3078,22 +3071,12 @@ PresShell::NotifyDestroyingFrame(nsIFrame* aFrame)
CancelReflowCommandInternal(aFrame, nsnull);
// Notify the frame manager
if (mFrameManager) {
mFrameManager->NotifyDestroyingFrame(aFrame);
}
mFrameManager->NotifyDestroyingFrame(aFrame);
}
return NS_OK;
}
NS_IMETHODIMP
PresShell::GetFrameManager(nsIFrameManager** aFrameManager) const
{
*aFrameManager = mFrameManager;
NS_IF_ADDREF(mFrameManager);
return NS_OK;
}
// note that this can return a null caret, but NS_OK
NS_IMETHODIMP PresShell::GetCaret(nsICaret **outCaret)
{
@ -3444,8 +3427,7 @@ PresShell::StyleChangeReflow()
WillCauseReflow();
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
// Kick off a top-down reflow
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
@ -3514,7 +3496,8 @@ PresShell::StyleChangeReflow()
NS_IMETHODIMP
PresShell::GetRootFrame(nsIFrame** aResult) const
{
return mFrameManager->GetRootFrame(aResult);
*aResult = mFrameManager->GetRootFrame();
return NS_OK;
}
NS_IMETHODIMP
@ -3525,11 +3508,10 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
return NS_ERROR_NULL_POINTER;
}
nsIFrame* rootFrame;
nsIPageSequenceFrame* pageSequence = nsnull;
// The page sequence frame is the child of the rootFrame
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame *rootFrame = mFrameManager->GetRootFrame();
nsIFrame* child = rootFrame->GetFirstChild(nsnull);
if (nsnull != child) {
@ -3602,8 +3584,7 @@ PresShell::EndLoad(nsIDocument *aDocument)
{
// Restore frame state for the root scroll frame
nsIFrame* rootFrame = nsnull;
GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
nsCOMPtr<nsISupports> container = mPresContext->GetContainer();
if (!container)
return;
@ -3914,11 +3895,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
NS_IMETHODIMP
PresShell::CantRenderReplacedElement(nsIFrame* aFrame)
{
if (mFrameManager) {
return mFrameManager->CantRenderReplacedElement(aFrame);
}
return NS_OK;
return mFrameManager->CantRenderReplacedElement(aFrame);
}
NS_IMETHODIMP
@ -4647,25 +4624,24 @@ PresShell::CaptureHistoryState(nsILayoutHistoryState** aState, PRBool aLeavingPa
NS_IF_ADDREF(*aState);
// Capture frame state for the entire frame hierarchy
nsIFrame* rootFrame = nsnull;
rv = GetRootFrame(&rootFrame);
if (NS_FAILED(rv) || nsnull == rootFrame) return rv;
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (!rootFrame) return NS_OK;
// Capture frame state for the root scroll frame
// Don't capture state when first creating doc element heirarchy
// As the scroll position is 0 and this will cause us to loose
// our previously saved place!
if (aLeavingPage) {
nsIFrame* scrollFrame = nsnull;
rv = GetRootScrollFrame(mPresContext, rootFrame, &scrollFrame);
GetRootScrollFrame(mPresContext, rootFrame, &scrollFrame);
if (scrollFrame) {
rv = mFrameManager->CaptureFrameStateFor(scrollFrame, historyState, nsIStatefulFrame::eDocumentScrollState);
mFrameManager->CaptureFrameStateFor(scrollFrame, historyState,
nsIStatefulFrame::eDocumentScrollState);
}
}
rv = mFrameManager->CaptureFrameState(rootFrame, historyState);
mFrameManager->CaptureFrameState(rootFrame, historyState);
return rv;
return NS_OK;
}
NS_IMETHODIMP
@ -4850,16 +4826,12 @@ PresShell::UnsuppressAndInvalidate()
}
}
NS_ASSERTION(mFrameManager, "frameManager is already gone");
if (mFrameManager) {
mPaintingSuppressed = PR_FALSE;
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
if (rootFrame) {
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
mPaintingSuppressed = PR_FALSE;
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
nsRect rect = rootFrame->GetRect();
if (!rect.IsEmpty()) {
((nsFrame*)rootFrame)->Invalidate(mPresContext, rect, PR_FALSE);
}
}
@ -5337,19 +5309,13 @@ PresShell::ReconstructStyleData()
{
mStylesHaveChanged = PR_FALSE;
nsIFrame* rootFrame;
GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (!rootFrame)
return NS_OK;
nsCOMPtr<nsIFrameManager> frameManager;
GetFrameManager(getter_AddRefs(frameManager));
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
frameManager->ComputeStyleChangeFor(rootFrame, changeList,
NS_STYLE_HINT_NONE,
frameChange);
mFrameManager->ComputeStyleChangeFor(rootFrame, &changeList,
NS_STYLE_HINT_NONE);
mFrameConstructor->ProcessRestyledFrames(changeList, mPresContext);
@ -5424,17 +5390,8 @@ NS_IMETHODIMP
PresShell::GetPrimaryFrameFor(nsIContent* aContent,
nsIFrame** aResult) const
{
nsresult rv;
if (mFrameManager) {
rv = mFrameManager->GetPrimaryFrameFor(aContent, aResult);
} else {
*aResult = nsnull;
rv = NS_OK;
}
return rv;
*aResult = mFrameManager->GetPrimaryFrameFor(aContent);
return NS_OK;
}
NS_IMETHODIMP
@ -5460,11 +5417,8 @@ NS_IMETHODIMP
PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame,
nsIFrame** aResult) const
{
if (!mFrameManager) {
*aResult = nsnull;
return NS_OK;
}
return mFrameManager->GetPlaceholderFrameFor(aFrame, aResult);
*aResult = mFrameManager->GetPlaceholderFrameFor(aFrame);
return NS_OK;
}
#ifdef IBMBIDI
@ -5502,8 +5456,7 @@ NS_IMETHODIMP
PresShell::BidiStyleChangeReflow()
{
// Have the root frame's style context remap its style
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
if (rootFrame) {
mStyleSet->ClearStyleData(mPresContext);
ReconstructFrames();
@ -6340,8 +6293,7 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
if (0 != mReflowCommands.Count()) {
nsHTMLReflowMetrics desiredSize(nsnull);
nsIRenderingContext* rcx;
nsIFrame* rootFrame;
mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = mFrameManager->GetRootFrame();
nsSize maxSize = rootFrame->GetSize();
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
@ -6765,21 +6717,21 @@ CompareTrees(nsIPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
// verify that neither frame has a space manager,
// or they both do and the space managers are equivalent
nsCOMPtr<nsIFrameManager>fm1;
nsSpaceManager *sm1;
nsIPresShell *ps1 = aFirstPresContext->PresShell();
ps1->GetFrameManager(getter_AddRefs(fm1));
nsFrameManager *fm1 = aFirstPresContext->FrameManager();
NS_ASSERTION(fm1, "no frame manager for primary tree!");
fm1->GetFrameProperty((nsIFrame*)k1, nsLayoutAtoms::spaceManagerProperty,
0, (void **)&sm1);
nsSpaceManager *sm1 =
NS_STATIC_CAST(nsSpaceManager*, fm1->GetFrameProperty(k1,
nsLayoutAtoms::spaceManagerProperty, 0));
// look at the test frame
nsCOMPtr<nsIFrameManager>fm2;
nsSpaceManager *sm2;
nsIPresShell *ps2 = aSecondPresContext->PresShell();
ps2->GetFrameManager(getter_AddRefs(fm2));
nsFrameManager *fm2 = aSecondPresContext->FrameManager();
NS_ASSERTION(fm2, "no frame manager for test tree!");
fm2->GetFrameProperty((nsIFrame*)k2, nsLayoutAtoms::spaceManagerProperty,
0, (void **)&sm2);
nsSpaceManager *sm2 =
NS_STATIC_CAST(nsSpaceManager*, fm2->GetFrameProperty(k2,
nsLayoutAtoms::spaceManagerProperty, 0));
// now compare the space managers
if (((nsnull == sm1) && (nsnull != sm2)) ||
((nsnull != sm1) && (nsnull == sm2))) { // one is null, and the other is not
@ -7093,8 +7045,7 @@ PresShell::VerifyIncrementalReflow()
// Now that the document has been reflowed, use its frame tree to
// compare against our frame tree.
nsIFrame* root1;
GetRootFrame(&root1);
nsIFrame* root1 = mFrameManager->GetRootFrame();
nsIFrame* root2;
sh->GetRootFrame(&root2);
PRBool ok = CompareTrees(mPresContext, root1, cx, root2);

View File

@ -50,7 +50,7 @@
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIComponentManager.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
@ -243,23 +243,14 @@ nsSubDocumentFrame::Init(nsIPresContext* aPresContext,
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
nsIFrame* contentParent = nsnull;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
rv = frameManager->GetFrameProperty(this,
contentParentAtom,
NS_IFRAME_MGR_REMOVE_PROP,
&value);
if (NS_SUCCEEDED(rv)) {
void *value =
aPresContext->FrameManager()->GetFrameProperty(this, contentParentAtom,
NS_IFRAME_MGR_REMOVE_PROP,
&rv);
if (NS_SUCCEEDED(rv)) {
contentParent = (nsIFrame*)value;
}
}
}
nsHTMLContainerFrame::CreateViewForFrame(this, contentParent, PR_TRUE);
}
nsIView* view = GetView();

View File

@ -39,7 +39,7 @@
#include "nsReadableUtils.h"
#include "nsComboboxControlFrame.h"
#include "nsIDOMEventReceiver.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsFormControlFrame.h"
#include "nsIHTMLContent.h"
#include "nsHTMLAtoms.h"
@ -2038,13 +2038,8 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
nsCOMPtr<nsIContent> content(do_QueryInterface(mDisplayContent));
mTextFrame->Init(aPresContext, content, mDisplayFrame, textStyleContext, nsnull);
mTextFrame->SetInitialChildList(aPresContext, nsnull, nsnull);
nsIPresShell *presShell = aPresContext->GetPresShell();
if (!presShell) { return NS_ERROR_NULL_POINTER; }
nsCOMPtr<nsIFrameManager> frameManager;
rv = presShell->GetFrameManager(getter_AddRefs(frameManager));
if (NS_FAILED(rv)) { return rv; }
if (!frameManager) { return NS_ERROR_NULL_POINTER; }
frameManager->SetPrimaryFrameFor(content, mTextFrame);
aPresContext->FrameManager()->SetPrimaryFrameFor(content, mTextFrame);
rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
if (NS_FAILED(rv)) { return rv; }

View File

@ -65,7 +65,7 @@
#include "nsIDocument.h"
#include "nsButtonFrameRenderer.h"
#include "nsFormControlFrame.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsINameSpaceManager.h"
#include "nsReflowPath.h"
#include "nsIServiceManager.h"
@ -219,7 +219,7 @@ nsHTMLButtonControlFrame::GetValue(nsAString* aResult)
}
void
nsHTMLButtonControlFrame::ReParentFrameList(nsIFrameManager* aFrameManager,
nsHTMLButtonControlFrame::ReParentFrameList(nsFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
// get the new parent context from the first child: that is the
@ -333,7 +333,7 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIFrame* aChildList)
{
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
ReParentFrameList(aPresContext->GetFrameManager(), aChildList);
ReParentFrameList(aPresContext->FrameManager(), aChildList);
return mFrames.FirstChild()->SetInitialChildList(aPresContext, nsnull, aChildList);
}
@ -719,7 +719,7 @@ nsHTMLButtonControlFrame::AppendFrames(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
ReParentFrameList(aPresContext->FrameManager(), aFrameList);
return mFrames.FirstChild()->AppendFrames(aPresContext,
aPresShell,
aListName,
@ -733,7 +733,7 @@ nsHTMLButtonControlFrame::InsertFrames(nsIPresContext* aPresContext,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
ReParentFrameList(aPresContext->FrameManager(), aFrameList);
return mFrames.FirstChild()->InsertFrames(aPresContext,
aPresShell,
aListName,
@ -760,7 +760,7 @@ nsHTMLButtonControlFrame::ReplaceFrame(nsIPresContext* aPresContext,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
ReParentFrameList(aPresContext->GetFrameManager(), aNewFrame);
ReParentFrameList(aPresContext->FrameManager(), aNewFrame);
return mFrames.FirstChild()->ReplaceFrame(aPresContext,
aPresShell,
aListName,

View File

@ -171,7 +171,7 @@ public:
NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight);
protected:
void ReParentFrameList(nsIFrameManager* aFrameManager, nsIFrame* aFrameList);
void ReParentFrameList(nsFrameManager* aFrameManager, nsIFrame* aFrameList);
virtual PRBool IsReset(PRInt32 type);
virtual PRBool IsSubmit(PRInt32 type);
void ReflowButtonContents(nsIPresContext* aPresContext,

View File

@ -90,7 +90,7 @@
#include "nsTextFragment.h"
#include "nsISupportsArray.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsLegendFrame.h"
@ -368,19 +368,21 @@ IsFrameSpecial(nsIFrame* aFrame)
}
static void
GetSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** aResult)
GetSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** aResult)
{
// We only store the "special sibling" annotation with the first
// frame in the flow. Walk back to find that frame now.
aFrame = aFrame->GetFirstInFlow();
void* value;
aFrameManager->GetFrameProperty(aFrame, nsLayoutAtoms::IBSplitSpecialSibling, 0, &value);
void* value =
aFrameManager->GetFrameProperty(aFrame,
nsLayoutAtoms::IBSplitSpecialSibling, 0);
*aResult = NS_STATIC_CAST(nsIFrame*, value);
}
static nsIFrame*
GetLastSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame)
GetLastSpecialSibling(nsFrameManager* aFrameManager, nsIFrame* aFrame)
{
for (nsIFrame *frame = aFrame, *next; ; frame = next) {
GetSpecialSibling(aFrameManager, frame, &next);
@ -394,7 +396,7 @@ GetLastSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame)
// Get the frame's next-in-flow, or, if it doesn't have one,
// its special sibling.
static nsIFrame*
GetNifOrSpecialSibling(nsIFrameManager *aFrameManager, nsIFrame *aFrame)
GetNifOrSpecialSibling(nsFrameManager *aFrameManager, nsIFrame *aFrame)
{
nsIFrame *result;
aFrame->GetNextInFlow(&result);
@ -407,7 +409,7 @@ GetNifOrSpecialSibling(nsIFrameManager *aFrameManager, nsIFrame *aFrame)
}
static void
SetFrameIsSpecial(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aSpecialSibling)
SetFrameIsSpecial(nsFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame* aSpecialSibling)
{
NS_PRECONDITION(aFrameManager && aFrame, "bad args!");
@ -555,7 +557,7 @@ FindLastBlock(nsIPresContext* aPresContext, nsIFrame* aKid)
*/
inline void
MarkIBSpecialPrevSibling(nsIPresContext* aPresContext,
nsIFrameManager *aFrameManager,
nsFrameManager *aFrameManager,
nsIFrame *aAnonymousFrame,
nsIFrame *aSpecialParent)
{
@ -737,7 +739,7 @@ private:
class nsFrameConstructorState {
public:
nsCOMPtr<nsIPresShell> mPresShell;
nsCOMPtr<nsIFrameManager> mFrameManager;
nsFrameManager *mFrameManager;
// Containing block information for out-of-flow frammes
nsAbsoluteItems mFixedItems;
@ -789,7 +791,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresCon
mPseudoFrames()
{
mPresShell = aPresContext->PresShell();
mPresShell->GetFrameManager(getter_AddRefs(mFrameManager));
mFrameManager = mPresShell->FrameManager();
}
nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresContext,
@ -804,7 +806,7 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresCon
mPseudoFrames()
{
mPresShell = aPresContext->PresShell();
mPresShell->GetFrameManager(getter_AddRefs(mFrameManager));
mFrameManager = mPresShell->FrameManager();
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
if (docShell)
@ -1038,8 +1040,8 @@ MoveChildrenTo(nsIPresContext* aPresContext,
// anonymous block frame, but oddly they aren't -- need to
// investigate that...)
if (aNewParentSC)
aPresContext->GetFrameManager()->ReParentStyleContext(aFrameList,
aNewParentSC);
aPresContext->FrameManager()->ReParentStyleContext(aFrameList,
aNewParentSC);
#endif
aFrameList = aFrameList->GetNextSibling();
@ -2758,7 +2760,7 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, aStyleContext, nsnull, aNewFrame);
// if the parent frame was anonymous then reparent the style context
if (aIsPseudoParent) {
aPresContext->GetFrameManager()->
aPresContext->FrameManager()->
ReParentStyleContext(aNewFrame, parentFrame->GetStyleContext());
}
@ -3901,7 +3903,7 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
nsresult
nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame* aFrame,
nsStyleContext* aStyleContext,
@ -5519,8 +5521,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::defaultz, defaultTooltip);
if (defaultTooltip.EqualsIgnoreCase("true")) {
// Locate the root frame and tell it about the tooltip.
nsIFrame* rootFrame = nsnull;
aState.mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aState.mFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -5629,8 +5630,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
else if (isPopup) {
// Locate the root popup set and add ourselves to the popup set's list
// of popup frames.
nsIFrame* rootFrame;
aState.mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aState.mFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -5666,8 +5666,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
aContent->GetAttr(kNameSpaceID_None, nsXULAtoms::tooltip, value) !=
NS_CONTENT_ATTR_NOT_THERE)
{
nsIFrame* rootFrame = nsnull;
aState.mFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aState.mFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -7141,11 +7140,11 @@ nsCSSFrameConstructor::ReconstructDocElementHierarchy(nsIPresContext* aPresConte
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
nsnull, nsnull, mTempFrameTreeState);
nsIFrame* docElementFrame;
// Get the frame that corresponds to the document element
state.mFrameManager->GetPrimaryFrameFor(rootContent, &docElementFrame);
// Get the frame that corresponds to the document element
nsIFrame* docElementFrame =
state.mFrameManager->GetPrimaryFrameFor(rootContent);
// Clear the hash tables that map from content to frame and out-of-flow
// frame to placeholder frame
state.mFrameManager->ClearPrimaryFrameMap();
@ -7406,7 +7405,7 @@ nsCSSFrameConstructor::GetFloatContainingBlock(nsIPresContext* aPresContext,
nsresult
nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContainer,
nsIFrame* aParentFrame,
nsIFrame* aFrameList)
@ -7534,9 +7533,8 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
// The frame may be a special frame (a split inline frame that
// contains a block). Get the last part of that split.
if (IsFrameSpecial(prevSibling)) {
nsCOMPtr<nsIFrameManager> fm;
aPresShell->GetFrameManager(getter_AddRefs(fm));
prevSibling = GetLastSpecialSibling(fm, prevSibling);
prevSibling = GetLastSpecialSibling(aPresShell->FrameManager(),
prevSibling);
}
// The frame may have a continuation. If so, we want the
@ -7548,7 +7546,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
const nsStyleDisplay* display = prevSibling->GetStyleDisplay();
if (display->IsFloating() || display->IsAbsolutelyPositioned()) {
nsIFrame* placeholderFrame;
nsIFrame *placeholderFrame;
aPresShell->GetPlaceholderFrameFor(prevSibling, &placeholderFrame);
NS_ASSERTION(placeholderFrame, "no placeholder for out-of-flow frame");
prevSibling = placeholderFrame;
@ -7731,9 +7729,8 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
// The frame may be a special frame (a split inline frame that
// contains a block). Get the last part of that split.
if (IsFrameSpecial(prevSibling)) {
nsCOMPtr<nsIFrameManager> fm;
aPresShell->GetFrameManager(getter_AddRefs(fm));
prevSibling = GetLastSpecialSibling(fm, prevSibling);
prevSibling = GetLastSpecialSibling(aPresShell->FrameManager(),
prevSibling);
}
// The frame may have a continuation. Get the last-in-flow
@ -8116,8 +8113,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
// Since we're appending, we'll walk to the last anonymous frame
// that was created for the broken inline frame.
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = shell->FrameManager();
while (1) {
nsIFrame* sibling;
@ -8364,11 +8360,8 @@ nsCSSFrameConstructor::AddDummyFrameToSelect(nsIPresContext* aPresContext,
if (aChildItems) {
aChildItems->AddChild(generatedFrame);
} else {
nsCOMPtr<nsIFrameManager> frameManager;
aPresShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
frameManager->AppendFrames(aParentFrame, nsnull, generatedFrame);
}
aPresShell->FrameManager()->AppendFrames(aParentFrame, nsnull,
generatedFrame);
}
listFrame->SetDummyFrame(generatedFrame);
@ -8385,7 +8378,7 @@ nsCSSFrameConstructor::AddDummyFrameToSelect(nsIPresContext* aPresContext,
static nsresult
DeletingFrameSubtree(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame);
nsresult
@ -8416,8 +8409,7 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
// get the child's parent frame (which ought to be the list frame)
nsIFrame* parentFrame = dummyFrame->GetParent();
nsCOMPtr<nsIFrameManager> frameManager;
aPresShell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = aPresShell->FrameManager();
DeletingFrameSubtree(aPresContext, aPresShell, frameManager,
dummyFrame);
frameManager->RemoveFrame(parentFrame, nsnull, dummyFrame);
@ -9021,7 +9013,7 @@ nsCSSFrameConstructor::ContentReplaced(nsIPresContext* aPresContext,
static nsresult
DoDeletingFrameSubtree(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsVoidArray& aDestroyQueue,
nsIFrame* aRemovedFrame,
nsIFrame* aFrame)
@ -9095,7 +9087,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
static nsresult
DeletingFrameSubtree(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame)
{
// If there's no frame manager it's probably because the pres shell is
@ -9137,8 +9129,7 @@ DeletingFrameSubtree(nsIPresContext* aPresContext,
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP) {
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
nsIFrame* rootFrame;
aFrameManager->GetRootFrame(&rootFrame);
nsIFrame* rootFrame = aFrameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
@ -9181,13 +9172,12 @@ nsCSSFrameConstructor::RemoveMappingsForFrameSubtree(nsIPresContext* aPresContex
nsILayoutHistoryState* aFrameState)
{
nsIPresShell *presShell = aPresContext->PresShell();
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
// Save the frame tree's state before deleting it
CaptureStateFor(aPresContext, aRemovedFrame, mTempFrameTreeState);
return DeletingFrameSubtree(aPresContext, presShell, frameManager, aRemovedFrame);
return DeletingFrameSubtree(aPresContext, presShell,
presShell->FrameManager(), aRemovedFrame);
}
nsresult
@ -9213,8 +9203,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
#endif
nsIPresShell *shell = aPresContext->PresShell();
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = shell->FrameManager();
nsresult rv = NS_OK;
// Find the child frame that maps the content
@ -9360,130 +9349,128 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
nsPlaceholderFrame* placeholderFrame = nsnull;
if (display->mDisplay == NS_STYLE_DISPLAY_POPUP)
// Get the placeholder frame
frameManager->GetPlaceholderFrameFor(childFrame,
(nsIFrame**)&placeholderFrame);
if (placeholderFrame) {
// Remove the mapping from the frame to its placeholder
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
placeholderFrame = frameManager->GetPlaceholderFrameFor(childFrame);
if (placeholderFrame) {
// Remove the mapping from the frame to its placeholder
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
nsIFrame* rootFrame;
frameManager->GetRootFrame(&rootFrame);
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
// Locate the root popup set and remove ourselves from the popup set's list
// of popup frames.
nsIFrame* rootFrame = frameManager->GetRootFrame();
if (rootFrame)
rootFrame = rootFrame->GetFirstChild(nsnull);
#ifdef MOZ_XUL
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
if (rootBox) {
nsIFrame* popupSetFrame;
rootBox->GetPopupSetFrame(&popupSetFrame);
if (popupSetFrame) {
nsCOMPtr<nsIPopupSetFrame> popupSet(do_QueryInterface(popupSetFrame));
if (popupSet)
popupSet->RemovePopupFrame(childFrame);
nsCOMPtr<nsIRootBox> rootBox(do_QueryInterface(rootFrame));
if (rootBox) {
nsIFrame* popupSetFrame;
rootBox->GetPopupSetFrame(&popupSetFrame);
if (popupSetFrame) {
nsCOMPtr<nsIPopupSetFrame> popupSet(do_QueryInterface(popupSetFrame));
if (popupSet)
popupSet->RemovePopupFrame(childFrame);
}
}
#endif
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
return NS_OK;
}
}
#endif
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
return NS_OK;
}
}
else if (display->IsFloating()) {
else if (display->IsFloating()) {
#ifdef NOISY_FIRST_LETTER
printf(" ==> child display is still floating!\n");
printf(" ==> child display is still floating!\n");
#endif
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame;
frameManager->GetPlaceholderFrameFor(childFrame,
(nsIFrame**)&placeholderFrame);
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame =
frameManager->GetPlaceholderFrameFor(childFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Now we remove the floating frame
// Now we remove the floating frame
// XXX has to be done first for now: the blocks line list
// contains an array of pointers to the placeholder - we have to
// remove the float first (which gets rid of the lines
// reference to the placeholder and float) and then remove the
// placeholder
rv = frameManager->RemoveFrame(parentFrame,
nsLayoutAtoms::floatList, childFrame);
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
// XXX has to be done first for now: the blocks line list
// contains an array of pointers to the placeholder - we have to
// remove the float first (which gets rid of the lines
// reference to the placeholder and float) and then remove the
// placeholder
rv = frameManager->RemoveFrame(parentFrame,
nsnull, placeholderFrame);
nsLayoutAtoms::floatList, childFrame);
// Remove the placeholder frame first (XXX second for now) (so
// that it doesn't retain a dangling pointer to memory)
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
DeletingFrameSubtree(aPresContext, shell, frameManager, placeholderFrame);
rv = frameManager->RemoveFrame(parentFrame,
nsnull, placeholderFrame);
}
}
}
// See if it's absolutely or fixed positioned
else if (display->IsAbsolutelyPositioned()) {
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame;
frameManager->GetPlaceholderFrameFor(childFrame,
(nsIFrame**)&placeholderFrame);
// See if it's absolutely or fixed positioned
else if (display->IsAbsolutelyPositioned()) {
// Get the placeholder frame
nsPlaceholderFrame* placeholderFrame =
frameManager->GetPlaceholderFrameFor(childFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Remove the mapping from the frame to its placeholder
if (placeholderFrame)
frameManager->UnregisterPlaceholderFrame(placeholderFrame);
// Generate two notifications. First for the absolutely positioned
// frame
rv = frameManager->RemoveFrame(parentFrame,
(NS_STYLE_POSITION_FIXED == display->mPosition) ?
nsLayoutAtoms::fixedList : nsLayoutAtoms::absoluteList, childFrame);
// Generate two notifications. First for the absolutely positioned
// frame
rv = frameManager->RemoveFrame(parentFrame,
(NS_STYLE_POSITION_FIXED == display->mPosition) ?
nsLayoutAtoms::fixedList : nsLayoutAtoms::absoluteList, childFrame);
// Now the placeholder frame
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
rv = frameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
// Now the placeholder frame
if (placeholderFrame) {
parentFrame = placeholderFrame->GetParent();
rv = frameManager->RemoveFrame(parentFrame, nsnull,
placeholderFrame);
}
} else {
// Notify the parent frame that it should delete the frame
// check for a table caption which goes on an additional child list with a different parent
nsIFrame* outerTableFrame;
if (GetCaptionAdjustedParent(parentFrame, childFrame, &outerTableFrame)) {
rv = frameManager->RemoveFrame(outerTableFrame,
nsLayoutAtoms::captionList,
childFrame);
}
else {
rv = frameManager->RemoveFrame(insertionPoint, nsnull, childFrame);
}
}
} else {
// Notify the parent frame that it should delete the frame
// check for a table caption which goes on an additional child list with a different parent
nsIFrame* outerTableFrame;
if (GetCaptionAdjustedParent(parentFrame, childFrame, &outerTableFrame)) {
rv = frameManager->RemoveFrame(outerTableFrame,
nsLayoutAtoms::captionList, childFrame);
if (mInitialContainingBlock == childFrame) {
mInitialContainingBlock = nsnull;
}
else {
rv = frameManager->RemoveFrame(insertionPoint, nsnull, childFrame);
if (haveFLS && mInitialContainingBlock) {
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext,
parentFrame),
GetFloatContainingBlock(aPresContext,
parentFrame));
RecoverLetterFrames(shell, aPresContext, state, containingBlock);
}
}
if (mInitialContainingBlock == childFrame) {
mInitialContainingBlock = nsnull;
}
if (haveFLS && mInitialContainingBlock) {
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
GetAbsoluteContainingBlock(aPresContext,
parentFrame),
GetFloatContainingBlock(aPresContext,
parentFrame));
RecoverLetterFrames(shell, aPresContext, state, containingBlock);
}
#ifdef DEBUG
if (gReallyNoisyContentUpdates && parentFrame) {
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentRemoved: resulting frame model:\n");
fdbg->List(aPresContext, stdout, 0);
if (gReallyNoisyContentUpdates && parentFrame) {
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentRemoved: resulting frame model:\n");
fdbg->List(aPresContext, stdout, 0);
}
}
}
#endif
}
@ -9500,12 +9487,12 @@ static void
DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIViewManager* aViewManager,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsChangeHint aChange);
static void
UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
nsIViewManager* aViewManager, nsIFrameManager* aFrameManager,
nsIViewManager* aViewManager, nsFrameManager* aFrameManager,
nsRect& aBoundsRect, nsChangeHint aChange)
{
NS_PRECONDITION(gInApplyRenderingChangeToTree,
@ -9561,7 +9548,7 @@ static void
DoApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIViewManager* aViewManager,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsChangeHint aChange)
{
NS_PRECONDITION(gInApplyRenderingChangeToTree,
@ -9643,14 +9630,11 @@ ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
viewManager->BeginUpdateViewBatch();
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
#ifdef DEBUG
gInApplyRenderingChangeToTree = PR_TRUE;
#endif
DoApplyRenderingChangeToTree(aPresContext, aFrame, viewManager,
frameManager, aChange);
shell->FrameManager(), aChange);
#ifdef DEBUG
gInApplyRenderingChangeToTree = PR_FALSE;
#endif
@ -9782,8 +9766,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
if (!count)
return NS_OK;
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = aPresContext->FrameManager();
// Mark frames so that we skip frames that die along the way, bug 123049.
// A frame can be in the list multiple times with different hints. Further
@ -9807,9 +9790,13 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
// skip any frame that has been destroyed due to a ripple effect
if (frame) {
void* dummy;
nsresult res = frameManager->GetFrameProperty(frame,
nsLayoutAtoms::changeListProperty, 0, &dummy);
nsresult res;
void* dummy =
frameManager->GetFrameProperty(frame,
nsLayoutAtoms::changeListProperty, 0,
&res);
if (NS_IFRAME_MGR_PROP_NOT_THERE == res)
continue;
}
@ -9832,9 +9819,7 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
nsIPresShell *shell = aPresContext->PresShell();
shell->GetPrimaryFrameFor(content, &frame);
if (frame) {
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
frameManager->DebugVerifyStyleTree(frame);
shell->FrameManager()->DebugVerifyStyleTree(frame);
}
} else {
NS_WARNING("Unable to test style tree integrity -- no content node");
@ -9864,10 +9849,8 @@ nsCSSFrameConstructor::RestyleElement(nsIPresContext *aPresContext,
{
if (aPrimaryFrame) {
nsStyleChangeList changeList;
nsChangeHint frameChange = NS_STYLE_HINT_NONE;
aPresContext->GetPresShell()->GetFrameManager()->
ComputeStyleChangeFor(aPrimaryFrame, changeList,
NS_STYLE_HINT_NONE, frameChange);
nsChangeHint frameChange = aPresContext->GetPresShell()->FrameManager()->
ComputeStyleChangeFor(aPrimaryFrame, &changeList, NS_STYLE_HINT_NONE);
if (frameChange & nsChangeHint_ReconstructFrame) {
RecreateFramesForContent(aPresContext, aContent);
@ -10037,10 +10020,11 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
}
}
nsIFrameManager *frameManager = shell->GetFrameManager();
nsReStyleHint rshint = nsReStyleHint(0);
frameManager->HasAttributeDependentStyle(aContent,
aAttribute, aModType, &rshint);
nsFrameManager *frameManager = shell->FrameManager();
nsReStyleHint rshint = frameManager->HasAttributeDependentStyle(aContent,
aAttribute,
aModType);
if (reframe) {
result = RecreateFramesForContent(aPresContext, aContent);
} else if (primaryFrame) {
@ -10050,8 +10034,8 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
// there is an effect, so compute it
if (rshint & eReStyle_Self) {
frameManager->ComputeStyleChangeFor(primaryFrame,
changeList, hint, hint);
hint = frameManager->ComputeStyleChangeFor(primaryFrame, &changeList,
hint);
}
// hint is for primary only
@ -10263,7 +10247,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
nsPlaceholderFrame* placeholderFrame = nsnull;
nsIPresShell *presShell = aPresContext->PresShell();
if (listName) {
presShell->GetPlaceholderFrameFor(aFrame, (nsIFrame**)&placeholderFrame);
presShell->GetPlaceholderFrameFor(aFrame, (nsIFrame**) &placeholderFrame);
}
// Get the previous sibling frame
@ -10281,8 +10265,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
parentFrame, nsnull, newFrame);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = presShell->FrameManager();
// Replace the old frame with the new frame
@ -10745,10 +10728,8 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
if (!oofContFrame)
return NS_ERROR_NULL_POINTER;
// create a continuing placeholder frame
nsCOMPtr<nsIFrameManager> frameManager;
shell->GetFrameManager(getter_AddRefs(frameManager));
NS_ASSERTION(frameManager, "no frame manager");
CreatePlaceholderFrameFor(shell, aPresContext, frameManager, content,
CreatePlaceholderFrameFor(shell, aPresContext,
shell->FrameManager(), content,
oofContFrame, styleContext, aParentFrame, &newFrame);
if (!newFrame)
return NS_ERROR_NULL_POINTER;
@ -10850,7 +10831,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresContext* aPresContext,
// for a frame that maps the specified content object
nsIFrame*
nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent,
@ -10884,7 +10865,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext,
kidFrame = aHint->mPrimaryFrameForPrevSibling;
// But if it's out of flow, start from its placeholder.
if (kidFrame && (kidFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
aFrameManager->GetPlaceholderFrameFor(kidFrame, &kidFrame);
kidFrame = aFrameManager->GetPlaceholderFrameFor(kidFrame);
}
if (kidFrame) {
@ -10999,7 +10980,7 @@ nsCSSFrameConstructor::FindFrameWithContent(nsIPresContext* aPresContext,
// the pres shell hash table
nsresult
nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame** aFrame,
nsFindFrameHint* aHint)
@ -11024,7 +11005,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
// call us back if there is no mapping in the hash table
nsCOMPtr<nsIContent> parentContent = aContent->GetParent(); // Get this once
if (parentContent) {
aFrameManager->GetPrimaryFrameFor(parentContent, &parentFrame);
parentFrame = aFrameManager->GetPrimaryFrameFor(parentContent);
while (parentFrame) {
// Search the child frames for a match
*aFrame = FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
@ -11189,19 +11170,13 @@ nsCSSFrameConstructor::CaptureStateFor(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsILayoutHistoryState* aHistoryState)
{
nsresult rv = NS_OK;
if (aFrame && aPresContext && aHistoryState) {
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
rv = presShell->GetFrameManager(getter_AddRefs(frameManager));
if (NS_SUCCEEDED(rv) && frameManager) {
rv = frameManager->CaptureFrameState(aFrame, aHistoryState);
}
presShell->FrameManager()->CaptureFrameState(aFrame, aHistoryState);
}
}
return rv;
return NS_OK;
}
nsresult
@ -11210,7 +11185,7 @@ nsCSSFrameConstructor::MaybeRecreateFramesForContent(nsIPresContext* aPresContex
{
nsresult result = NS_OK;
nsIPresShell *shell = aPresContext->PresShell();
nsIFrameManager *frameManager = shell->GetFrameManager();
nsFrameManager *frameManager = shell->FrameManager();
nsStyleContext *oldContext = frameManager->GetUndisplayedContent(aContent);
if (oldContext) {
@ -11478,8 +11453,8 @@ ReparentFrame(nsIPresContext* aPresContext,
nsIFrame* aFrame)
{
aFrame->SetParent(aNewParentFrame);
aPresContext->GetFrameManager()->ReParentStyleContext(aFrame,
aParentStyleContext);
aPresContext->FrameManager()->ReParentStyleContext(aFrame,
aParentStyleContext);
}
// Special routine to handle placing a list of frames into a block
@ -12130,7 +12105,7 @@ nsresult
nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame,
PRBool* aStopLooking)
{
@ -12157,9 +12132,9 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
// Discover the placeholder frame for the letter frame
nsIFrame* parentFrame;
nsPlaceholderFrame* placeholderFrame;
aFrameManager->GetPlaceholderFrameFor(floatFrame,
(nsIFrame**)&placeholderFrame);
nsPlaceholderFrame* placeholderFrame =
aFrameManager->GetPlaceholderFrameFor(floatFrame);
if (!placeholderFrame) {
// Somethings really wrong
return NS_OK;
@ -12244,7 +12219,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
nsresult
nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame,
PRBool* aStopLooking)
{
@ -12278,7 +12253,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
textFrame->Init(aPresContext, textContent, aFrame, newSC, nsnull);
// Next rip out the kid and replace it with the text frame
nsIFrameManager* frameManager = aFrameManager;
nsFrameManager* frameManager = aFrameManager;
DeletingFrameSubtree(aPresContext, aPresShell, frameManager, kid);
frameManager->RemoveFrame(aFrame, nsnull, kid);
@ -12308,7 +12283,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsresult
nsCSSFrameConstructor::RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame)
{
PRBool stopLooking = PR_FALSE;
@ -12822,7 +12797,7 @@ nsCSSFrameConstructor::ProcessInlineChildren(nsIPresShell* aPresShell,
// added to the frame hierarchy
static void
DoCleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrameIn)
{
nsIContent* content = aFrameIn->GetContent();
@ -12853,7 +12828,7 @@ DoCleanupFrameReferences(nsIPresContext* aPresContext,
// Helper function that walks a frame list and calls DoCleanupFrameReference()
static void
CleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
while (aFrameList) {
@ -12888,10 +12863,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
return PR_FALSE;
// Ok, reverse tracks: wipe out the frames we just created
nsCOMPtr<nsIPresShell> presShell;
nsCOMPtr<nsIFrameManager> frameManager;
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
nsFrameManager *frameManager = aPresContext->FrameManager();
// Destroy the frames. As we do make sure any content to frame mappings
// or entries in the undisplayed content map are removed
@ -13260,9 +13232,9 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF
return ReconstructDocElementHierarchy(aPresContext);
}
nsresult nsCSSFrameConstructor::RemoveFixedItems(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager)
nsresult nsCSSFrameConstructor::RemoveFixedItems(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsFrameManager* aFrameManager)
{
nsresult rv=NS_OK;

View File

@ -51,7 +51,7 @@ struct nsStyleContent;
struct nsStyleDisplay;
class nsIPresShell;
class nsVoidArray;
class nsIFrameManager;
class nsFrameManager;
class nsFrameConstructorState;
class nsIDOMHTMLSelectElement;
class nsIPresContext;
@ -148,7 +148,7 @@ public:
// This is typically called by the pres shell when there is no mapping in
// the pres shell hash table
nsresult FindPrimaryFrameFor(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame** aFrame,
nsFindFrameHint* aHint);
@ -248,7 +248,7 @@ protected:
nsresult AppendFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContainer,
nsIFrame* aParentFrame,
nsIFrame* aFrameList);
@ -453,7 +453,7 @@ protected:
nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIContent* aContent,
nsIFrame* aFrame,
nsStyleContext* aStyleContext,
@ -657,7 +657,7 @@ protected:
PRBool IsScrollable(nsIPresContext* aPresContext, const nsStyleDisplay* aDisplay);
nsIFrame* GetFrameFor(nsIPresShell* aFrameManager,
nsIFrame* GetFrameFor(nsIPresShell* aPresShell,
nsIPresContext* aPresContext,
nsIContent* aContent);
@ -876,7 +876,7 @@ protected:
* @param aHint an optional hint used to make the search for aFrame faster
*/
nsIFrame* FindFrameWithContent(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent,
@ -933,20 +933,20 @@ protected:
//
nsresult RemoveLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame);
// Recursive helper for RemoveLetterFrames
nsresult RemoveFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aFrame,
PRBool* aStopLooking);
// Special remove method for those pesky floating first-letter frames
nsresult RemoveFloatingFirstLetterFrames(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager,
nsFrameManager* aFrameManager,
nsIFrame* aBlockFrame,
PRBool* aStopLooking);
@ -989,7 +989,7 @@ protected:
nsresult RemoveFixedItems(nsIPresContext* aPresContext,
nsIPresShell* aPresShell,
nsIFrameManager* aFrameManager);
nsFrameManager* aFrameManager);
// Find the ``rightmost'' frame for the content immediately preceding
// aIndexInContainer, following continuations if necessary. If aChild is

View File

@ -54,7 +54,6 @@
#include "nsVoidArray.h"
#include "nsIView.h"
#include "nsLayoutAtoms.h"
#include "nsIFrameManager.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"
#include "nsIHTMLTableCellElement.h"

View File

@ -71,7 +71,7 @@
#include "nsIDOMHTMLBodyElement.h"
#include "nsIScrollableFrame.h"
#include "nsHTMLReflowCommand.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsCSSRendering.h"
#include "nsLayoutErrors.h"
#include "nsAutoPtr.h"
@ -7278,42 +7278,32 @@ nsTableFrame::GetProperty(nsIPresContext* aPresContext,
nsIAtom* aPropertyName,
PRBool aCreateIfNecessary)
{
nsIPresShell *presShell = aPresContext->GetPresShell();
nsFrameManager *frameManager = aPresContext->FrameManager();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
frameManager->GetFrameProperty(aFrame, aPropertyName, 0, &value);
if (value) {
return (nsPoint*)value; // the property already exists
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new value, set the property,
// and return the newly allocated value
void* value = nsnull;
NSFramePropertyDtorFunc dtorFunc = nsnull;
if (aPropertyName == nsLayoutAtoms::collapseOffsetProperty) {
value = new nsPoint(0, 0);
dtorFunc = DestroyPointFunc;
}
else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;
}
else if (aPropertyName == nsLayoutAtoms::tableBCProperty) {
value = new BCPropertyData;
dtorFunc = DestroyBCPropertyDataFunc;
}
if (!value) return nsnull;
frameManager->SetFrameProperty(aFrame, aPropertyName, value, dtorFunc);
return value;
}
void *value = frameManager->GetFrameProperty(aFrame, aPropertyName, 0);
if (value) {
return (nsPoint*)value; // the property already exists
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new value, set the property,
// and return the newly allocated value
void* value = nsnull;
NSFramePropertyDtorFunc dtorFunc = nsnull;
if (aPropertyName == nsLayoutAtoms::collapseOffsetProperty) {
value = new nsPoint(0, 0);
dtorFunc = DestroyPointFunc;
}
else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;
}
else if (aPropertyName == nsLayoutAtoms::tableBCProperty) {
value = new BCPropertyData;
dtorFunc = DestroyBCPropertyDataFunc;
}
if (!value) return nsnull;
frameManager->SetFrameProperty(aFrame, aPropertyName, value, dtorFunc);
return value;
}
return nsnull;

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -37,7 +38,7 @@
#include "nsIDOMText.h"
#include "nsITextContent.h"
#include "nsIDOMMutationEvent.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsStyleChangeList.h"
#include "nsMathMLAtoms.h"
@ -649,22 +650,14 @@ nsMathMLContainerFrame::PropagateScriptStyleFor(nsIPresContext* aPresContext,
}
// now, re-resolve the style contexts in our subtree
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> fm;
presShell->GetFrameManager(getter_AddRefs(fm));
if (fm) {
nsChangeHint maxChange = NS_STYLE_HINT_NONE, minChange = NS_STYLE_HINT_NONE;
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(aFrame, changeList,
minChange, maxChange);
nsFrameManager *fm = aPresContext->FrameManager();
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(aFrame, &changeList, NS_STYLE_HINT_NONE);
#ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = aFrame->GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame);
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = aFrame->GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame);
#endif
}
}
}
// recurse down the subtrees for changes that may arise deep down
@ -701,7 +694,7 @@ nsresult
nsMathMLContainerFrame::WrapForeignFrames(nsIPresContext* aPresContext)
{
nsIFrame* next = mFrames.FirstChild();
nsIFrameManager *frameManager = aPresContext->GetFrameManager();
nsFrameManager *frameManager = aPresContext->FrameManager();
while (next) {
nsIFrame* child = next;

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -33,7 +34,7 @@
#include "nsICSSRule.h"
#include "nsICSSStyleRule.h"
#include "nsStyleChangeList.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "nsContentCID.h"
@ -693,21 +694,14 @@ nsMathMLFrame::MapAttributesIntoCSS(nsIPresContext* aPresContext,
return 0;
// now, re-resolve the style contexts in our subtree
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> fm;
presShell->GetFrameManager(getter_AddRefs(fm));
if (fm) {
nsChangeHint maxChange = NS_STYLE_HINT_NONE, minChange = NS_STYLE_HINT_NONE;
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(aFrame, changeList, minChange, maxChange);
nsFrameManager *fm = aPresContext->FrameManager();
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(aFrame, &changeList, NS_STYLE_HINT_NONE);
#ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = aFrame->GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame);
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = aFrame->GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aFrame);
#endif
}
}
return ruleCount;
}

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -30,7 +31,7 @@
#include "nsIDOMText.h"
#include "nsITextContent.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsLayoutAtoms.h"
#include "nsStyleChangeList.h"
#include "nsINameSpaceManager.h"
@ -322,21 +323,14 @@ nsMathMLTokenFrame::SetTextStyle(nsIPresContext* aPresContext)
mContent->SetAttr(kNameSpaceID_None, nsMathMLAtoms::fontstyle, fontstyle, PR_FALSE);
// then, re-resolve the style contexts in our subtree
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> fm;
presShell->GetFrameManager(getter_AddRefs(fm));
if (fm) {
nsChangeHint maxChange, minChange = NS_STYLE_HINT_NONE;
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(this, changeList, minChange, maxChange);
nsFrameManager *fm = aPresContext->FrameManager();
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(this, &changeList, NS_STYLE_HINT_NONE);
#ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : this);
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : this);
#endif
}
}
}
///////////////////////////////////////////////////////////////////////////

View File

@ -1,3 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
@ -31,7 +32,7 @@
#include "nsIFontMetrics.h"
#include "nsVoidArray.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsStyleChangeList.h"
#include "nsTableOuterFrame.h"
#include "nsTableFrame.h"
@ -114,26 +115,21 @@ GetValueAt(nsIPresContext* aPresContext,
PRInt32 aRowOrColIndex)
{
PRUnichar* result = nsnull;
nsValueList* valueList = nsnull;
nsValueList* valueList;
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
frameManager->GetFrameProperty(aTableOrRowFrame, aAttributeAtom,
0, (void**)&valueList);
if (!valueList) {
// The property isn't there yet, so set it
nsAutoString values;
if (NS_CONTENT_ATTR_HAS_VALUE ==
aTableOrRowFrame->GetContent()->GetAttr(kNameSpaceID_None, aAttributeAtom, values)) {
valueList = new nsValueList(values);
if (valueList) {
frameManager->SetFrameProperty(aTableOrRowFrame, aAttributeAtom,
valueList, DestroyValueListFunc);
}
}
nsFrameManager *frameManager = aPresContext->FrameManager();
valueList = NS_STATIC_CAST(nsValueList*,
frameManager->GetFrameProperty(aTableOrRowFrame, aAttributeAtom, 0));
if (!valueList) {
// The property isn't there yet, so set it
nsAutoString values;
if (NS_CONTENT_ATTR_HAS_VALUE ==
aTableOrRowFrame->GetContent()->GetAttr(kNameSpaceID_None, aAttributeAtom, values)) {
valueList = new nsValueList(values);
if (valueList) {
frameManager->SetFrameProperty(aTableOrRowFrame, aAttributeAtom,
valueList, DestroyValueListFunc);
}
}
}
@ -279,22 +275,15 @@ MapAttributesInto(nsIPresContext* aPresContext,
// now, re-resolve the style contexts in our subtree to pick up any changes
if (hasChanged) {
nsIPresShell *presShell = aPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIFrameManager> fm;
presShell->GetFrameManager(getter_AddRefs(fm));
if (fm) {
nsChangeHint maxChange = NS_STYLE_HINT_NONE, minChange = NS_STYLE_HINT_NONE;
nsStyleChangeList changeList;
fm->ComputeStyleChangeFor(aCellFrame, changeList,
minChange, maxChange);
nsFrameManager *fm = aPresContext->FrameManager();
nsStyleChangeList changeList;
nsChangeHint maxChange = fm->ComputeStyleChangeFor(aCellFrame, &changeList,
NS_STYLE_HINT_NONE);
#ifdef DEBUG
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = aCellFrame->GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aCellFrame);
// Use the parent frame to make sure we catch in-flows and such
nsIFrame* parentFrame = aCellFrame->GetParent();
fm->DebugVerifyStyleTree(parentFrame ? parentFrame : aCellFrame);
#endif
}
}
}
}

View File

@ -159,7 +159,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIFrameDebug.h"
#include "nsILayoutHistoryState.h"
#include "nsLayoutAtoms.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsIParser.h"
#include "nsIPrintContext.h"
#include "nsGUIEvent.h"
@ -2690,11 +2690,8 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
nsCOMPtr<nsIWidget> widget = mParentWidget;
// the top nsPrintObject's widget will always have scrollbars
if (aPO->mParent != nsnull && aPO->mContent) {
nsCOMPtr<nsIFrameManager> frameMan;
aPO->mParent->mPresShell->GetFrameManager(getter_AddRefs(frameMan));
NS_ASSERTION(frameMan, "No Frame manager!");
nsIFrame* frame;
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
nsFrameManager *frameMan = aPO->mParent->mPresShell->FrameManager();
nsIFrame* frame = frameMan->GetPrimaryFrameFor(aPO->mContent);
if (frame) {
nsIView* view = frame->GetView();
@ -3057,35 +3054,31 @@ nsPrintEngine::PrintDocContent(nsPrintObject* aPO, nsresult& aStatus)
static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY)
{
if (aPO->mParent != nsnull) {
nsCOMPtr<nsIFrameManager> frameMan;
// we would not have gotten here if any of these ptrs were null
aPO->mParent->mPresShell->GetFrameManager(getter_AddRefs(frameMan));
NS_ASSERTION(frameMan, "No Frame manager!");
if (frameMan) {
// This gets out HTMLIFrame
nsIFrame* frame;
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
NS_ASSERTION(frame, "no primary frame for IFRAME");
// find the offset to the content rect
if (!frame)
return;
nsFrameManager *frameMan = aPO->mParent->mPresShell->FrameManager();
nsMargin borderPadding(0, 0, 0, 0);
frame->CalcBorderPadding(borderPadding);
aX += borderPadding.left;
aY += borderPadding.top;
// This gets our HTMLIFrame
nsIFrame* frame = frameMan->GetPrimaryFrameFor(aPO->mContent);
NS_ASSERTION(frame, "no primary frame for IFRAME");
if (!frame)
return;
// traverse out to the pageContentFrame
do {
nsPoint pt = frame->GetPosition();
aX += pt.x;
aY += pt.y;
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
break;
}
frame = frame->GetParent();
} while (frame);
}
// find the offset to the content rect
nsMargin borderPadding(0, 0, 0, 0);
frame->CalcBorderPadding(borderPadding);
aX += borderPadding.left;
aY += borderPadding.top;
// traverse out to the pageContentFrame
do {
nsPoint pt = frame->GetPosition();
aX += pt.x;
aY += pt.y;
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
break;
}
frame = frame->GetParent();
} while (frame);
}
}

View File

@ -54,7 +54,6 @@
#include "nsVoidArray.h"
#include "nsIView.h"
#include "nsLayoutAtoms.h"
#include "nsIFrameManager.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"
#include "nsIHTMLTableCellElement.h"

View File

@ -71,7 +71,7 @@
#include "nsIDOMHTMLBodyElement.h"
#include "nsIScrollableFrame.h"
#include "nsHTMLReflowCommand.h"
#include "nsIFrameManager.h"
#include "nsFrameManager.h"
#include "nsCSSRendering.h"
#include "nsLayoutErrors.h"
#include "nsAutoPtr.h"
@ -7278,42 +7278,32 @@ nsTableFrame::GetProperty(nsIPresContext* aPresContext,
nsIAtom* aPropertyName,
PRBool aCreateIfNecessary)
{
nsIPresShell *presShell = aPresContext->GetPresShell();
nsFrameManager *frameManager = aPresContext->FrameManager();
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
frameManager->GetFrameProperty(aFrame, aPropertyName, 0, &value);
if (value) {
return (nsPoint*)value; // the property already exists
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new value, set the property,
// and return the newly allocated value
void* value = nsnull;
NSFramePropertyDtorFunc dtorFunc = nsnull;
if (aPropertyName == nsLayoutAtoms::collapseOffsetProperty) {
value = new nsPoint(0, 0);
dtorFunc = DestroyPointFunc;
}
else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;
}
else if (aPropertyName == nsLayoutAtoms::tableBCProperty) {
value = new BCPropertyData;
dtorFunc = DestroyBCPropertyDataFunc;
}
if (!value) return nsnull;
frameManager->SetFrameProperty(aFrame, aPropertyName, value, dtorFunc);
return value;
}
void *value = frameManager->GetFrameProperty(aFrame, aPropertyName, 0);
if (value) {
return (nsPoint*)value; // the property already exists
} else if (aCreateIfNecessary) {
// The property isn't set yet, so allocate a new value, set the property,
// and return the newly allocated value
void* value = nsnull;
NSFramePropertyDtorFunc dtorFunc = nsnull;
if (aPropertyName == nsLayoutAtoms::collapseOffsetProperty) {
value = new nsPoint(0, 0);
dtorFunc = DestroyPointFunc;
}
else if (aPropertyName == nsLayoutAtoms::rowUnpaginatedHeightProperty) {
value = new nscoord;
dtorFunc = DestroyCoordFunc;
}
else if (aPropertyName == nsLayoutAtoms::tableBCProperty) {
value = new BCPropertyData;
dtorFunc = DestroyBCPropertyDataFunc;
}
if (!value) return nsnull;
frameManager->SetFrameProperty(aFrame, aPropertyName, value, dtorFunc);
return value;
}
return nsnull;

View File

@ -56,7 +56,6 @@
#include "nsMenuFrame.h"
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsIFrameManager.h"
#include "nsMenuPopupFrame.h"
#include "nsGUIEvent.h"
#include "nsUnicharUtils.h"

View File

@ -66,7 +66,6 @@
#include "nsIComponentManager.h"
#include "nsBoxLayoutState.h"
#include "nsIScrollableView.h"
#include "nsIFrameManager.h"
#include "nsGUIEvent.h"
#include "nsIRootBox.h"
#include "nsIDocShellTreeItem.h"