child list and changed ReparentFrameView() to check it.
This commit is contained in:
troy%netscape.com 2000-01-22 01:16:50 +00:00
Родитель 0445db254a
Коммит 8a78d916a5
127 изменённых файлов: 1345 добавлений и 946 удалений

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

@ -63,6 +63,7 @@ LAYOUT_ATOM(colGroupList, "ColGroup-list")
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
LAYOUT_ATOM(fixedList, "Fixed-list")
LAYOUT_ATOM(floaterList, "Floater-list")
LAYOUT_ATOM(overflowList, "Overflow-list")
LAYOUT_ATOM(popupList, "Popup-list")
// Alphabetical list of pseudo tag names for non-element content

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

@ -510,10 +510,12 @@ nsXULTreeElement::EnsureElementIsVisible(nsIDOMXULElement *aElement)
shell->GetPrimaryFrameFor(content, &outerFrame);
if (outerFrame) {
nsCOMPtr<nsIPresContext> presContext;
shell->GetPresContext(getter_AddRefs(presContext));
// need to look at the outer frame's children to find the nsTreeFrame
nsIFrame *childFrame=nsnull;
outerFrame->FirstChild(nsnull, &childFrame);
outerFrame->FirstChild(presContext, nsnull, &childFrame);
// now iterate through the children
while (childFrame) {

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

@ -552,9 +552,10 @@ nsCSSFrameConstructor::Init(nsIDocument* aDocument)
// Helper function that determines the child list name that aChildFrame
// is contained in
static void
GetChildListNameFor(nsIFrame* aParentFrame,
nsIFrame* aChildFrame,
nsIAtom** aListName)
GetChildListNameFor(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aChildFrame,
nsIAtom** aListName)
{
nsFrameState frameState;
nsIAtom* listName;
@ -586,7 +587,7 @@ GetChildListNameFor(nsIFrame* aParentFrame,
// Verify that the frame is actually in that child list
#ifdef NS_DEBUG
nsIFrame* firstChild;
aParentFrame->FirstChild(listName, &firstChild);
aParentFrame->FirstChild(aPresContext, listName, &firstChild);
nsFrameList frameList(firstChild);
NS_ASSERTION(frameList.ContainsFrame(aChildFrame), "not in child list");
@ -1319,7 +1320,7 @@ nsCSSFrameConstructor::ConstructTableCaptionFrame(nsIPresShell* aPres
if (NS_STYLE_DISPLAY_TABLE == parentDisplay->mDisplay) { // parent is an outer table
// determine the inner table frame, it is either aParentFrame or its first child
nsIFrame* parFrame = aParentFrame;
aParentFrame->FirstChild(nsnull, &innerFrame);
aParentFrame->FirstChild(aPresContext, nsnull, &innerFrame);
const nsStyleDisplay* innerDisplay;
innerFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)innerDisplay);
if (NS_STYLE_DISPLAY_TABLE != innerDisplay->mDisplay) {
@ -2094,7 +2095,7 @@ nsCSSFrameConstructor::TableGetAsNonScrollFrame(nsIPresContext* aPresConte
}
nsIFrame* result = aFrame;
if (IsScrollable(aPresContext, aDisplay)) {
aFrame->FirstChild(nsnull, &result);
aFrame->FirstChild(aPresContext, nsnull, &result);
}
return result;
}
@ -2207,7 +2208,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
if (mGfxScrollFrame)
{
nsIFrame* scrollPort = nsnull;
mGfxScrollFrame->FirstChild(nsnull, &scrollPort);
mGfxScrollFrame->FirstChild(aPresContext, nsnull, &scrollPort);
nsIFrame* gfxScrollbarFrame1 = nsnull;
nsIFrame* gfxScrollbarFrame2 = nsnull;
@ -2821,7 +2822,7 @@ nsCSSFrameConstructor::ConstructButtonFrames(nsIPresShell* aPresShell,
// Construct button label frame using generated content
// Get the first area frame to insert the button as a child.
nsIFrame* areaFrame = nsnull;
aFrame->FirstChild(nsnull, &areaFrame);
aFrame->FirstChild(aPresContext, nsnull, &areaFrame);
NS_ASSERTION(areaFrame != nsnull, "Button does not have an area frame");
nsresult rv = ConstructButtonLabelFrame(aPresShell, aPresContext, aContent, areaFrame, aState, aFrameItems);
return rv;
@ -3825,7 +3826,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
NS_NewISupportsArray(getter_AddRefs(anonymousItems));
creator->CreateAnonymousContent(*anonymousItems);
creator->CreateAnonymousContent(aPresContext, *anonymousItems);
PRUint32 count = 0;
anonymousItems->Count(&count);
@ -5055,9 +5056,10 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPresShell,
}
nsresult
nsCSSFrameConstructor::GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame)
nsCSSFrameConstructor::GetAdjustedParentFrame(nsIPresContext* aPresContext,
nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame)
{
NS_PRECONDITION(nsnull!=aCurrentParentFrame, "bad arg aCurrentParentFrame");
@ -5070,7 +5072,7 @@ nsCSSFrameConstructor::GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
if (NS_STYLE_DISPLAY_TABLE == currentParentDisplay->mDisplay) {
if (NS_STYLE_DISPLAY_TABLE_CAPTION != aChildDisplayType) {
nsIFrame *innerTableFrame = nsnull;
aCurrentParentFrame->FirstChild(nsnull, &innerTableFrame);
aCurrentParentFrame->FirstChild(aPresContext, nsnull, &innerTableFrame);
if (nsnull != innerTableFrame) {
const nsStyleDisplay* innerTableDisplay;
innerTableFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)innerTableDisplay);
@ -5554,13 +5556,13 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell,
if (NS_SUCCEEDED(res) && comboboxFrame) {
comboboxFrame->GetDropDown(&listFrame);
if (nsnull != listFrame) {
listFrame->FirstChild(nsnull, &frame);
listFrame->FirstChild(aPresContext, nsnull, &frame);
}
} else {
res = frame->QueryInterface(nsCOMTypeInfo<nsIListControlFrame>::GetIID(),
(void**)&listFrame);
if (NS_SUCCEEDED(res) && listFrame) {
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
}
}
} else {
@ -5570,13 +5572,13 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell,
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) {
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
}
// if we get an outer table frame use its 1st child which is a table inner frame
// if we get a table cell frame use its 1st child which is an area frame
else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) ||
(NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) {
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
}
}
}
@ -5612,7 +5614,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
if (nsLayoutAtoms::scrollFrame == frameType) {
// We want the scrolled frame, not the scroll frame
nsIFrame* scrolledFrame;
frame->FirstChild(nsnull, &scrolledFrame);
frame->FirstChild(aPresContext, nsnull, &scrolledFrame);
NS_RELEASE(frameType);
if (scrolledFrame) {
scrolledFrame->GetFrameType(&frameType);
@ -5739,7 +5741,7 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext,
nsIFrame* aFrameList)
{
nsIFrame* firstChild;
aParentFrame->FirstChild(nsnull, &firstChild);
aParentFrame->FirstChild(aPresContext, nsnull, &firstChild);
nsFrameList frames(firstChild);
nsIFrame* lastChild = frames.LastChild();
@ -6040,7 +6042,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
const nsStyleDisplay* firstAppendedFrameDisplay;
firstAppendedFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct *&)firstAppendedFrameDisplay);
result = GetAdjustedParentFrame(parentFrame,
result = GetAdjustedParentFrame(aPresContext, parentFrame,
firstAppendedFrameDisplay->mDisplay,
adjustedParentFrame);
}
@ -6147,7 +6149,7 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
// is equal to the select element's content
// this is because when gernated content is created it stuff the parent content
// pointer into the generated frame, so in this case it has the select content
parentFrame->FirstChild(nsnull, &childFrame);
parentFrame->FirstChild(aPresContext, nsnull, &childFrame);
nsCOMPtr<nsIContent> selectContent = do_QueryInterface(aSelectElement);
while (nsnull != childFrame) {
nsIContent * content;
@ -6508,7 +6510,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
// We're inserting the new frame as the first child. See if the
// parent has a :before pseudo-element
nsIFrame* firstChild;
parentFrame->FirstChild(nsnull, &firstChild);
parentFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild && IsGeneratedContentFor(aContainer, firstChild, nsCSSAtoms::beforePseudo)) {
// Insert the new frames after the :before pseudo-element
@ -6652,7 +6654,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
do {
// Recursively walk aFrame's child frames looking for placeholder frames
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
nsIAtom* frameType;
PRBool isPlaceholder;
@ -6685,7 +6687,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
// Get the child list name for the out-of-flow frame
nsIAtom* listName;
GetChildListNameFor(parentFrame, outOfFlowFrame, &listName);
GetChildListNameFor(aPresContext, parentFrame, outOfFlowFrame, &listName);
// Ask the parent to delete the out-of-flow frame
aFrameManager->RemoveFrame(aPresContext, *aPresShell, parentFrame,
@ -7036,7 +7038,9 @@ ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsIViewManager* aViewManager);
static void
SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame,
SyncAndInvalidateView(nsIPresContext* aPresContext,
nsIView* aView,
nsIFrame* aFrame,
nsIViewManager* aViewManager)
{
const nsStyleColor* color;
@ -7079,7 +7083,7 @@ SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame,
// hidden visibility and be visible anyway
nsIFrame* firstChild;
aFrame->FirstChild(nsnull, &firstChild);
aFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild) {
// It's not a left frame, so the view needs to be visible, but
// marked as having transparent content
@ -7122,7 +7126,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
aFrame->GetView(aPresContext, &view);
if (view) {
SyncAndInvalidateView(view, aFrame, aViewManager);
SyncAndInvalidateView(aPresContext, view, aFrame, aViewManager);
}
nsRect bounds;
@ -7138,7 +7142,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
do {
nsIFrame* child = nsnull;
aFrame->FirstChild(childList, &child);
aFrame->FirstChild(aPresContext, childList, &child);
while (child) {
nsFrameState childState;
child->GetFrameState(&childState);
@ -7678,8 +7682,8 @@ nsCSSFrameConstructor::StyleRuleChanged(nsIPresContext* aPresContext,
}
else {
// XXX hack, skip the root and scrolling frames
frame->FirstChild(nsnull, &frame);
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
if (reflow) {
StyleChangeReflow(aPresContext, frame, nsnull);
}
@ -7771,6 +7775,7 @@ nsCSSFrameConstructor::ConstructAlternateImageFrame(nsIPresShell* aPresShell,
// Create either an inline frame, block frame, or area frame
nsIFrame* containerFrame;
PRBool isOutOfFlow = PR_FALSE;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStylePosition* position = (const nsStylePosition*)
@ -7778,7 +7783,11 @@ nsCSSFrameConstructor::ConstructAlternateImageFrame(nsIPresShell* aPresShell,
if (position->IsAbsolutelyPositioned()) {
NS_NewAbsoluteItemWrapperFrame(aPresShell, &containerFrame);
} else if (display->IsFloating() || (NS_STYLE_DISPLAY_BLOCK == display->mDisplay)) {
isOutOfFlow = PR_TRUE;
} else if (display->IsFloating()) {
NS_NewFloatingItemWrapperFrame(aPresShell, &containerFrame);
isOutOfFlow = PR_TRUE;
} else if (NS_STYLE_DISPLAY_BLOCK == display->mDisplay) {
NS_NewBlockFrame(aPresShell, &containerFrame);
} else {
NS_NewInlineFrame(aPresShell, &containerFrame);
@ -7787,6 +7796,11 @@ nsCSSFrameConstructor::ConstructAlternateImageFrame(nsIPresShell* aPresShell,
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, containerFrame,
aStyleContext, PR_FALSE);
// If the frame is out-of-flow, then mark it as such
nsFrameState frameState;
containerFrame->GetFrameState(&frameState);
containerFrame->SetFrameState(frameState | NS_FRAME_OUT_OF_FLOW);
// Create a text frame to display the alt-text. It gets a pseudo-element
// style context
nsIFrame* textFrame;
@ -7843,7 +7857,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Get the child list name that the frame is contained in
nsCOMPtr<nsIAtom> listName;
GetChildListNameFor(parentFrame, aFrame, getter_AddRefs(listName));
GetChildListNameFor(aPresContext, parentFrame, aFrame, getter_AddRefs(listName));
// If the frame is out of the flow, then it has a placeholder frame.
nsIFrame* placeholderFrame = nsnull;
@ -7855,7 +7869,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Get the previous sibling frame
nsIFrame* firstChild;
parentFrame->FirstChild(listName, &firstChild);
parentFrame->FirstChild(aPresContext, listName, &firstChild);
nsFrameList frameList(firstChild);
// See whether it's an IMG or an OBJECT element
@ -7893,6 +7907,12 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Placeholder frames have a pointer back to the out-of-flow frame.
// Make sure that's correct, too.
((nsPlaceholderFrame*)placeholderFrame)->SetOutOfFlowFrame(newFrame);
// XXX Work around a bug in the block code where the floater won't get
// reflowed unless the line containing the placeholder frame is reflowed...
nsIFrame* placeholderParentFrame;
placeholderFrame->GetParent(&placeholderParentFrame);
placeholderParentFrame->ReflowDirtyChild(aPresShell, placeholderFrame);
}
}
@ -8041,7 +8061,7 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIFrame* childFrame;
nsFrameItems newChildFrames;
aFrame->FirstChild(nsnull, &childFrame);
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
nsIAtom* tableType;
@ -8121,7 +8141,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
nsIFrame* rowGroupFrame;
nsFrameItems childFrames;
aFrame->FirstChild(nsnull, &rowGroupFrame);
aFrame->FirstChild(aPresContext, nsnull, &rowGroupFrame);
while (rowGroupFrame) {
// See if it's a header/footer
nsIStyleContext* rowGroupStyle;
@ -8153,7 +8173,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
// Table specific initialization
((nsTableRowGroupFrame*)headerFooterFrame)->InitRepeatedFrame
((nsTableRowGroupFrame*)rowGroupFrame);
(aPresContext, (nsTableRowGroupFrame*)rowGroupFrame);
// XXX Deal with absolute and fixed frames...
childFrames.AddChild(headerFooterFrame);
@ -8274,7 +8294,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIFrame* cellFrame;
nsFrameItems newChildList;
aFrame->FirstChild(nsnull, &cellFrame);
aFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (cellFrame) {
nsIAtom* tableType;
@ -8305,7 +8325,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// Create a continuing area frame
nsIFrame* areaFrame;
nsIFrame* continuingAreaFrame;
aFrame->FirstChild(nsnull, &areaFrame);
aFrame->FirstChild(aPresContext, nsnull, &areaFrame);
CreateContinuingFrame(aPresShell, aPresContext, areaFrame, newFrame, &continuingAreaFrame);
// Set the table cell's initial child list
@ -8343,9 +8363,10 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// Helper function that searches the immediate child frames for a frame that
// maps the specified content object
static nsIFrame*
FindFrameWithContent(nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent)
FindFrameWithContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent)
{
NS_PRECONDITION(aParentFrame, "No frame to search!");
if (!aParentFrame) {
@ -8358,7 +8379,7 @@ keepLooking:
PRInt32 listIndex = 0;
do {
nsIFrame* kidFrame;
aParentFrame->FirstChild(listName, &kidFrame);
aParentFrame->FirstChild(aPresContext, listName, &kidFrame);
while (kidFrame) {
nsCOMPtr<nsIContent> kidContent;
@ -8383,7 +8404,7 @@ keepLooking:
// the same content pointer as its parent then we need to search its
// child frames, too
if (kidContent.get() == aParentContent) {
nsIFrame* matchingFrame = FindFrameWithContent(kidFrame, aParentContent,
nsIFrame* matchingFrame = FindFrameWithContent(aPresContext, kidFrame, aParentContent,
aContent);
if (matchingFrame) {
@ -8445,7 +8466,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
aFrameManager->GetPrimaryFrameFor(parentContent, &parentFrame);
if (parentFrame) {
// Search the child frames for a match
*aFrame = FindFrameWithContent(parentFrame, parentContent.get(), aContent);
*aFrame = FindFrameWithContent(aPresContext, parentFrame, parentContent.get(), aContent);
// If we found a match, then add a mapping to the hash table so
// next time this will be quick
@ -8803,7 +8824,7 @@ nsCSSFrameConstructor::AppendFirstLineFrames(
// It's possible that aBlockFrame needs to have a first-line frame
// created because it doesn't currently have any children.
nsIFrame* blockKid;
aBlockFrame->FirstChild(nsnull, &blockKid);
aBlockFrame->FirstChild(aPresContext, nsnull, &blockKid);
if (!blockKid) {
return WrapFramesInFirstLineFrame(aPresShell, aPresContext, aState, aContent,
aBlockFrame, aFrameItems);
@ -9352,7 +9373,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
else if ((nsLayoutAtoms::inlineFrame == frameType.get()) ||
(nsLayoutAtoms::lineFrame == frameType.get())) {
nsIFrame* kids;
frame->FirstChild(nsnull, &kids);
frame->FirstChild(aPresContext, nsnull, &kids);
WrapFramesInFirstLetterFrame(aPresShell, aPresContext, aState, frame, kids,
aModifiedParent, aTextFrame,
aPrevFrame, aLetterFrames, aStopLooking);
@ -9388,7 +9409,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
{
// First look for the floater frame that is a letter frame
nsIFrame* floater;
aBlockFrame->FirstChild(nsLayoutAtoms::floaterList, &floater);
aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floaterList, &floater);
while (floater) {
// See if we found a floating letter frame
nsCOMPtr<nsIAtom> frameType;
@ -9406,7 +9427,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
// Take the text frame away from the letter frame (so it isn't
// destroyed when we destroy the letter frame).
nsIFrame* textFrame;
floater->FirstChild(nsnull, &textFrame);
floater->FirstChild(aPresContext, nsnull, &textFrame);
if (!textFrame) {
return NS_OK;
}
@ -9511,7 +9532,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
{
nsIFrame* kid;
nsIFrame* prevSibling = nsnull;
aFrame->FirstChild(nsnull, &kid);
aFrame->FirstChild(aPresContext, nsnull, &kid);
while (kid) {
nsCOMPtr<nsIAtom> frameType;
@ -9519,7 +9540,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
if (nsLayoutAtoms::letterFrame == frameType.get()) {
// Bingo. Found it. First steal away the text frame.
nsIFrame* textFrame;
kid->FirstChild(nsnull, &textFrame);
kid->FirstChild(aPresContext, nsnull, &textFrame);
if (!textFrame) {
break;
}
@ -9600,7 +9621,7 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont
nsresult rv = NS_OK;
nsIFrame* blockKids;
aBlockFrame->FirstChild(nsnull, &blockKids);
aBlockFrame->FirstChild(aPresContext, nsnull, &blockKids);
nsIFrame* parentFrame = nsnull;
nsIFrame* textFrame = nsnull;
nsIFrame* prevFrame = nsnull;
@ -9685,7 +9706,7 @@ nsCSSFrameConstructor::CreateTreeWidgetContent(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
// Notify the parent frame
if (aIsScrollbar)
((nsTreeRowGroupFrame*)aParentFrame)->SetScrollbarFrame(newFrame);
((nsTreeRowGroupFrame*)aParentFrame)->SetScrollbarFrame(aPresContext, newFrame);
else if (aIsAppend)
rv = ((nsTreeRowGroupFrame*)aParentFrame)->TreeAppendFrames(newFrame);
else
@ -10182,7 +10203,8 @@ nsCSSFrameConstructor::ProcessInlineChildren(nsIPresShell* aPresShell,
// This differs from DeletingFrameSubtree() because the frames have not yet been
// added to the frame hierarchy
static void
DoCleanupFrameReferences(nsIFrameManager* aFrameManager,
DoCleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIFrame* aFrame)
{
nsCOMPtr<nsIContent> content;
@ -10195,9 +10217,9 @@ DoCleanupFrameReferences(nsIFrameManager* aFrameManager,
// Recursively walk the child frames.
// Note: we only need to look at the principal child list
nsIFrame* childFrame;
aFrame->FirstChild(nsnull, &childFrame);
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
DoCleanupFrameReferences(aFrameManager, childFrame);
DoCleanupFrameReferences(aPresContext, aFrameManager, childFrame);
// Get the next sibling child frame
childFrame->GetNextSibling(&childFrame);
@ -10206,11 +10228,12 @@ DoCleanupFrameReferences(nsIFrameManager* aFrameManager,
// Helper function that walks a frame list and calls DoCleanupFrameReference()
static void
CleanupFrameReferences(nsIFrameManager* aFrameManager,
CleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
while (aFrameList) {
DoCleanupFrameReferences(aFrameManager, aFrameList);
DoCleanupFrameReferences(aPresContext, aFrameManager, aFrameList);
// Get the sibling frame
aFrameList->GetNextSibling(&aFrameList);
@ -10241,21 +10264,21 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
// Destroy the frames. As we do make sure any content to frame mappings
// or entries in the undisplayed content map are removed
CleanupFrameReferences(frameManager, aFrameList);
CleanupFrameReferences(aPresContext, frameManager, aFrameList);
nsFrameList tmp(aFrameList);
tmp.DestroyFrames(aPresContext);
if (aState.mAbsoluteItems.childList) {
CleanupFrameReferences(frameManager, aState.mAbsoluteItems.childList);
CleanupFrameReferences(aPresContext, frameManager, aState.mAbsoluteItems.childList);
tmp.SetFrames(aState.mAbsoluteItems.childList);
tmp.DestroyFrames(aPresContext);
}
if (aState.mFixedItems.childList) {
CleanupFrameReferences(frameManager, aState.mFixedItems.childList);
CleanupFrameReferences(aPresContext, frameManager, aState.mFixedItems.childList);
tmp.SetFrames(aState.mFixedItems.childList);
tmp.DestroyFrames(aPresContext);
}
if (aState.mFloatedItems.childList) {
CleanupFrameReferences(frameManager, aState.mFloatedItems.childList);
CleanupFrameReferences(aPresContext, frameManager, aState.mFloatedItems.childList);
tmp.SetFrames(aState.mFloatedItems.childList);
tmp.DestroyFrames(aPresContext);
}

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

@ -579,9 +579,10 @@ protected:
nsIStyleContext* aStyleContext,
nsFrameItems& aFrameItems);
nsresult GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame);
nsresult GetAdjustedParentFrame(nsIPresContext* aPresContext,
nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame);
nsresult ProcessChildren(nsIPresShell* aPresShell,

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

@ -247,7 +247,7 @@ public:
nsIAtom* aPropertyName);
#ifdef NS_DEBUG
NS_IMETHOD DebugVerifyStyleTree(nsIFrame* aFrame);
NS_IMETHOD DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame);
#endif
private:
@ -906,7 +906,7 @@ VerifyContextParent(nsIFrame* aFrame, nsIStyleContext* aParentContext)
}
static void
VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsIStyleContext* aParentContext)
{
nsIStyleContext* context;
aFrame->GetStyleContext(&context);
@ -920,7 +920,7 @@ VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
do {
child = nsnull;
nsresult result = aFrame->FirstChild(childList, &child);
nsresult result = aFrame->FirstChild(aPresContext, childList, &child);
while ((NS_SUCCEEDED(result)) && child) {
nsFrameState state;
child->GetFrameState(&state);
@ -937,10 +937,10 @@ VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
VerifyContextParent(child, outOfFlowContext);
NS_RELEASE(outOfFlowContext);
VerifyStyleTree(outOfFlowFrame, context);
VerifyStyleTree(aPresContext, outOfFlowFrame, context);
}
else { // regular frame
VerifyStyleTree(child, context);
VerifyStyleTree(aPresContext, child, context);
}
NS_IF_RELEASE(frameType);
}
@ -969,13 +969,13 @@ VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
}
NS_IMETHODIMP
FrameManager::DebugVerifyStyleTree(nsIFrame* aFrame)
FrameManager::DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
if (aFrame) {
nsIStyleContext* context;
aFrame->GetStyleContext(&context);
nsIStyleContext* parentContext = context->GetParent();
VerifyStyleTree(aFrame, parentContext);
VerifyStyleTree(aPresContext, aFrame, parentContext);
NS_IF_RELEASE(parentContext);
NS_RELEASE(context);
}
@ -991,7 +991,7 @@ FrameManager::ReParentStyleContext(nsIPresContext* aPresContext,
nsresult result = NS_ERROR_NULL_POINTER;
if (aFrame) {
#ifdef NS_DEBUG
DebugVerifyStyleTree(aFrame);
DebugVerifyStyleTree(aPresContext, aFrame);
#endif
nsIStyleContext* oldContext = nsnull;
@ -1011,7 +1011,7 @@ FrameManager::ReParentStyleContext(nsIPresContext* aPresContext,
do {
child = nsnull;
result = aFrame->FirstChild(childList, &child);
result = aFrame->FirstChild(aPresContext, childList, &child);
while ((NS_SUCCEEDED(result)) && child) {
nsFrameState state;
child->GetFrameState(&state);
@ -1070,7 +1070,7 @@ FrameManager::ReParentStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef NS_DEBUG
VerifyStyleTree(aFrame, aNewParentContext);
VerifyStyleTree(aPresContext, aFrame, aNewParentContext);
#endif
}
NS_RELEASE(newContext);
@ -1285,7 +1285,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
do {
child = nsnull;
result = aFrame->FirstChild(childList, &child);
result = aFrame->FirstChild(aPresContext, childList, &child);
while ((NS_SUCCEEDED(result)) && (child)) {
nsFrameState state;
child->GetFrameState(&state);
@ -1349,7 +1349,7 @@ FrameManager::ComputeStyleChangeFor(nsIPresContext* aPresContext,
aAttrNameSpaceID, aAttribute,
aChangeList, aMinChange, frameChange);
#ifdef NS_DEBUG
VerifyStyleTree(frame, parentContext);
VerifyStyleTree(aPresContext, frame, parentContext);
#endif
NS_IF_RELEASE(parentContext);
NS_RELEASE(styleContext);
@ -1412,7 +1412,7 @@ FrameManager::CaptureFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame,
PRInt32 childListIndex = 0;
do {
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
rv = CaptureFrameState(aPresContext, childFrame, aState);
// Get the next sibling child frame
@ -1477,7 +1477,7 @@ FrameManager::RestoreFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame,
PRInt32 childListIndex = 0;
do {
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
rv = RestoreFrameState(aPresContext, childFrame, aState);
// Get the next sibling child frame

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

@ -79,26 +79,30 @@ private :
class nsLeafIterator: public nsFrameIterator
{
public:
nsLeafIterator(nsIFrame *start);
nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start);
private :
NS_IMETHOD Next();
NS_IMETHOD Prev();
nsIPresContext* mPresContext;
};
/************IMPLEMENTATIONS**************/
nsresult
NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIFrame *aStart)
NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
nsIPresContext* aPresContext,
nsIFrame *aStart)
{
if (!aEnumerator || !aStart)
return NS_ERROR_NULL_POINTER;
switch(aType)
{
case LEAF: {
nsLeafIterator *trav = new nsLeafIterator(aStart);
nsLeafIterator *trav = new nsLeafIterator(aPresContext, aStart);
if (!trav)
return NS_ERROR_OUT_OF_MEMORY;
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
@ -210,7 +214,8 @@ nsFrameIterator::Last()
/*********LEAFITERATOR**********/
nsLeafIterator::nsLeafIterator(nsIFrame *aStart)
nsLeafIterator::nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *aStart)
: mPresContext(aPresContext)
{
setStart(aStart);
setCurrent(aStart);
@ -227,7 +232,7 @@ nsLeafIterator::Next()
nsIFrame *parent = getCurrent();
if (!parent)
parent = getLast();
while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result)
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{
parent = result;
}
@ -239,7 +244,7 @@ nsLeafIterator::Next()
while(parent){
if (NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){
parent = result;
while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result)
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{
parent = result;
}
@ -275,12 +280,12 @@ nsLeafIterator::Prev()
while(parent){
nsIFrame *grandParent;
if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent &&
NS_SUCCEEDED(grandParent->FirstChild(nsnull,&result))){
NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){
nsFrameList list(result);
result = list.GetPrevSiblingFor(parent);
if (result){
parent = result;
while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result){
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result){
parent = result;
while(NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){
parent = result;

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

@ -26,7 +26,10 @@
#include "nsIFrame.h"
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST};
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIFrame *aStart);
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
nsIPresContext* aPresContext,
nsIFrame *aStart);
#endif //NSFRAMETRAVERSAL_H

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

@ -63,6 +63,7 @@ LAYOUT_ATOM(colGroupList, "ColGroup-list")
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
LAYOUT_ATOM(fixedList, "Fixed-list")
LAYOUT_ATOM(floaterList, "Floater-list")
LAYOUT_ATOM(overflowList, "Overflow-list")
LAYOUT_ATOM(popupList, "Popup-list")
// Alphabetical list of pseudo tag names for non-element content

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

@ -503,16 +503,16 @@ private:
#ifdef NS_DEBUG
static void
VerifyStyleTree(nsIFrameManager* aFrameManager)
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager)
{
if (aFrameManager && nsIFrameDebug::GetVerifyStyleTreeEnable()) {
nsIFrame* rootFrame;
aFrameManager->GetRootFrame(&rootFrame);
aFrameManager->DebugVerifyStyleTree(rootFrame);
aFrameManager->DebugVerifyStyleTree(aPresContext, rootFrame);
}
}
#define VERIFY_STYLE_TREE VerifyStyleTree(mFrameManager)
#define VERIFY_STYLE_TREE VerifyStyleTree(mPresContext, mFrameManager)
#else
#define VERIFY_STYLE_TREE
#endif
@ -1566,7 +1566,7 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
// The page sequence frame is the child of the rootFrame
mFrameManager->GetRootFrame(&rootFrame);
rootFrame->FirstChild(nsnull, &child);
rootFrame->FirstChild(mPresContext, nsnull, &child);
if (nsnull != child) {
@ -2885,8 +2885,8 @@ CompareTrees(nsIPresContext* aPresContext, nsIFrame* aA, nsIFrame* aB)
PRInt32 listIndex = 0;
do {
nsIFrame* k1, *k2;
aA->FirstChild(listName, &k1);
aB->FirstChild(listName, &k2);
aA->FirstChild(aPresContext, listName, &k1);
aB->FirstChild(aPresContext, listName, &k2);
PRInt32 l1 = nsContainerFrame::LengthOf(k1);
PRInt32 l2 = nsContainerFrame::LengthOf(k2);
if (l1 != l2) {

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

@ -26,7 +26,10 @@
#include "nsIFrame.h"
enum nsTraversalType{LEAF, EXTENSIVE, FASTEST};
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIFrame *aStart);
nsresult NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
nsIPresContext* aPresContext,
nsIFrame *aStart);
#endif //NSFRAMETRAVERSAL_H

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

@ -636,7 +636,9 @@ public:
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified name
* @see #GetAdditionalListName()
*/
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const = 0;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const = 0;
/**
* Child frames are linked together in a singly-linked

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

@ -217,7 +217,7 @@ public:
/**
* DEBUG ONLY method to verify integrity of style tree versus frame tree
*/
NS_IMETHOD DebugVerifyStyleTree(nsIFrame* aFrame) = 0;
NS_IMETHOD DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame) = 0;
#endif
};

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

@ -63,6 +63,7 @@ LAYOUT_ATOM(colGroupList, "ColGroup-list")
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
LAYOUT_ATOM(fixedList, "Fixed-list")
LAYOUT_ATOM(floaterList, "Floater-list")
LAYOUT_ATOM(overflowList, "Overflow-list")
LAYOUT_ATOM(popupList, "Popup-list")
// Alphabetical list of pseudo tag names for non-element content

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

@ -79,26 +79,30 @@ private :
class nsLeafIterator: public nsFrameIterator
{
public:
nsLeafIterator(nsIFrame *start);
nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *start);
private :
NS_IMETHOD Next();
NS_IMETHOD Prev();
nsIPresContext* mPresContext;
};
/************IMPLEMENTATIONS**************/
nsresult
NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator, nsTraversalType aType, nsIFrame *aStart)
NS_NewFrameTraversal(nsIBidirectionalEnumerator **aEnumerator,
nsTraversalType aType,
nsIPresContext* aPresContext,
nsIFrame *aStart)
{
if (!aEnumerator || !aStart)
return NS_ERROR_NULL_POINTER;
switch(aType)
{
case LEAF: {
nsLeafIterator *trav = new nsLeafIterator(aStart);
nsLeafIterator *trav = new nsLeafIterator(aPresContext, aStart);
if (!trav)
return NS_ERROR_OUT_OF_MEMORY;
*aEnumerator = NS_STATIC_CAST(nsIBidirectionalEnumerator*, trav);
@ -210,7 +214,8 @@ nsFrameIterator::Last()
/*********LEAFITERATOR**********/
nsLeafIterator::nsLeafIterator(nsIFrame *aStart)
nsLeafIterator::nsLeafIterator(nsIPresContext* aPresContext, nsIFrame *aStart)
: mPresContext(aPresContext)
{
setStart(aStart);
setCurrent(aStart);
@ -227,7 +232,7 @@ nsLeafIterator::Next()
nsIFrame *parent = getCurrent();
if (!parent)
parent = getLast();
while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result)
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{
parent = result;
}
@ -239,7 +244,7 @@ nsLeafIterator::Next()
while(parent){
if (NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){
parent = result;
while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result)
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result)
{
parent = result;
}
@ -275,12 +280,12 @@ nsLeafIterator::Prev()
while(parent){
nsIFrame *grandParent;
if (NS_SUCCEEDED(parent->GetParent(&grandParent)) && grandParent &&
NS_SUCCEEDED(grandParent->FirstChild(nsnull,&result))){
NS_SUCCEEDED(grandParent->FirstChild(mPresContext, nsnull,&result))){
nsFrameList list(result);
result = list.GetPrevSiblingFor(parent);
if (result){
parent = result;
while(NS_SUCCEEDED(parent->FirstChild(nsnull,&result)) && result){
while(NS_SUCCEEDED(parent->FirstChild(mPresContext, nsnull,&result)) && result){
parent = result;
while(NS_SUCCEEDED(parent->GetNextSibling(&result)) && result){
parent = result;

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

@ -1340,7 +1340,8 @@ nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
NS_IMETHODIMP
nsComboboxControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList)
nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList)
{
// The frames used to display the combo box and the button used to popup the dropdown list
// are created through anonymous content. The dropdown list is not created through anonymous
@ -1402,13 +1403,14 @@ nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext)
NS_IMETHODIMP
nsComboboxControlFrame::FirstChild(nsIAtom* aListName,
nsIFrame** aFirstChild) const
nsComboboxControlFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
if (nsLayoutAtoms::popupList == aListName) {
*aFirstChild = mPopupFrames.FirstChild();
} else {
nsAreaFrame::FirstChild(aListName, aFirstChild);
nsAreaFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
return NS_OK;
}

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

@ -67,7 +67,8 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aChildList);
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList);
// nsIFrame
NS_IMETHOD Init(nsIPresContext* aPresContext,
@ -89,7 +90,9 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const;
#endif
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);

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

@ -100,7 +100,8 @@ nsFileControlFrame::~nsFileControlFrame()
}
NS_IMETHODIMP
nsFileControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList)
nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList)
{
// create text field
@ -280,7 +281,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
if (mFormFrame == nsnull && eReflowReason_Initial == aReflowState.reason) {
// add ourself as an nsIFormControlFrame
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
mTextFrame = GetTextControlFrame(this);
mTextFrame = GetTextControlFrame(aPresContext, this);
if (!mTextFrame) return NS_ERROR_UNEXPECTED;
if (mCachedState) {
mTextFrame->SetProperty(aPresContext, nsHTMLAtoms::value, *mCachedState);
@ -312,11 +313,11 @@ nsFileControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
* node from the constructor and we find it in our tree.
*/
nsTextControlFrame*
nsFileControlFrame::GetTextControlFrame(nsIFrame* aStart)
nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* aStart)
{
// find the text control frame.
nsIFrame* childFrame = nsnull;
aStart->FirstChild(nsnull, &childFrame);
aStart->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
// see if the child is a text control
@ -336,7 +337,7 @@ nsFileControlFrame::GetTextControlFrame(nsIFrame* aStart)
}
// if not continue looking
nsTextControlFrame* frame = GetTextControlFrame(childFrame);
nsTextControlFrame* frame = GetTextControlFrame(aPresContext, childFrame);
if (frame)
return frame;

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

@ -115,7 +115,8 @@ public:
// from nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aChildList);
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList);
// mouse events when out browse button is pressed
@ -183,7 +184,8 @@ protected:
nsIPresContext* mPresContext; // weak reference
private:
nsTextControlFrame* GetTextControlFrame(nsIFrame* aStart);
nsTextControlFrame* GetTextControlFrame(nsIPresContext* aPresContext,
nsIFrame* aStart);
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }

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

@ -194,7 +194,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
value = " ";
// The child frame will br the generated content
nsIFrame* fKid;
firstKid->FirstChild(nsnull, &fKid);
firstKid->FirstChild(aPresContext, nsnull, &fKid);
if (fKid) {
const nsStyleContent* content;
fKid->GetStyleData(eStyleStruct_Content, (const nsStyleStruct *&)content);

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

@ -159,14 +159,16 @@ nsAreaFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
nsAreaFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsAreaFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::absoluteList) {
return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild);
}
return nsBlockFrame::FirstChild(aListName, aFirstChild);
return nsBlockFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
static void

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

@ -71,7 +71,9 @@ public:
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

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

@ -348,7 +348,7 @@ public:
PRBool ClearPastFloaters(PRUint8 aBreakType);
PRBool IsLeftMostChild(nsIFrame* aFrame);
PRBool IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
PRBool IsAdjacentWithTop() const {
return mY == mReflowState.mComputedBorderPadding.top;
@ -1270,7 +1270,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (nsnull == listName) {
break;
}
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
@ -1331,13 +1331,20 @@ nsBlockFrame::GetFrameType(nsIAtom** aType) const
// Child frame enumeration
NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsBlockFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (nsnull == aListName) {
*aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::overflowList) {
nsLineBox* overflowLines = GetOverflowLines(aPresContext, PR_FALSE);
*aFirstChild = overflowLines ? overflowLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
*aFirstChild = mFloaters.FirstChild();
return NS_OK;
@ -1449,7 +1456,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
NS_BLOCK_MARGIN_ROOT & mState);
if (eReflowReason_Resize != aReflowState.reason) {
RenumberLists();
RenumberLists(aPresContext);
ComputeTextRuns(aPresContext);
}
@ -3107,7 +3114,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
}
if (nsHTMLAtoms::start == aAttribute) {
// XXX Not sure if this is necessary anymore
RenumberLists();
RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -3144,7 +3151,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
// itself
if (nsnull != blockParent) {
// XXX Not sure if this is necessary anymore
blockParent->RenumberLists();
blockParent->RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -4557,7 +4564,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
nsLineBox*
nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -4573,7 +4580,7 @@ nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowLinesProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowLinesProperty,
options, &value);
return (nsLineBox*)value;
}
@ -5184,7 +5191,7 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
}
PRBool
nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
for (;;) {
nsIFrame* parent;
@ -5209,7 +5216,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
// See if there are any non-zero sized child frames that precede
// aFrame in the child list
nsIFrame* child;
parent->FirstChild(nsnull, &child);
parent->FirstChild(aPresContext, nsnull, &child);
while ((nsnull != child) && (aFrame != child)) {
nsSize size;
@ -6245,7 +6252,7 @@ nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
}
void
nsBlockFrame::RenumberLists()
nsBlockFrame::RenumberLists(nsIPresContext* aPresContext)
{
if (!FrameStartsCounterScope(this)) {
// If this frame doesn't start a counter scope then we don't need
@ -6273,11 +6280,12 @@ nsBlockFrame::RenumberLists()
// Get to first-in-flow
nsBlockFrame* block = (nsBlockFrame*) GetFirstInFlow();
RenumberListsInBlock(block, &ordinal);
RenumberListsInBlock(aPresContext, block, &ordinal);
}
PRBool
nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsBlockFrame::RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aBlockFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6289,7 +6297,7 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsIFrame* kid = line->mFirstChild;
PRInt32 n = line->GetChildCount();
while (--n >= 0) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
line->MarkDirty();
renumberedABullet = PR_TRUE;
@ -6309,7 +6317,9 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
// XXX temporary code: after ib work is done in frame construction
// code this can be removed.
PRBool
nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6317,9 +6327,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
while (nsnull != aContainerFrame) {
// For each frame in the flow-block...
nsIFrame* kid;
aContainerFrame->FirstChild(nsnull, &kid);
aContainerFrame->FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
renumberedABullet = PR_TRUE;
}
@ -6331,7 +6341,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
}
PRBool
nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
nsIFrame* aKid,
PRInt32* aOrdinal)
{
PRBool kidRenumberedABullet = PR_FALSE;
@ -6359,7 +6371,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
// XXX temporary? if the list-item has child list-items they
// should be numbered too; especially since the list-item is
// itself (ASSUMED!) not to be a counter-reseter.
PRBool meToo = RenumberListsInBlock(listItem, aOrdinal);
PRBool meToo = RenumberListsInBlock(aPresContext, listItem, aOrdinal);
if (meToo) {
kidRenumberedABullet = PR_TRUE;
}
@ -6378,7 +6390,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame* kidBlock;
nsresult rv = aKid->QueryInterface(kBlockFrameCID, (void**) &kidBlock);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsInBlock(kidBlock, aOrdinal);
kidRenumberedABullet = RenumberListsInBlock(aPresContext, kidBlock, aOrdinal);
}
}
} else if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
@ -6392,7 +6404,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsresult rv = aKid->QueryInterface(nsInlineFrame::kInlineFrameCID,
(void**) &kidInline);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsIn(aKid, aOrdinal);
kidRenumberedABullet = RenumberListsIn(aPresContext, aKid, aOrdinal);
}
}
return kidRenumberedABullet;

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

@ -85,7 +85,9 @@ public:
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
@ -326,14 +328,17 @@ protected:
//----------------------------------------
// List handling kludge
void RenumberLists();
void RenumberLists(nsIPresContext* aPresContext);
PRBool RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal);
PRBool RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal);
PRBool RenumberListsInBlock(nsBlockFrame* aContainerFrame,
PRBool RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aContainerFrame,
PRInt32* aOrdinal);
PRBool RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal);
PRBool RenumberListsFor(nsIPresContext* aPresContext, nsIFrame* aKid, PRInt32* aOrdinal);
PRBool FrameStartsCounterScope(nsIFrame* aFrame);
@ -345,7 +350,7 @@ protected:
//----------------------------------------
nsLineBox* GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty);
PRBool aRemoveProperty) const;
nsresult SetOverflowLines(nsIPresContext* aPresContext,
nsLineBox* aOverflowFrames);

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

@ -348,7 +348,7 @@ public:
PRBool ClearPastFloaters(PRUint8 aBreakType);
PRBool IsLeftMostChild(nsIFrame* aFrame);
PRBool IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
PRBool IsAdjacentWithTop() const {
return mY == mReflowState.mComputedBorderPadding.top;
@ -1270,7 +1270,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (nsnull == listName) {
break;
}
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
@ -1331,13 +1331,20 @@ nsBlockFrame::GetFrameType(nsIAtom** aType) const
// Child frame enumeration
NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsBlockFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (nsnull == aListName) {
*aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::overflowList) {
nsLineBox* overflowLines = GetOverflowLines(aPresContext, PR_FALSE);
*aFirstChild = overflowLines ? overflowLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
*aFirstChild = mFloaters.FirstChild();
return NS_OK;
@ -1449,7 +1456,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
NS_BLOCK_MARGIN_ROOT & mState);
if (eReflowReason_Resize != aReflowState.reason) {
RenumberLists();
RenumberLists(aPresContext);
ComputeTextRuns(aPresContext);
}
@ -3107,7 +3114,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
}
if (nsHTMLAtoms::start == aAttribute) {
// XXX Not sure if this is necessary anymore
RenumberLists();
RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -3144,7 +3151,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
// itself
if (nsnull != blockParent) {
// XXX Not sure if this is necessary anymore
blockParent->RenumberLists();
blockParent->RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -4557,7 +4564,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
nsLineBox*
nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -4573,7 +4580,7 @@ nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowLinesProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowLinesProperty,
options, &value);
return (nsLineBox*)value;
}
@ -5184,7 +5191,7 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
}
PRBool
nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
for (;;) {
nsIFrame* parent;
@ -5209,7 +5216,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
// See if there are any non-zero sized child frames that precede
// aFrame in the child list
nsIFrame* child;
parent->FirstChild(nsnull, &child);
parent->FirstChild(aPresContext, nsnull, &child);
while ((nsnull != child) && (aFrame != child)) {
nsSize size;
@ -6245,7 +6252,7 @@ nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
}
void
nsBlockFrame::RenumberLists()
nsBlockFrame::RenumberLists(nsIPresContext* aPresContext)
{
if (!FrameStartsCounterScope(this)) {
// If this frame doesn't start a counter scope then we don't need
@ -6273,11 +6280,12 @@ nsBlockFrame::RenumberLists()
// Get to first-in-flow
nsBlockFrame* block = (nsBlockFrame*) GetFirstInFlow();
RenumberListsInBlock(block, &ordinal);
RenumberListsInBlock(aPresContext, block, &ordinal);
}
PRBool
nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsBlockFrame::RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aBlockFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6289,7 +6297,7 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsIFrame* kid = line->mFirstChild;
PRInt32 n = line->GetChildCount();
while (--n >= 0) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
line->MarkDirty();
renumberedABullet = PR_TRUE;
@ -6309,7 +6317,9 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
// XXX temporary code: after ib work is done in frame construction
// code this can be removed.
PRBool
nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6317,9 +6327,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
while (nsnull != aContainerFrame) {
// For each frame in the flow-block...
nsIFrame* kid;
aContainerFrame->FirstChild(nsnull, &kid);
aContainerFrame->FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
renumberedABullet = PR_TRUE;
}
@ -6331,7 +6341,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
}
PRBool
nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
nsIFrame* aKid,
PRInt32* aOrdinal)
{
PRBool kidRenumberedABullet = PR_FALSE;
@ -6359,7 +6371,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
// XXX temporary? if the list-item has child list-items they
// should be numbered too; especially since the list-item is
// itself (ASSUMED!) not to be a counter-reseter.
PRBool meToo = RenumberListsInBlock(listItem, aOrdinal);
PRBool meToo = RenumberListsInBlock(aPresContext, listItem, aOrdinal);
if (meToo) {
kidRenumberedABullet = PR_TRUE;
}
@ -6378,7 +6390,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame* kidBlock;
nsresult rv = aKid->QueryInterface(kBlockFrameCID, (void**) &kidBlock);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsInBlock(kidBlock, aOrdinal);
kidRenumberedABullet = RenumberListsInBlock(aPresContext, kidBlock, aOrdinal);
}
}
} else if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
@ -6392,7 +6404,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsresult rv = aKid->QueryInterface(nsInlineFrame::kInlineFrameCID,
(void**) &kidInline);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsIn(aKid, aOrdinal);
kidRenumberedABullet = RenumberListsIn(aPresContext, aKid, aOrdinal);
}
}
return kidRenumberedABullet;

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

@ -348,7 +348,7 @@ public:
PRBool ClearPastFloaters(PRUint8 aBreakType);
PRBool IsLeftMostChild(nsIFrame* aFrame);
PRBool IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
PRBool IsAdjacentWithTop() const {
return mY == mReflowState.mComputedBorderPadding.top;
@ -1270,7 +1270,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (nsnull == listName) {
break;
}
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
@ -1331,13 +1331,20 @@ nsBlockFrame::GetFrameType(nsIAtom** aType) const
// Child frame enumeration
NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsBlockFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (nsnull == aListName) {
*aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::overflowList) {
nsLineBox* overflowLines = GetOverflowLines(aPresContext, PR_FALSE);
*aFirstChild = overflowLines ? overflowLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
*aFirstChild = mFloaters.FirstChild();
return NS_OK;
@ -1449,7 +1456,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
NS_BLOCK_MARGIN_ROOT & mState);
if (eReflowReason_Resize != aReflowState.reason) {
RenumberLists();
RenumberLists(aPresContext);
ComputeTextRuns(aPresContext);
}
@ -3107,7 +3114,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
}
if (nsHTMLAtoms::start == aAttribute) {
// XXX Not sure if this is necessary anymore
RenumberLists();
RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -3144,7 +3151,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
// itself
if (nsnull != blockParent) {
// XXX Not sure if this is necessary anymore
blockParent->RenumberLists();
blockParent->RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -4557,7 +4564,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
nsLineBox*
nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -4573,7 +4580,7 @@ nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowLinesProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowLinesProperty,
options, &value);
return (nsLineBox*)value;
}
@ -5184,7 +5191,7 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
}
PRBool
nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
for (;;) {
nsIFrame* parent;
@ -5209,7 +5216,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
// See if there are any non-zero sized child frames that precede
// aFrame in the child list
nsIFrame* child;
parent->FirstChild(nsnull, &child);
parent->FirstChild(aPresContext, nsnull, &child);
while ((nsnull != child) && (aFrame != child)) {
nsSize size;
@ -6245,7 +6252,7 @@ nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
}
void
nsBlockFrame::RenumberLists()
nsBlockFrame::RenumberLists(nsIPresContext* aPresContext)
{
if (!FrameStartsCounterScope(this)) {
// If this frame doesn't start a counter scope then we don't need
@ -6273,11 +6280,12 @@ nsBlockFrame::RenumberLists()
// Get to first-in-flow
nsBlockFrame* block = (nsBlockFrame*) GetFirstInFlow();
RenumberListsInBlock(block, &ordinal);
RenumberListsInBlock(aPresContext, block, &ordinal);
}
PRBool
nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsBlockFrame::RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aBlockFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6289,7 +6297,7 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsIFrame* kid = line->mFirstChild;
PRInt32 n = line->GetChildCount();
while (--n >= 0) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
line->MarkDirty();
renumberedABullet = PR_TRUE;
@ -6309,7 +6317,9 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
// XXX temporary code: after ib work is done in frame construction
// code this can be removed.
PRBool
nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6317,9 +6327,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
while (nsnull != aContainerFrame) {
// For each frame in the flow-block...
nsIFrame* kid;
aContainerFrame->FirstChild(nsnull, &kid);
aContainerFrame->FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
renumberedABullet = PR_TRUE;
}
@ -6331,7 +6341,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
}
PRBool
nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
nsIFrame* aKid,
PRInt32* aOrdinal)
{
PRBool kidRenumberedABullet = PR_FALSE;
@ -6359,7 +6371,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
// XXX temporary? if the list-item has child list-items they
// should be numbered too; especially since the list-item is
// itself (ASSUMED!) not to be a counter-reseter.
PRBool meToo = RenumberListsInBlock(listItem, aOrdinal);
PRBool meToo = RenumberListsInBlock(aPresContext, listItem, aOrdinal);
if (meToo) {
kidRenumberedABullet = PR_TRUE;
}
@ -6378,7 +6390,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame* kidBlock;
nsresult rv = aKid->QueryInterface(kBlockFrameCID, (void**) &kidBlock);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsInBlock(kidBlock, aOrdinal);
kidRenumberedABullet = RenumberListsInBlock(aPresContext, kidBlock, aOrdinal);
}
}
} else if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
@ -6392,7 +6404,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsresult rv = aKid->QueryInterface(nsInlineFrame::kInlineFrameCID,
(void**) &kidInline);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsIn(aKid, aOrdinal);
kidRenumberedABullet = RenumberListsIn(aPresContext, aKid, aOrdinal);
}
}
return kidRenumberedABullet;

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

@ -101,13 +101,19 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext)
// Child frame enumeration
NS_IMETHODIMP
nsContainerFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsContainerFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
// We only know about the unnamed principal child list
// We only know about the unnamed principal child list and the overflow
// list
if (nsnull == aListName) {
*aFirstChild = mFrames.FirstChild();
return NS_OK;
} else if (nsLayoutAtoms::overflowList == aListName) {
*aFirstChild = GetOverflowFrames(aPresContext, PR_FALSE);
return NS_OK;
} else {
*aFirstChild = nsnull;
return NS_ERROR_INVALID_ARG;
@ -255,7 +261,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
// point. We try to use a quick check on the child frames bbox to
// avoid a potentially expensive recursion into the child frames
// GetFrameForPoint method.
FirstChild(aList, &kid);
FirstChild(aPresContext, aList, &kid);
while (nsnull != kid) {
kid->GetRect(kidRect);
// Do a quick check and see if the child frame contains the point
@ -282,7 +288,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
// Try again, this time looking only inside child frames that have
// outside children.
FirstChild(aList, &kid);
FirstChild(aPresContext, aList, &kid);
while (nsnull != kid) {
nsFrameState state;
kid->GetFrameState(&state);
@ -321,7 +327,7 @@ nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext,
nsresult rv;
// Get the old frame's previous sibling frame
FirstChild(aListName, &firstChild);
FirstChild(aPresContext, aListName, &firstChild);
nsFrameList frames(firstChild);
NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame");
prevFrame = frames.GetPrevSiblingFor(aOldFrame);
@ -498,7 +504,7 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
// hidden visibility and be visible anyway
nsIFrame* firstChild;
aFrame->FirstChild(nsnull, &firstChild);
aFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild) {
// Not a left frame, so the view needs to be visible, but marked
// as having transparent content
@ -677,7 +683,7 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
do {
// Recursively walk aFrame's child frames
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
nsIView* view;
@ -805,7 +811,7 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
nsIFrame*
nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -821,7 +827,7 @@ nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowProperty,
options, &value);
return (nsIFrame*)value;
}
@ -992,7 +998,7 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
PRBool outputOneList = PR_FALSE;
do {
nsIFrame* kid;
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
if (outputOneList) {
IndentBy(out, aIndent);
@ -1005,8 +1011,13 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
}
fputs("<\n", out);
while (nsnull != kid) {
nsIFrameDebug* frameDebug;
// Verify the child frame's parent frame pointer is correct
nsIFrame* parentFrame;
kid->GetParent(&parentFrame);
NS_ASSERTION(parentFrame == (nsIFrame*)this, "bad parent frame pointer");
// Have the child frame list
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) {
frameDebug->List(aPresContext, out, aIndent + 1);
}

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

@ -42,7 +42,9 @@ public:
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -171,7 +173,7 @@ protected:
* Get the frames on the overflow list
*/
nsIFrame* GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty);
PRBool aRemoveProperty) const;
/**
* Set the overflow list

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

@ -57,7 +57,11 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout);
//override of nsFrame method
NS_IMETHOD GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, PRInt32* outFrameContentOffset, nsIFrame **outChildFrame);
NS_IMETHOD GetChildFrameContainingOffset(nsIPresContext* aPresContext,
PRInt32 inContentOffset,
PRBool inHint,
PRInt32* outFrameContentOffset,
nsIFrame **outChildFrame);
protected:
virtual PRIntn GetSkipSides() const;
@ -165,7 +169,7 @@ nsFirstLetterFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRang
if (aSelected && ParentDisablesSelection())
return NS_OK;
nsIFrame *child;
nsresult result = FirstChild(nsnull, &child);
nsresult result = FirstChild(aPresContext, nsnull, &child);
while (NS_SUCCEEDED(result) && child)
{
child->SetSelected(aPresContext,aRange, aSelected,aSpread);//dont worry about result. there are more frames to come
@ -186,10 +190,14 @@ nsFirstLetterFrame::FindTextRuns(nsLineLayout& aLineLayout)
}
NS_IMETHODIMP
nsFirstLetterFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, PRInt32* outFrameContentOffset, nsIFrame **outChildFrame)
nsFirstLetterFrame::GetChildFrameContainingOffset(nsIPresContext* aPresContext,
PRInt32 inContentOffset,
PRBool inHint,
PRInt32* outFrameContentOffset,
nsIFrame **outChildFrame)
{
nsIFrame *kid;
nsresult result = FirstChild(nsnull, &kid);
nsresult result = FirstChild(aPresContext, nsnull, &kid);
if (NS_SUCCEEDED(result) && kid)
{
return kid->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame);

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

@ -566,7 +566,9 @@ nsFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const
return aIndex < 0 ? NS_ERROR_INVALID_ARG : NS_OK;
}
NS_IMETHODIMP nsFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
NS_IMETHODIMP nsFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
*aFirstChild = nsnull;
return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG;
@ -1034,7 +1036,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
if (NS_FAILED(result))
return result;
result = FirstChild(nsnull, &kid);
result = FirstChild(aCX, nsnull, &kid);
if (NS_SUCCEEDED(result) && nsnull != kid) {
@ -1802,7 +1804,7 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32
nsIAtom* list = nsnull;
PRInt32 listIndex = 0;
do {
nsresult rv = FirstChild(list, &kid);
nsresult rv = FirstChild(aPresContext, list, &kid);
if (NS_SUCCEEDED(rv) && (nsnull != kid)) {
IndentBy(out, aIndent);
if (nsnull != list) {
@ -2056,7 +2058,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
continue;
}
}
GetLastLeaf(&lastFrame);
GetLastLeaf(aPresContext, &lastFrame);
if (aPos->mDirection == eDirNext){
nearStoppingFrame = firstFrame;
@ -2087,7 +2089,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
nsCOMPtr<nsIBidirectionalEnumerator> frameTraversal;
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF,
resultFrame);
aPresContext, resultFrame);
if (NS_FAILED(result))
return result;
nsISupports *isupports = nsnull;
@ -2127,7 +2129,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
if (!found){
resultFrame = storeOldResultFrame;
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF,
resultFrame);
aPresContext, resultFrame);
}
while ( !found ){
nsCOMPtr<nsIPresContext> context;
@ -2211,7 +2213,7 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
if ((aPos->mDirection == eDirNext && newOffset < aPos->mStartOffset) || //need to go to next one
(aPos->mDirection == eDirPrevious && newOffset >= aPos->mStartOffset))
{
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_FAILED(result) || !aPos->mResultFrame)
{
return result?result:NS_ERROR_FAILURE;
@ -2440,7 +2442,7 @@ nsFrame::GetLineNumber(nsIFrame *aFrame)
//this should change to use geometry and also look to ALL the child lists
//we need to set up line information to make sure we dont jump across line boundaries
NS_IMETHODIMP
nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos)
nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
nsIFrame *blockFrame = this;
nsIFrame *thisBlock;
@ -2483,8 +2485,8 @@ nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos)
}
}
GetFirstLeaf( &firstFrame);
GetLastLeaf(&lastFrame);
GetFirstLeaf(aPresContext, &firstFrame);
GetLastLeaf(aPresContext, &lastFrame);
//END LINE DATA CODE
if ((aPos->mDirection == eDirNext && lastFrame == this)
||(aPos->mDirection == eDirPrevious && firstFrame == this))
@ -2510,7 +2512,7 @@ nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos)
if (aPos->mAmount == eSelectDir)
aPos->mAmount = eSelectNoAmount;//just get to next frame.
nsCOMPtr<nsIBidirectionalEnumerator> frameTraversal;
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF,this);
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF, aPresContext, this);
if (NS_FAILED(result))
return result;
nsISupports *isupports = nsnull;
@ -2592,7 +2594,7 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr
}
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(nsnull, &aFrame);
aFrame->FirstChild(aPresContext, nsnull, &aFrame);
while (aFrame) {
RefreshAllContentFrames(aPresContext, aFrame, aContent);
aFrame->GetNextSibling(&aFrame);
@ -2631,7 +2633,7 @@ void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool)
}
void
nsFrame::GetLastLeaf(nsIFrame **aFrame)
nsFrame::GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame)
{
if (!aFrame || !*aFrame)
return;
@ -2639,7 +2641,7 @@ nsFrame::GetLastLeaf(nsIFrame **aFrame)
nsresult result;
nsIFrame *lookahead = nsnull;
while (1){
result = child->FirstChild(nsnull, &lookahead);
result = child->FirstChild(aPresContext, nsnull, &lookahead);
if (NS_FAILED(result) || !lookahead)
return;//nothing to do
child = lookahead;
@ -2651,7 +2653,7 @@ nsFrame::GetLastLeaf(nsIFrame **aFrame)
}
void
nsFrame::GetFirstLeaf(nsIFrame **aFrame)
nsFrame::GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame)
{
if (!aFrame || !*aFrame)
return;
@ -2659,7 +2661,7 @@ nsFrame::GetFirstLeaf(nsIFrame **aFrame)
nsIFrame *lookahead;
nsresult result;
while (1){
result = child->FirstChild(nsnull, &lookahead);
result = child->FirstChild(aPresContext, nsnull, &lookahead);
if (NS_FAILED(result) || !lookahead)
return;//nothing to do
child = lookahead;

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

@ -184,7 +184,9 @@ public:
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight);
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
@ -388,7 +390,7 @@ protected:
PRBool DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
//this will modify aPos and return the next frame ect.
NS_IMETHOD GetFrameFromDirection(nsPeekOffsetStruct *aPos);
NS_IMETHOD GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos);
// Style post processing hook
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext);
@ -396,8 +398,8 @@ protected:
//return the line number of the aFrame
static PRInt32 GetLineNumber(nsIFrame *aFrame);
//given a frame five me the first/last leaf available
static void GetLastLeaf(nsIFrame **aFrame);
static void GetFirstLeaf(nsIFrame **aFrame);
static void GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame);
static void GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame);
static void XMLQuote(nsString& aString);

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

@ -209,7 +209,7 @@ public:
void RemoveVerticalScrollbar (const nsSize& aSbSize, nsSize& aScrollAreaSize);
nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext);
void GetScrolledContentSize(nsSize& aSize);
void GetScrolledContentSize(nsIPresContext* aPresContext, nsSize& aSize);
void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
nsresult GetContentOf(nsIFrame* aFrame, nsIContent** aContent);
@ -279,7 +279,7 @@ nsGfxScrollFrame::SetScrolledFrame(nsIPresContext* aPresContext, nsIFrame *aScro
NS_IMETHODIMP
nsGfxScrollFrame::GetScrolledFrame(nsIPresContext* aPresContext, nsIFrame *&aScrolledFrame) const
{
return mInner->mScrollAreaFrame->FirstChild(nsnull, &aScrolledFrame);
return mInner->mScrollAreaFrame->FirstChild(aPresContext, nsnull, &aScrolledFrame);
}
/**
@ -314,7 +314,8 @@ nsGfxScrollFrame::GetScrollbarVisibility(nsIPresContext* aPresContext,
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
NS_IMETHODIMP
nsGfxScrollFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren)
nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousChildren)
{
/*
@ -807,11 +808,11 @@ nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext)
}
void
nsGfxScrollFrameInner::GetScrolledContentSize(nsSize& aSize)
nsGfxScrollFrameInner::GetScrolledContentSize(nsIPresContext* aPresContext, nsSize& aSize)
{
// get the ara frame is the scrollarea
nsIFrame* child = nsnull;
mScrollAreaFrame->FirstChild(nsnull, &child);
mScrollAreaFrame->FirstChild(aPresContext, nsnull, &child);
nsRect rect(0,0,0,0);
child->GetRect(rect);
@ -1345,7 +1346,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext
if (aReflowState.mStyleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLL) {
// get the ara frame is the scrollarea
nsSize size;
GetScrolledContentSize(size);
GetScrolledContentSize(aPresContext, size);
PRBool mustReflow = PR_FALSE;
@ -1401,7 +1402,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext
{
// get the ara frame is the scrollarea
nsSize size;
GetScrolledContentSize(size);
GetScrolledContentSize(aPresContext, size);
// if the child is wider that the scroll area
// and we don't have a scrollbar add one.
@ -1443,7 +1444,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext
}
nsSize size;
GetScrolledContentSize(size);
GetScrolledContentSize(aPresContext, size);
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
@ -1641,7 +1642,6 @@ nsGfxScrollFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowSta
{
aSize.Clear();
nsresult rv;
nsBoxInfo scrollAreaInfo, vboxInfo, hboxInfo;
nsCOMPtr<nsIBox> ibox ( do_QueryInterface(mInner->mScrollAreaFrame) );
if (ibox) ibox->GetBoxInfo(aPresContext, aReflowState, scrollAreaInfo);

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

@ -104,7 +104,8 @@ public:
PRBool& aBeginFrameContent);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems);
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
// nsIBox methods
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);

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

@ -165,8 +165,14 @@ ReparentFrameViewTo(nsIPresContext* aPresContext,
// Iterate the child frames, and check each child frame to see if it has
// a view
nsIFrame* childFrame;
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView);
childFrame->GetNextSibling(&childFrame);
}
aFrame->FirstChild(nsnull, &childFrame);
// Also check the overflow-list
aFrame->FirstChild(aPresContext, nsLayoutAtoms::overflowList, &childFrame);
while (childFrame) {
ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView);
childFrame->GetNextSibling(&childFrame);
@ -217,7 +223,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext,
if (!childView) {
// Child frame doesn't have a view. See if it has any child frames
nsIFrame* firstChild;
aChildFrame->FirstChild(nsnull, &firstChild);
aChildFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (!firstChild) {
return NS_OK;
}

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

@ -28,6 +28,7 @@
#include "nsIContent.h"
#include "nsCOMPtr.h"
class nsIPresContext;
class nsISupportsArray;
class nsIAtom;
@ -44,7 +45,8 @@ class nsIAtom;
class nsIAnonymousContentCreator : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IANONYMOUS_CONTENT_CREATOR_IID; return iid; }
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems)=0;
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)=0;
};
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);

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

@ -636,7 +636,9 @@ public:
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified name
* @see #GetAdditionalListName()
*/
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const = 0;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const = 0;
/**
* Child frames are linked together in a singly-linked

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

@ -954,14 +954,16 @@ nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
nsPositionedInlineFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsPositionedInlineFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::absoluteList) {
return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild);
}
return nsInlineFrame::FirstChild(aListName, aFirstChild);
return nsInlineFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
NS_IMETHODIMP

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

@ -190,7 +190,9 @@ public:
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

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

@ -2400,7 +2400,7 @@ nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
else
{
aPos->mAmount = eSelectDir;//go to "next" or previous frame based on direction not THIS frame
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this)
return aPos->mResultFrame->PeekOffset(aPresContext, aPos);
}
@ -2463,7 +2463,7 @@ nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
if (!found)
{
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this)
result = aPos->mResultFrame->PeekOffset(aPresContext, aPos);
}
@ -2582,7 +2582,7 @@ nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
aPos->mContentOffset = PR_MIN(aPos->mContentOffset, mContentOffset + mContentLength);
aPos->mContentOffset = PR_MAX(aPos->mContentOffset, mContentOffset);
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this)
{
if (NS_SUCCEEDED(result = aPos->mResultFrame->PeekOffset(aPresContext, aPos)))

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

@ -72,7 +72,9 @@ public:
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@ -270,7 +272,9 @@ ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
ViewportFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
ViewportFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::fixedList) {
@ -278,7 +282,7 @@ ViewportFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
return NS_OK;
}
return nsContainerFrame::FirstChild(aListName, aFirstChild);
return nsContainerFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
void

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

@ -159,14 +159,16 @@ nsAreaFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
nsAreaFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsAreaFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::absoluteList) {
return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild);
}
return nsBlockFrame::FirstChild(aListName, aFirstChild);
return nsBlockFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
static void

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

@ -71,7 +71,9 @@ public:
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

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

@ -348,7 +348,7 @@ public:
PRBool ClearPastFloaters(PRUint8 aBreakType);
PRBool IsLeftMostChild(nsIFrame* aFrame);
PRBool IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
PRBool IsAdjacentWithTop() const {
return mY == mReflowState.mComputedBorderPadding.top;
@ -1270,7 +1270,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (nsnull == listName) {
break;
}
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
@ -1331,13 +1331,20 @@ nsBlockFrame::GetFrameType(nsIAtom** aType) const
// Child frame enumeration
NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsBlockFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (nsnull == aListName) {
*aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::overflowList) {
nsLineBox* overflowLines = GetOverflowLines(aPresContext, PR_FALSE);
*aFirstChild = overflowLines ? overflowLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
*aFirstChild = mFloaters.FirstChild();
return NS_OK;
@ -1449,7 +1456,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
NS_BLOCK_MARGIN_ROOT & mState);
if (eReflowReason_Resize != aReflowState.reason) {
RenumberLists();
RenumberLists(aPresContext);
ComputeTextRuns(aPresContext);
}
@ -3107,7 +3114,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
}
if (nsHTMLAtoms::start == aAttribute) {
// XXX Not sure if this is necessary anymore
RenumberLists();
RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -3144,7 +3151,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
// itself
if (nsnull != blockParent) {
// XXX Not sure if this is necessary anymore
blockParent->RenumberLists();
blockParent->RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -4557,7 +4564,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
nsLineBox*
nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -4573,7 +4580,7 @@ nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowLinesProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowLinesProperty,
options, &value);
return (nsLineBox*)value;
}
@ -5184,7 +5191,7 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
}
PRBool
nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
for (;;) {
nsIFrame* parent;
@ -5209,7 +5216,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
// See if there are any non-zero sized child frames that precede
// aFrame in the child list
nsIFrame* child;
parent->FirstChild(nsnull, &child);
parent->FirstChild(aPresContext, nsnull, &child);
while ((nsnull != child) && (aFrame != child)) {
nsSize size;
@ -6245,7 +6252,7 @@ nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
}
void
nsBlockFrame::RenumberLists()
nsBlockFrame::RenumberLists(nsIPresContext* aPresContext)
{
if (!FrameStartsCounterScope(this)) {
// If this frame doesn't start a counter scope then we don't need
@ -6273,11 +6280,12 @@ nsBlockFrame::RenumberLists()
// Get to first-in-flow
nsBlockFrame* block = (nsBlockFrame*) GetFirstInFlow();
RenumberListsInBlock(block, &ordinal);
RenumberListsInBlock(aPresContext, block, &ordinal);
}
PRBool
nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsBlockFrame::RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aBlockFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6289,7 +6297,7 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsIFrame* kid = line->mFirstChild;
PRInt32 n = line->GetChildCount();
while (--n >= 0) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
line->MarkDirty();
renumberedABullet = PR_TRUE;
@ -6309,7 +6317,9 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
// XXX temporary code: after ib work is done in frame construction
// code this can be removed.
PRBool
nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6317,9 +6327,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
while (nsnull != aContainerFrame) {
// For each frame in the flow-block...
nsIFrame* kid;
aContainerFrame->FirstChild(nsnull, &kid);
aContainerFrame->FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
renumberedABullet = PR_TRUE;
}
@ -6331,7 +6341,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
}
PRBool
nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
nsIFrame* aKid,
PRInt32* aOrdinal)
{
PRBool kidRenumberedABullet = PR_FALSE;
@ -6359,7 +6371,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
// XXX temporary? if the list-item has child list-items they
// should be numbered too; especially since the list-item is
// itself (ASSUMED!) not to be a counter-reseter.
PRBool meToo = RenumberListsInBlock(listItem, aOrdinal);
PRBool meToo = RenumberListsInBlock(aPresContext, listItem, aOrdinal);
if (meToo) {
kidRenumberedABullet = PR_TRUE;
}
@ -6378,7 +6390,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame* kidBlock;
nsresult rv = aKid->QueryInterface(kBlockFrameCID, (void**) &kidBlock);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsInBlock(kidBlock, aOrdinal);
kidRenumberedABullet = RenumberListsInBlock(aPresContext, kidBlock, aOrdinal);
}
}
} else if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
@ -6392,7 +6404,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsresult rv = aKid->QueryInterface(nsInlineFrame::kInlineFrameCID,
(void**) &kidInline);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsIn(aKid, aOrdinal);
kidRenumberedABullet = RenumberListsIn(aPresContext, aKid, aOrdinal);
}
}
return kidRenumberedABullet;

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

@ -85,7 +85,9 @@ public:
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
@ -326,14 +328,17 @@ protected:
//----------------------------------------
// List handling kludge
void RenumberLists();
void RenumberLists(nsIPresContext* aPresContext);
PRBool RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal);
PRBool RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal);
PRBool RenumberListsInBlock(nsBlockFrame* aContainerFrame,
PRBool RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aContainerFrame,
PRInt32* aOrdinal);
PRBool RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal);
PRBool RenumberListsFor(nsIPresContext* aPresContext, nsIFrame* aKid, PRInt32* aOrdinal);
PRBool FrameStartsCounterScope(nsIFrame* aFrame);
@ -345,7 +350,7 @@ protected:
//----------------------------------------
nsLineBox* GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty);
PRBool aRemoveProperty) const;
nsresult SetOverflowLines(nsIPresContext* aPresContext,
nsLineBox* aOverflowFrames);

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

@ -348,7 +348,7 @@ public:
PRBool ClearPastFloaters(PRUint8 aBreakType);
PRBool IsLeftMostChild(nsIFrame* aFrame);
PRBool IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
PRBool IsAdjacentWithTop() const {
return mY == mReflowState.mComputedBorderPadding.top;
@ -1270,7 +1270,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (nsnull == listName) {
break;
}
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
@ -1331,13 +1331,20 @@ nsBlockFrame::GetFrameType(nsIAtom** aType) const
// Child frame enumeration
NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsBlockFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (nsnull == aListName) {
*aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::overflowList) {
nsLineBox* overflowLines = GetOverflowLines(aPresContext, PR_FALSE);
*aFirstChild = overflowLines ? overflowLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
*aFirstChild = mFloaters.FirstChild();
return NS_OK;
@ -1449,7 +1456,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
NS_BLOCK_MARGIN_ROOT & mState);
if (eReflowReason_Resize != aReflowState.reason) {
RenumberLists();
RenumberLists(aPresContext);
ComputeTextRuns(aPresContext);
}
@ -3107,7 +3114,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
}
if (nsHTMLAtoms::start == aAttribute) {
// XXX Not sure if this is necessary anymore
RenumberLists();
RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -3144,7 +3151,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
// itself
if (nsnull != blockParent) {
// XXX Not sure if this is necessary anymore
blockParent->RenumberLists();
blockParent->RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -4557,7 +4564,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
nsLineBox*
nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -4573,7 +4580,7 @@ nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowLinesProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowLinesProperty,
options, &value);
return (nsLineBox*)value;
}
@ -5184,7 +5191,7 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
}
PRBool
nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
for (;;) {
nsIFrame* parent;
@ -5209,7 +5216,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
// See if there are any non-zero sized child frames that precede
// aFrame in the child list
nsIFrame* child;
parent->FirstChild(nsnull, &child);
parent->FirstChild(aPresContext, nsnull, &child);
while ((nsnull != child) && (aFrame != child)) {
nsSize size;
@ -6245,7 +6252,7 @@ nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
}
void
nsBlockFrame::RenumberLists()
nsBlockFrame::RenumberLists(nsIPresContext* aPresContext)
{
if (!FrameStartsCounterScope(this)) {
// If this frame doesn't start a counter scope then we don't need
@ -6273,11 +6280,12 @@ nsBlockFrame::RenumberLists()
// Get to first-in-flow
nsBlockFrame* block = (nsBlockFrame*) GetFirstInFlow();
RenumberListsInBlock(block, &ordinal);
RenumberListsInBlock(aPresContext, block, &ordinal);
}
PRBool
nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsBlockFrame::RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aBlockFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6289,7 +6297,7 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsIFrame* kid = line->mFirstChild;
PRInt32 n = line->GetChildCount();
while (--n >= 0) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
line->MarkDirty();
renumberedABullet = PR_TRUE;
@ -6309,7 +6317,9 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
// XXX temporary code: after ib work is done in frame construction
// code this can be removed.
PRBool
nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6317,9 +6327,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
while (nsnull != aContainerFrame) {
// For each frame in the flow-block...
nsIFrame* kid;
aContainerFrame->FirstChild(nsnull, &kid);
aContainerFrame->FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
renumberedABullet = PR_TRUE;
}
@ -6331,7 +6341,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
}
PRBool
nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
nsIFrame* aKid,
PRInt32* aOrdinal)
{
PRBool kidRenumberedABullet = PR_FALSE;
@ -6359,7 +6371,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
// XXX temporary? if the list-item has child list-items they
// should be numbered too; especially since the list-item is
// itself (ASSUMED!) not to be a counter-reseter.
PRBool meToo = RenumberListsInBlock(listItem, aOrdinal);
PRBool meToo = RenumberListsInBlock(aPresContext, listItem, aOrdinal);
if (meToo) {
kidRenumberedABullet = PR_TRUE;
}
@ -6378,7 +6390,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame* kidBlock;
nsresult rv = aKid->QueryInterface(kBlockFrameCID, (void**) &kidBlock);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsInBlock(kidBlock, aOrdinal);
kidRenumberedABullet = RenumberListsInBlock(aPresContext, kidBlock, aOrdinal);
}
}
} else if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
@ -6392,7 +6404,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsresult rv = aKid->QueryInterface(nsInlineFrame::kInlineFrameCID,
(void**) &kidInline);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsIn(aKid, aOrdinal);
kidRenumberedABullet = RenumberListsIn(aPresContext, aKid, aOrdinal);
}
}
return kidRenumberedABullet;

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

@ -348,7 +348,7 @@ public:
PRBool ClearPastFloaters(PRUint8 aBreakType);
PRBool IsLeftMostChild(nsIFrame* aFrame);
PRBool IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame);
PRBool IsAdjacentWithTop() const {
return mY == mReflowState.mComputedBorderPadding.top;
@ -1270,7 +1270,7 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
if (nsnull == listName) {
break;
}
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
IndentBy(out, aIndent);
nsAutoString tmp;
@ -1331,13 +1331,20 @@ nsBlockFrame::GetFrameType(nsIAtom** aType) const
// Child frame enumeration
NS_IMETHODIMP
nsBlockFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsBlockFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (nsnull == aListName) {
*aFirstChild = (nsnull != mLines) ? mLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::overflowList) {
nsLineBox* overflowLines = GetOverflowLines(aPresContext, PR_FALSE);
*aFirstChild = overflowLines ? overflowLines->mFirstChild : nsnull;
return NS_OK;
}
else if (aListName == nsLayoutAtoms::floaterList) {
*aFirstChild = mFloaters.FirstChild();
return NS_OK;
@ -1449,7 +1456,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
NS_BLOCK_MARGIN_ROOT & mState);
if (eReflowReason_Resize != aReflowState.reason) {
RenumberLists();
RenumberLists(aPresContext);
ComputeTextRuns(aPresContext);
}
@ -3107,7 +3114,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
}
if (nsHTMLAtoms::start == aAttribute) {
// XXX Not sure if this is necessary anymore
RenumberLists();
RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -3144,7 +3151,7 @@ nsBlockFrame::AttributeChanged(nsIPresContext* aPresContext,
// itself
if (nsnull != blockParent) {
// XXX Not sure if this is necessary anymore
blockParent->RenumberLists();
blockParent->RenumberLists(aPresContext);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
@ -4557,7 +4564,7 @@ nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext)
nsLineBox*
nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -4573,7 +4580,7 @@ nsBlockFrame::GetOverflowLines(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowLinesProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowLinesProperty,
options, &value);
return (nsLineBox*)value;
}
@ -5184,7 +5191,7 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
}
PRBool
nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
nsBlockReflowState::IsLeftMostChild(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
for (;;) {
nsIFrame* parent;
@ -5209,7 +5216,7 @@ nsBlockReflowState::IsLeftMostChild(nsIFrame* aFrame)
// See if there are any non-zero sized child frames that precede
// aFrame in the child list
nsIFrame* child;
parent->FirstChild(nsnull, &child);
parent->FirstChild(aPresContext, nsnull, &child);
while ((nsnull != child) && (aFrame != child)) {
nsSize size;
@ -6245,7 +6252,7 @@ nsBlockFrame::FrameStartsCounterScope(nsIFrame* aFrame)
}
void
nsBlockFrame::RenumberLists()
nsBlockFrame::RenumberLists(nsIPresContext* aPresContext)
{
if (!FrameStartsCounterScope(this)) {
// If this frame doesn't start a counter scope then we don't need
@ -6273,11 +6280,12 @@ nsBlockFrame::RenumberLists()
// Get to first-in-flow
nsBlockFrame* block = (nsBlockFrame*) GetFirstInFlow();
RenumberListsInBlock(block, &ordinal);
RenumberListsInBlock(aPresContext, block, &ordinal);
}
PRBool
nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsBlockFrame::RenumberListsInBlock(nsIPresContext* aPresContext,
nsBlockFrame* aBlockFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6289,7 +6297,7 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
nsIFrame* kid = line->mFirstChild;
PRInt32 n = line->GetChildCount();
while (--n >= 0) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
line->MarkDirty();
renumberedABullet = PR_TRUE;
@ -6309,7 +6317,9 @@ nsBlockFrame::RenumberListsInBlock(nsBlockFrame* aBlockFrame,
// XXX temporary code: after ib work is done in frame construction
// code this can be removed.
PRBool
nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsIn(nsIPresContext* aPresContext,
nsIFrame* aContainerFrame,
PRInt32* aOrdinal)
{
PRBool renumberedABullet = PR_FALSE;
@ -6317,9 +6327,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
while (nsnull != aContainerFrame) {
// For each frame in the flow-block...
nsIFrame* kid;
aContainerFrame->FirstChild(nsnull, &kid);
aContainerFrame->FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
PRBool kidRenumberedABullet = RenumberListsFor(kid, aOrdinal);
PRBool kidRenumberedABullet = RenumberListsFor(aPresContext, kid, aOrdinal);
if (kidRenumberedABullet) {
renumberedABullet = PR_TRUE;
}
@ -6331,7 +6341,9 @@ nsBlockFrame::RenumberListsIn(nsIFrame* aContainerFrame, PRInt32* aOrdinal)
}
PRBool
nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame::RenumberListsFor(nsIPresContext* aPresContext,
nsIFrame* aKid,
PRInt32* aOrdinal)
{
PRBool kidRenumberedABullet = PR_FALSE;
@ -6359,7 +6371,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
// XXX temporary? if the list-item has child list-items they
// should be numbered too; especially since the list-item is
// itself (ASSUMED!) not to be a counter-reseter.
PRBool meToo = RenumberListsInBlock(listItem, aOrdinal);
PRBool meToo = RenumberListsInBlock(aPresContext, listItem, aOrdinal);
if (meToo) {
kidRenumberedABullet = PR_TRUE;
}
@ -6378,7 +6390,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsBlockFrame* kidBlock;
nsresult rv = aKid->QueryInterface(kBlockFrameCID, (void**) &kidBlock);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsInBlock(kidBlock, aOrdinal);
kidRenumberedABullet = RenumberListsInBlock(aPresContext, kidBlock, aOrdinal);
}
}
} else if (NS_STYLE_DISPLAY_INLINE == display->mDisplay) {
@ -6392,7 +6404,7 @@ nsBlockFrame::RenumberListsFor(nsIFrame* aKid, PRInt32* aOrdinal)
nsresult rv = aKid->QueryInterface(nsInlineFrame::kInlineFrameCID,
(void**) &kidInline);
if (NS_SUCCEEDED(rv)) {
kidRenumberedABullet = RenumberListsIn(aKid, aOrdinal);
kidRenumberedABullet = RenumberListsIn(aPresContext, aKid, aOrdinal);
}
}
return kidRenumberedABullet;

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

@ -101,13 +101,19 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext)
// Child frame enumeration
NS_IMETHODIMP
nsContainerFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsContainerFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
// We only know about the unnamed principal child list
// We only know about the unnamed principal child list and the overflow
// list
if (nsnull == aListName) {
*aFirstChild = mFrames.FirstChild();
return NS_OK;
} else if (nsLayoutAtoms::overflowList == aListName) {
*aFirstChild = GetOverflowFrames(aPresContext, PR_FALSE);
return NS_OK;
} else {
*aFirstChild = nsnull;
return NS_ERROR_INVALID_ARG;
@ -255,7 +261,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
// point. We try to use a quick check on the child frames bbox to
// avoid a potentially expensive recursion into the child frames
// GetFrameForPoint method.
FirstChild(aList, &kid);
FirstChild(aPresContext, aList, &kid);
while (nsnull != kid) {
kid->GetRect(kidRect);
// Do a quick check and see if the child frame contains the point
@ -282,7 +288,7 @@ nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext,
// Try again, this time looking only inside child frames that have
// outside children.
FirstChild(aList, &kid);
FirstChild(aPresContext, aList, &kid);
while (nsnull != kid) {
nsFrameState state;
kid->GetFrameState(&state);
@ -321,7 +327,7 @@ nsContainerFrame::ReplaceFrame(nsIPresContext* aPresContext,
nsresult rv;
// Get the old frame's previous sibling frame
FirstChild(aListName, &firstChild);
FirstChild(aPresContext, aListName, &firstChild);
nsFrameList frames(firstChild);
NS_ASSERTION(frames.ContainsFrame(aOldFrame), "frame is not a valid child frame");
prevFrame = frames.GetPrevSiblingFor(aOldFrame);
@ -498,7 +504,7 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext,
// hidden visibility and be visible anyway
nsIFrame* firstChild;
aFrame->FirstChild(nsnull, &firstChild);
aFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild) {
// Not a left frame, so the view needs to be visible, but marked
// as having transparent content
@ -677,7 +683,7 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
do {
// Recursively walk aFrame's child frames
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
nsIView* view;
@ -805,7 +811,7 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext,
nsIFrame*
nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty)
PRBool aRemoveProperty) const
{
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
@ -821,7 +827,7 @@ nsContainerFrame::GetOverflowFrames(nsIPresContext* aPresContext,
if (aRemoveProperty) {
options |= NS_IFRAME_MGR_REMOVE_PROP;
}
frameManager->GetFrameProperty(this, nsLayoutAtoms::overflowProperty,
frameManager->GetFrameProperty((nsIFrame*)this, nsLayoutAtoms::overflowProperty,
options, &value);
return (nsIFrame*)value;
}
@ -992,7 +998,7 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
PRBool outputOneList = PR_FALSE;
do {
nsIFrame* kid;
FirstChild(listName, &kid);
FirstChild(aPresContext, listName, &kid);
if (nsnull != kid) {
if (outputOneList) {
IndentBy(out, aIndent);
@ -1005,8 +1011,13 @@ nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent)
}
fputs("<\n", out);
while (nsnull != kid) {
nsIFrameDebug* frameDebug;
// Verify the child frame's parent frame pointer is correct
nsIFrame* parentFrame;
kid->GetParent(&parentFrame);
NS_ASSERTION(parentFrame == (nsIFrame*)this, "bad parent frame pointer");
// Have the child frame list
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(kid->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) {
frameDebug->List(aPresContext, out, aIndent + 1);
}

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

@ -42,7 +42,9 @@ public:
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -171,7 +173,7 @@ protected:
* Get the frames on the overflow list
*/
nsIFrame* GetOverflowFrames(nsIPresContext* aPresContext,
PRBool aRemoveProperty);
PRBool aRemoveProperty) const;
/**
* Set the overflow list

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

@ -57,7 +57,11 @@ public:
NS_IMETHOD FindTextRuns(nsLineLayout& aLineLayout);
//override of nsFrame method
NS_IMETHOD GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, PRInt32* outFrameContentOffset, nsIFrame **outChildFrame);
NS_IMETHOD GetChildFrameContainingOffset(nsIPresContext* aPresContext,
PRInt32 inContentOffset,
PRBool inHint,
PRInt32* outFrameContentOffset,
nsIFrame **outChildFrame);
protected:
virtual PRIntn GetSkipSides() const;
@ -165,7 +169,7 @@ nsFirstLetterFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRang
if (aSelected && ParentDisablesSelection())
return NS_OK;
nsIFrame *child;
nsresult result = FirstChild(nsnull, &child);
nsresult result = FirstChild(aPresContext, nsnull, &child);
while (NS_SUCCEEDED(result) && child)
{
child->SetSelected(aPresContext,aRange, aSelected,aSpread);//dont worry about result. there are more frames to come
@ -186,10 +190,14 @@ nsFirstLetterFrame::FindTextRuns(nsLineLayout& aLineLayout)
}
NS_IMETHODIMP
nsFirstLetterFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, PRInt32* outFrameContentOffset, nsIFrame **outChildFrame)
nsFirstLetterFrame::GetChildFrameContainingOffset(nsIPresContext* aPresContext,
PRInt32 inContentOffset,
PRBool inHint,
PRInt32* outFrameContentOffset,
nsIFrame **outChildFrame)
{
nsIFrame *kid;
nsresult result = FirstChild(nsnull, &kid);
nsresult result = FirstChild(aPresContext, nsnull, &kid);
if (NS_SUCCEEDED(result) && kid)
{
return kid->GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame);

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

@ -566,7 +566,9 @@ nsFrame::GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const
return aIndex < 0 ? NS_ERROR_INVALID_ARG : NS_OK;
}
NS_IMETHODIMP nsFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
NS_IMETHODIMP nsFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
*aFirstChild = nsnull;
return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG;
@ -1034,7 +1036,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext* aCX,
if (NS_FAILED(result))
return result;
result = FirstChild(nsnull, &kid);
result = FirstChild(aCX, nsnull, &kid);
if (NS_SUCCEEDED(result) && nsnull != kid) {
@ -1802,7 +1804,7 @@ nsFrame::DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32
nsIAtom* list = nsnull;
PRInt32 listIndex = 0;
do {
nsresult rv = FirstChild(list, &kid);
nsresult rv = FirstChild(aPresContext, list, &kid);
if (NS_SUCCEEDED(rv) && (nsnull != kid)) {
IndentBy(out, aIndent);
if (nsnull != list) {
@ -2056,7 +2058,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
continue;
}
}
GetLastLeaf(&lastFrame);
GetLastLeaf(aPresContext, &lastFrame);
if (aPos->mDirection == eDirNext){
nearStoppingFrame = firstFrame;
@ -2087,7 +2089,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
nsCOMPtr<nsIBidirectionalEnumerator> frameTraversal;
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF,
resultFrame);
aPresContext, resultFrame);
if (NS_FAILED(result))
return result;
nsISupports *isupports = nsnull;
@ -2127,7 +2129,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext,
if (!found){
resultFrame = storeOldResultFrame;
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal), LEAF,
resultFrame);
aPresContext, resultFrame);
}
while ( !found ){
nsCOMPtr<nsIPresContext> context;
@ -2211,7 +2213,7 @@ nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
if ((aPos->mDirection == eDirNext && newOffset < aPos->mStartOffset) || //need to go to next one
(aPos->mDirection == eDirPrevious && newOffset >= aPos->mStartOffset))
{
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_FAILED(result) || !aPos->mResultFrame)
{
return result?result:NS_ERROR_FAILURE;
@ -2440,7 +2442,7 @@ nsFrame::GetLineNumber(nsIFrame *aFrame)
//this should change to use geometry and also look to ALL the child lists
//we need to set up line information to make sure we dont jump across line boundaries
NS_IMETHODIMP
nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos)
nsFrame::GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
nsIFrame *blockFrame = this;
nsIFrame *thisBlock;
@ -2483,8 +2485,8 @@ nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos)
}
}
GetFirstLeaf( &firstFrame);
GetLastLeaf(&lastFrame);
GetFirstLeaf(aPresContext, &firstFrame);
GetLastLeaf(aPresContext, &lastFrame);
//END LINE DATA CODE
if ((aPos->mDirection == eDirNext && lastFrame == this)
||(aPos->mDirection == eDirPrevious && firstFrame == this))
@ -2510,7 +2512,7 @@ nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos)
if (aPos->mAmount == eSelectDir)
aPos->mAmount = eSelectNoAmount;//just get to next frame.
nsCOMPtr<nsIBidirectionalEnumerator> frameTraversal;
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF,this);
result = NS_NewFrameTraversal(getter_AddRefs(frameTraversal),LEAF, aPresContext, this);
if (NS_FAILED(result))
return result;
nsISupports *isupports = nsnull;
@ -2592,7 +2594,7 @@ static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFr
}
NS_IF_RELEASE(frameContent);
aFrame->FirstChild(nsnull, &aFrame);
aFrame->FirstChild(aPresContext, nsnull, &aFrame);
while (aFrame) {
RefreshAllContentFrames(aPresContext, aFrame, aContent);
aFrame->GetNextSibling(&aFrame);
@ -2631,7 +2633,7 @@ void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool)
}
void
nsFrame::GetLastLeaf(nsIFrame **aFrame)
nsFrame::GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame)
{
if (!aFrame || !*aFrame)
return;
@ -2639,7 +2641,7 @@ nsFrame::GetLastLeaf(nsIFrame **aFrame)
nsresult result;
nsIFrame *lookahead = nsnull;
while (1){
result = child->FirstChild(nsnull, &lookahead);
result = child->FirstChild(aPresContext, nsnull, &lookahead);
if (NS_FAILED(result) || !lookahead)
return;//nothing to do
child = lookahead;
@ -2651,7 +2653,7 @@ nsFrame::GetLastLeaf(nsIFrame **aFrame)
}
void
nsFrame::GetFirstLeaf(nsIFrame **aFrame)
nsFrame::GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame)
{
if (!aFrame || !*aFrame)
return;
@ -2659,7 +2661,7 @@ nsFrame::GetFirstLeaf(nsIFrame **aFrame)
nsIFrame *lookahead;
nsresult result;
while (1){
result = child->FirstChild(nsnull, &lookahead);
result = child->FirstChild(aPresContext, nsnull, &lookahead);
if (NS_FAILED(result) || !lookahead)
return;//nothing to do
child = lookahead;

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

@ -184,7 +184,9 @@ public:
NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
NS_IMETHOD SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight);
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
@ -388,7 +390,7 @@ protected:
PRBool DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
//this will modify aPos and return the next frame ect.
NS_IMETHOD GetFrameFromDirection(nsPeekOffsetStruct *aPos);
NS_IMETHOD GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos);
// Style post processing hook
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext);
@ -396,8 +398,8 @@ protected:
//return the line number of the aFrame
static PRInt32 GetLineNumber(nsIFrame *aFrame);
//given a frame five me the first/last leaf available
static void GetLastLeaf(nsIFrame **aFrame);
static void GetFirstLeaf(nsIFrame **aFrame);
static void GetLastLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame);
static void GetFirstLeaf(nsIPresContext* aPresContext, nsIFrame **aFrame);
static void XMLQuote(nsString& aString);

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

@ -247,7 +247,7 @@ public:
nsIAtom* aPropertyName);
#ifdef NS_DEBUG
NS_IMETHOD DebugVerifyStyleTree(nsIFrame* aFrame);
NS_IMETHOD DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame);
#endif
private:
@ -906,7 +906,7 @@ VerifyContextParent(nsIFrame* aFrame, nsIStyleContext* aParentContext)
}
static void
VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame, nsIStyleContext* aParentContext)
{
nsIStyleContext* context;
aFrame->GetStyleContext(&context);
@ -920,7 +920,7 @@ VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
do {
child = nsnull;
nsresult result = aFrame->FirstChild(childList, &child);
nsresult result = aFrame->FirstChild(aPresContext, childList, &child);
while ((NS_SUCCEEDED(result)) && child) {
nsFrameState state;
child->GetFrameState(&state);
@ -937,10 +937,10 @@ VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
VerifyContextParent(child, outOfFlowContext);
NS_RELEASE(outOfFlowContext);
VerifyStyleTree(outOfFlowFrame, context);
VerifyStyleTree(aPresContext, outOfFlowFrame, context);
}
else { // regular frame
VerifyStyleTree(child, context);
VerifyStyleTree(aPresContext, child, context);
}
NS_IF_RELEASE(frameType);
}
@ -969,13 +969,13 @@ VerifyStyleTree(nsIFrame* aFrame, nsIStyleContext* aParentContext)
}
NS_IMETHODIMP
FrameManager::DebugVerifyStyleTree(nsIFrame* aFrame)
FrameManager::DebugVerifyStyleTree(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
if (aFrame) {
nsIStyleContext* context;
aFrame->GetStyleContext(&context);
nsIStyleContext* parentContext = context->GetParent();
VerifyStyleTree(aFrame, parentContext);
VerifyStyleTree(aPresContext, aFrame, parentContext);
NS_IF_RELEASE(parentContext);
NS_RELEASE(context);
}
@ -991,7 +991,7 @@ FrameManager::ReParentStyleContext(nsIPresContext* aPresContext,
nsresult result = NS_ERROR_NULL_POINTER;
if (aFrame) {
#ifdef NS_DEBUG
DebugVerifyStyleTree(aFrame);
DebugVerifyStyleTree(aPresContext, aFrame);
#endif
nsIStyleContext* oldContext = nsnull;
@ -1011,7 +1011,7 @@ FrameManager::ReParentStyleContext(nsIPresContext* aPresContext,
do {
child = nsnull;
result = aFrame->FirstChild(childList, &child);
result = aFrame->FirstChild(aPresContext, childList, &child);
while ((NS_SUCCEEDED(result)) && child) {
nsFrameState state;
child->GetFrameState(&state);
@ -1070,7 +1070,7 @@ FrameManager::ReParentStyleContext(nsIPresContext* aPresContext,
}
}
#ifdef NS_DEBUG
VerifyStyleTree(aFrame, aNewParentContext);
VerifyStyleTree(aPresContext, aFrame, aNewParentContext);
#endif
}
NS_RELEASE(newContext);
@ -1285,7 +1285,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
do {
child = nsnull;
result = aFrame->FirstChild(childList, &child);
result = aFrame->FirstChild(aPresContext, childList, &child);
while ((NS_SUCCEEDED(result)) && (child)) {
nsFrameState state;
child->GetFrameState(&state);
@ -1349,7 +1349,7 @@ FrameManager::ComputeStyleChangeFor(nsIPresContext* aPresContext,
aAttrNameSpaceID, aAttribute,
aChangeList, aMinChange, frameChange);
#ifdef NS_DEBUG
VerifyStyleTree(frame, parentContext);
VerifyStyleTree(aPresContext, frame, parentContext);
#endif
NS_IF_RELEASE(parentContext);
NS_RELEASE(styleContext);
@ -1412,7 +1412,7 @@ FrameManager::CaptureFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame,
PRInt32 childListIndex = 0;
do {
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
rv = CaptureFrameState(aPresContext, childFrame, aState);
// Get the next sibling child frame
@ -1477,7 +1477,7 @@ FrameManager::RestoreFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame,
PRInt32 childListIndex = 0;
do {
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
rv = RestoreFrameState(aPresContext, childFrame, aState);
// Get the next sibling child frame

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

@ -209,7 +209,7 @@ public:
void RemoveVerticalScrollbar (const nsSize& aSbSize, nsSize& aScrollAreaSize);
nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext);
void GetScrolledContentSize(nsSize& aSize);
void GetScrolledContentSize(nsIPresContext* aPresContext, nsSize& aSize);
void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
nsresult GetContentOf(nsIFrame* aFrame, nsIContent** aContent);
@ -279,7 +279,7 @@ nsGfxScrollFrame::SetScrolledFrame(nsIPresContext* aPresContext, nsIFrame *aScro
NS_IMETHODIMP
nsGfxScrollFrame::GetScrolledFrame(nsIPresContext* aPresContext, nsIFrame *&aScrolledFrame) const
{
return mInner->mScrollAreaFrame->FirstChild(nsnull, &aScrolledFrame);
return mInner->mScrollAreaFrame->FirstChild(aPresContext, nsnull, &aScrolledFrame);
}
/**
@ -314,7 +314,8 @@ nsGfxScrollFrame::GetScrollbarVisibility(nsIPresContext* aPresContext,
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);
NS_IMETHODIMP
nsGfxScrollFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren)
nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousChildren)
{
/*
@ -807,11 +808,11 @@ nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext)
}
void
nsGfxScrollFrameInner::GetScrolledContentSize(nsSize& aSize)
nsGfxScrollFrameInner::GetScrolledContentSize(nsIPresContext* aPresContext, nsSize& aSize)
{
// get the ara frame is the scrollarea
nsIFrame* child = nsnull;
mScrollAreaFrame->FirstChild(nsnull, &child);
mScrollAreaFrame->FirstChild(aPresContext, nsnull, &child);
nsRect rect(0,0,0,0);
child->GetRect(rect);
@ -1345,7 +1346,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext
if (aReflowState.mStyleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLL) {
// get the ara frame is the scrollarea
nsSize size;
GetScrolledContentSize(size);
GetScrolledContentSize(aPresContext, size);
PRBool mustReflow = PR_FALSE;
@ -1401,7 +1402,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext
{
// get the ara frame is the scrollarea
nsSize size;
GetScrolledContentSize(size);
GetScrolledContentSize(aPresContext, size);
// if the child is wider that the scroll area
// and we don't have a scrollbar add one.
@ -1443,7 +1444,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext* aPresContext
}
nsSize size;
GetScrolledContentSize(size);
GetScrolledContentSize(aPresContext, size);
float p2t;
aPresContext->GetScaledPixelsToTwips(&p2t);
@ -1641,7 +1642,6 @@ nsGfxScrollFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowSta
{
aSize.Clear();
nsresult rv;
nsBoxInfo scrollAreaInfo, vboxInfo, hboxInfo;
nsCOMPtr<nsIBox> ibox ( do_QueryInterface(mInner->mScrollAreaFrame) );
if (ibox) ibox->GetBoxInfo(aPresContext, aReflowState, scrollAreaInfo);

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

@ -104,7 +104,8 @@ public:
PRBool& aBeginFrameContent);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems);
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousItems);
// nsIBox methods
NS_IMETHOD GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize);

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

@ -165,8 +165,14 @@ ReparentFrameViewTo(nsIPresContext* aPresContext,
// Iterate the child frames, and check each child frame to see if it has
// a view
nsIFrame* childFrame;
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView);
childFrame->GetNextSibling(&childFrame);
}
aFrame->FirstChild(nsnull, &childFrame);
// Also check the overflow-list
aFrame->FirstChild(aPresContext, nsLayoutAtoms::overflowList, &childFrame);
while (childFrame) {
ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView);
childFrame->GetNextSibling(&childFrame);
@ -217,7 +223,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext,
if (!childView) {
// Child frame doesn't have a view. See if it has any child frames
nsIFrame* firstChild;
aChildFrame->FirstChild(nsnull, &firstChild);
aChildFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (!firstChild) {
return NS_OK;
}

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

@ -28,6 +28,7 @@
#include "nsIContent.h"
#include "nsCOMPtr.h"
class nsIPresContext;
class nsISupportsArray;
class nsIAtom;
@ -44,7 +45,8 @@ class nsIAtom;
class nsIAnonymousContentCreator : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IANONYMOUS_CONTENT_CREATOR_IID; return iid; }
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems)=0;
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aAnonymousItems)=0;
};
nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr<nsIContent>& aNewNode);

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

@ -954,14 +954,16 @@ nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
nsPositionedInlineFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsPositionedInlineFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::absoluteList) {
return mAbsoluteContainer.FirstChild(this, aListName, aFirstChild);
}
return nsInlineFrame::FirstChild(aListName, aFirstChild);
return nsInlineFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
NS_IMETHODIMP

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

@ -190,7 +190,9 @@ public:
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

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

@ -503,16 +503,16 @@ private:
#ifdef NS_DEBUG
static void
VerifyStyleTree(nsIFrameManager* aFrameManager)
VerifyStyleTree(nsIPresContext* aPresContext, nsIFrameManager* aFrameManager)
{
if (aFrameManager && nsIFrameDebug::GetVerifyStyleTreeEnable()) {
nsIFrame* rootFrame;
aFrameManager->GetRootFrame(&rootFrame);
aFrameManager->DebugVerifyStyleTree(rootFrame);
aFrameManager->DebugVerifyStyleTree(aPresContext, rootFrame);
}
}
#define VERIFY_STYLE_TREE VerifyStyleTree(mFrameManager)
#define VERIFY_STYLE_TREE VerifyStyleTree(mPresContext, mFrameManager)
#else
#define VERIFY_STYLE_TREE
#endif
@ -1566,7 +1566,7 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
// The page sequence frame is the child of the rootFrame
mFrameManager->GetRootFrame(&rootFrame);
rootFrame->FirstChild(nsnull, &child);
rootFrame->FirstChild(mPresContext, nsnull, &child);
if (nsnull != child) {
@ -2885,8 +2885,8 @@ CompareTrees(nsIPresContext* aPresContext, nsIFrame* aA, nsIFrame* aB)
PRInt32 listIndex = 0;
do {
nsIFrame* k1, *k2;
aA->FirstChild(listName, &k1);
aB->FirstChild(listName, &k2);
aA->FirstChild(aPresContext, listName, &k1);
aB->FirstChild(aPresContext, listName, &k2);
PRInt32 l1 = nsContainerFrame::LengthOf(k1);
PRInt32 l2 = nsContainerFrame::LengthOf(k2);
if (l1 != l2) {

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

@ -2400,7 +2400,7 @@ nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
else
{
aPos->mAmount = eSelectDir;//go to "next" or previous frame based on direction not THIS frame
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this)
return aPos->mResultFrame->PeekOffset(aPresContext, aPos);
}
@ -2463,7 +2463,7 @@ nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
if (!found)
{
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this)
result = aPos->mResultFrame->PeekOffset(aPresContext, aPos);
}
@ -2582,7 +2582,7 @@ nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos)
{
aPos->mContentOffset = PR_MIN(aPos->mContentOffset, mContentOffset + mContentLength);
aPos->mContentOffset = PR_MAX(aPos->mContentOffset, mContentOffset);
result = GetFrameFromDirection(aPos);
result = GetFrameFromDirection(aPresContext, aPos);
if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this)
{
if (NS_SUCCEEDED(result = aPos->mResultFrame->PeekOffset(aPresContext, aPos)))

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

@ -72,7 +72,9 @@ public:
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@ -270,7 +272,9 @@ ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
ViewportFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
ViewportFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::fixedList) {
@ -278,7 +282,7 @@ ViewportFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
return NS_OK;
}
return nsContainerFrame::FirstChild(aListName, aFirstChild);
return nsContainerFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
void

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

@ -1340,7 +1340,8 @@ nsComboboxControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
NS_IMETHODIMP
nsComboboxControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList)
nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList)
{
// The frames used to display the combo box and the button used to popup the dropdown list
// are created through anonymous content. The dropdown list is not created through anonymous
@ -1402,13 +1403,14 @@ nsComboboxControlFrame::Destroy(nsIPresContext* aPresContext)
NS_IMETHODIMP
nsComboboxControlFrame::FirstChild(nsIAtom* aListName,
nsIFrame** aFirstChild) const
nsComboboxControlFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
if (nsLayoutAtoms::popupList == aListName) {
*aFirstChild = mPopupFrames.FirstChild();
} else {
nsAreaFrame::FirstChild(aListName, aFirstChild);
nsAreaFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
return NS_OK;
}

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

@ -67,7 +67,8 @@ public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aChildList);
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList);
// nsIFrame
NS_IMETHOD Init(nsIPresContext* aPresContext,
@ -89,7 +90,9 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const;
#endif
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);

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

@ -100,7 +100,8 @@ nsFileControlFrame::~nsFileControlFrame()
}
NS_IMETHODIMP
nsFileControlFrame::CreateAnonymousContent(nsISupportsArray& aChildList)
nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList)
{
// create text field
@ -280,7 +281,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
if (mFormFrame == nsnull && eReflowReason_Initial == aReflowState.reason) {
// add ourself as an nsIFormControlFrame
nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this));
mTextFrame = GetTextControlFrame(this);
mTextFrame = GetTextControlFrame(aPresContext, this);
if (!mTextFrame) return NS_ERROR_UNEXPECTED;
if (mCachedState) {
mTextFrame->SetProperty(aPresContext, nsHTMLAtoms::value, *mCachedState);
@ -312,11 +313,11 @@ nsFileControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
* node from the constructor and we find it in our tree.
*/
nsTextControlFrame*
nsFileControlFrame::GetTextControlFrame(nsIFrame* aStart)
nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame* aStart)
{
// find the text control frame.
nsIFrame* childFrame = nsnull;
aStart->FirstChild(nsnull, &childFrame);
aStart->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
// see if the child is a text control
@ -336,7 +337,7 @@ nsFileControlFrame::GetTextControlFrame(nsIFrame* aStart)
}
// if not continue looking
nsTextControlFrame* frame = GetTextControlFrame(childFrame);
nsTextControlFrame* frame = GetTextControlFrame(aPresContext, childFrame);
if (frame)
return frame;

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

@ -115,7 +115,8 @@ public:
// from nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aChildList);
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList);
// mouse events when out browse button is pressed
@ -183,7 +184,8 @@ protected:
nsIPresContext* mPresContext; // weak reference
private:
nsTextControlFrame* GetTextControlFrame(nsIFrame* aStart);
nsTextControlFrame* GetTextControlFrame(nsIPresContext* aPresContext,
nsIFrame* aStart);
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }

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

@ -194,7 +194,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
value = " ";
// The child frame will br the generated content
nsIFrame* fKid;
firstKid->FirstChild(nsnull, &fKid);
firstKid->FirstChild(aPresContext, nsnull, &fKid);
if (fKid) {
const nsStyleContent* content;
fKid->GetStyleData(eStyleStruct_Content, (const nsStyleStruct *&)content);

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

@ -259,7 +259,7 @@ static nsIScrollableView * GetScrollableView(nsIPresContext * aPresContext, nsIF
}
nsIFrame * childFrame = nsnull;
aFrame->FirstChild(nsnull, &childFrame);
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (nsnull != childFrame) {
scrollableView = GetScrollableView(aPresContext, childFrame);
if (nsnull != scrollableView) {
@ -355,7 +355,7 @@ nsGfxListControlFrame::Reflow(nsIPresContext* aPresContext,
}
nsIFrame * firstChildFrame = nsnull;
FirstChild(nsnull, &firstChildFrame);
FirstChild(aPresContext, nsnull, &firstChildFrame);
// Strategy: Let the inherited reflow happen as though the width and height of the
// ScrollFrame are big enough to allow the listbox to

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

@ -2862,14 +2862,16 @@ nsGfxTextControlFrame::GetAdditionalChildListName(PRInt32 aIndex,
}
NS_IMETHODIMP
nsGfxTextControlFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsGfxTextControlFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
if (nsLayoutAtoms::editorDisplayList) {
*aFirstChild = mDisplayFrame;
return NS_OK;
}
return nsTextControlFrame::FirstChild(aListName, aFirstChild);
return nsTextControlFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
NS_IMETHODIMP

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

@ -601,7 +601,9 @@ protected:
nsIFrame* aFrame,
nsFramePaintLayer aWhichLayer);
NS_IMETHOD FirstChild(nsIAtom *aListName, nsIFrame **aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
nsIAtom** aListName) const;

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

@ -111,7 +111,9 @@ public:
#endif
protected:
PRBool FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aResultFrame);
PRBool FindFirstControl(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFormControlFrame*& aResultFrame);
PRBool FindForControl(nsIFormControlFrame*& aResultFrame);
void GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect);
@ -335,10 +337,12 @@ nsLabelFrame::FindForControl(nsIFormControlFrame*& aResultFrame)
}
PRBool
nsLabelFrame::FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aResultFrame)
nsLabelFrame::FindFirstControl(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFormControlFrame*& aResultFrame)
{
nsIFrame* child = nsnull;
aParentFrame->FirstChild(nsnull, &child);
aParentFrame->FirstChild(aPresContext, nsnull, &child);
while (nsnull != child) {
nsIFormControlFrame* fcFrame = nsnull;
nsresult result = child->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame);
@ -351,7 +355,7 @@ nsLabelFrame::FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aRe
return PR_TRUE;
}
NS_RELEASE(fcFrame);
} else if (FindFirstControl(child, aResultFrame)) {
} else if (FindFirstControl(aPresContext, child, aResultFrame)) {
return PR_TRUE;
}
child->GetNextSibling(&child);
@ -483,7 +487,7 @@ nsLabelFrame::Reflow(nsIPresContext* aPresContext,
mControlIsInside = PR_FALSE;
} else {
// find the 1st (and should be only) form control contained within if there is no "for"
mControlIsInside = FindFirstControl(this, mControlFrame);
mControlIsInside = FindFirstControl(aPresContext, this, mControlFrame);
}
}

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

@ -552,9 +552,10 @@ nsCSSFrameConstructor::Init(nsIDocument* aDocument)
// Helper function that determines the child list name that aChildFrame
// is contained in
static void
GetChildListNameFor(nsIFrame* aParentFrame,
nsIFrame* aChildFrame,
nsIAtom** aListName)
GetChildListNameFor(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aChildFrame,
nsIAtom** aListName)
{
nsFrameState frameState;
nsIAtom* listName;
@ -586,7 +587,7 @@ GetChildListNameFor(nsIFrame* aParentFrame,
// Verify that the frame is actually in that child list
#ifdef NS_DEBUG
nsIFrame* firstChild;
aParentFrame->FirstChild(listName, &firstChild);
aParentFrame->FirstChild(aPresContext, listName, &firstChild);
nsFrameList frameList(firstChild);
NS_ASSERTION(frameList.ContainsFrame(aChildFrame), "not in child list");
@ -1319,7 +1320,7 @@ nsCSSFrameConstructor::ConstructTableCaptionFrame(nsIPresShell* aPres
if (NS_STYLE_DISPLAY_TABLE == parentDisplay->mDisplay) { // parent is an outer table
// determine the inner table frame, it is either aParentFrame or its first child
nsIFrame* parFrame = aParentFrame;
aParentFrame->FirstChild(nsnull, &innerFrame);
aParentFrame->FirstChild(aPresContext, nsnull, &innerFrame);
const nsStyleDisplay* innerDisplay;
innerFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)innerDisplay);
if (NS_STYLE_DISPLAY_TABLE != innerDisplay->mDisplay) {
@ -2094,7 +2095,7 @@ nsCSSFrameConstructor::TableGetAsNonScrollFrame(nsIPresContext* aPresConte
}
nsIFrame* result = aFrame;
if (IsScrollable(aPresContext, aDisplay)) {
aFrame->FirstChild(nsnull, &result);
aFrame->FirstChild(aPresContext, nsnull, &result);
}
return result;
}
@ -2207,7 +2208,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
if (mGfxScrollFrame)
{
nsIFrame* scrollPort = nsnull;
mGfxScrollFrame->FirstChild(nsnull, &scrollPort);
mGfxScrollFrame->FirstChild(aPresContext, nsnull, &scrollPort);
nsIFrame* gfxScrollbarFrame1 = nsnull;
nsIFrame* gfxScrollbarFrame2 = nsnull;
@ -2821,7 +2822,7 @@ nsCSSFrameConstructor::ConstructButtonFrames(nsIPresShell* aPresShell,
// Construct button label frame using generated content
// Get the first area frame to insert the button as a child.
nsIFrame* areaFrame = nsnull;
aFrame->FirstChild(nsnull, &areaFrame);
aFrame->FirstChild(aPresContext, nsnull, &areaFrame);
NS_ASSERTION(areaFrame != nsnull, "Button does not have an area frame");
nsresult rv = ConstructButtonLabelFrame(aPresShell, aPresContext, aContent, areaFrame, aState, aFrameItems);
return rv;
@ -3825,7 +3826,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell,
NS_NewISupportsArray(getter_AddRefs(anonymousItems));
creator->CreateAnonymousContent(*anonymousItems);
creator->CreateAnonymousContent(aPresContext, *anonymousItems);
PRUint32 count = 0;
anonymousItems->Count(&count);
@ -5055,9 +5056,10 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPresShell,
}
nsresult
nsCSSFrameConstructor::GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame)
nsCSSFrameConstructor::GetAdjustedParentFrame(nsIPresContext* aPresContext,
nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame)
{
NS_PRECONDITION(nsnull!=aCurrentParentFrame, "bad arg aCurrentParentFrame");
@ -5070,7 +5072,7 @@ nsCSSFrameConstructor::GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
if (NS_STYLE_DISPLAY_TABLE == currentParentDisplay->mDisplay) {
if (NS_STYLE_DISPLAY_TABLE_CAPTION != aChildDisplayType) {
nsIFrame *innerTableFrame = nsnull;
aCurrentParentFrame->FirstChild(nsnull, &innerTableFrame);
aCurrentParentFrame->FirstChild(aPresContext, nsnull, &innerTableFrame);
if (nsnull != innerTableFrame) {
const nsStyleDisplay* innerTableDisplay;
innerTableFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)innerTableDisplay);
@ -5554,13 +5556,13 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell,
if (NS_SUCCEEDED(res) && comboboxFrame) {
comboboxFrame->GetDropDown(&listFrame);
if (nsnull != listFrame) {
listFrame->FirstChild(nsnull, &frame);
listFrame->FirstChild(aPresContext, nsnull, &frame);
}
} else {
res = frame->QueryInterface(nsCOMTypeInfo<nsIListControlFrame>::GetIID(),
(void**)&listFrame);
if (NS_SUCCEEDED(res) && listFrame) {
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
}
}
} else {
@ -5570,13 +5572,13 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell,
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display);
if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) {
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
}
// if we get an outer table frame use its 1st child which is a table inner frame
// if we get a table cell frame use its 1st child which is an area frame
else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) ||
(NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) {
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
}
}
}
@ -5612,7 +5614,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
if (nsLayoutAtoms::scrollFrame == frameType) {
// We want the scrolled frame, not the scroll frame
nsIFrame* scrolledFrame;
frame->FirstChild(nsnull, &scrolledFrame);
frame->FirstChild(aPresContext, nsnull, &scrolledFrame);
NS_RELEASE(frameType);
if (scrolledFrame) {
scrolledFrame->GetFrameType(&frameType);
@ -5739,7 +5741,7 @@ nsCSSFrameConstructor::AppendFrames(nsIPresContext* aPresContext,
nsIFrame* aFrameList)
{
nsIFrame* firstChild;
aParentFrame->FirstChild(nsnull, &firstChild);
aParentFrame->FirstChild(aPresContext, nsnull, &firstChild);
nsFrameList frames(firstChild);
nsIFrame* lastChild = frames.LastChild();
@ -6040,7 +6042,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
const nsStyleDisplay* firstAppendedFrameDisplay;
firstAppendedFrame->GetStyleData(eStyleStruct_Display,
(const nsStyleStruct *&)firstAppendedFrameDisplay);
result = GetAdjustedParentFrame(parentFrame,
result = GetAdjustedParentFrame(aPresContext, parentFrame,
firstAppendedFrameDisplay->mDisplay,
adjustedParentFrame);
}
@ -6147,7 +6149,7 @@ nsCSSFrameConstructor::RemoveDummyFrameFromSelect(nsIPresContext* aPresContext,
// is equal to the select element's content
// this is because when gernated content is created it stuff the parent content
// pointer into the generated frame, so in this case it has the select content
parentFrame->FirstChild(nsnull, &childFrame);
parentFrame->FirstChild(aPresContext, nsnull, &childFrame);
nsCOMPtr<nsIContent> selectContent = do_QueryInterface(aSelectElement);
while (nsnull != childFrame) {
nsIContent * content;
@ -6508,7 +6510,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
// We're inserting the new frame as the first child. See if the
// parent has a :before pseudo-element
nsIFrame* firstChild;
parentFrame->FirstChild(nsnull, &firstChild);
parentFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild && IsGeneratedContentFor(aContainer, firstChild, nsCSSAtoms::beforePseudo)) {
// Insert the new frames after the :before pseudo-element
@ -6652,7 +6654,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
do {
// Recursively walk aFrame's child frames looking for placeholder frames
nsIFrame* childFrame;
aFrame->FirstChild(childListName, &childFrame);
aFrame->FirstChild(aPresContext, childListName, &childFrame);
while (childFrame) {
nsIAtom* frameType;
PRBool isPlaceholder;
@ -6685,7 +6687,7 @@ DoDeletingFrameSubtree(nsIPresContext* aPresContext,
// Get the child list name for the out-of-flow frame
nsIAtom* listName;
GetChildListNameFor(parentFrame, outOfFlowFrame, &listName);
GetChildListNameFor(aPresContext, parentFrame, outOfFlowFrame, &listName);
// Ask the parent to delete the out-of-flow frame
aFrameManager->RemoveFrame(aPresContext, *aPresShell, parentFrame,
@ -7036,7 +7038,9 @@ ApplyRenderingChangeToTree(nsIPresContext* aPresContext,
nsIViewManager* aViewManager);
static void
SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame,
SyncAndInvalidateView(nsIPresContext* aPresContext,
nsIView* aView,
nsIFrame* aFrame,
nsIViewManager* aViewManager)
{
const nsStyleColor* color;
@ -7079,7 +7083,7 @@ SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame,
// hidden visibility and be visible anyway
nsIFrame* firstChild;
aFrame->FirstChild(nsnull, &firstChild);
aFrame->FirstChild(aPresContext, nsnull, &firstChild);
if (firstChild) {
// It's not a left frame, so the view needs to be visible, but
// marked as having transparent content
@ -7122,7 +7126,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
aFrame->GetView(aPresContext, &view);
if (view) {
SyncAndInvalidateView(view, aFrame, aViewManager);
SyncAndInvalidateView(aPresContext, view, aFrame, aViewManager);
}
nsRect bounds;
@ -7138,7 +7142,7 @@ UpdateViewsForTree(nsIPresContext* aPresContext, nsIFrame* aFrame,
do {
nsIFrame* child = nsnull;
aFrame->FirstChild(childList, &child);
aFrame->FirstChild(aPresContext, childList, &child);
while (child) {
nsFrameState childState;
child->GetFrameState(&childState);
@ -7678,8 +7682,8 @@ nsCSSFrameConstructor::StyleRuleChanged(nsIPresContext* aPresContext,
}
else {
// XXX hack, skip the root and scrolling frames
frame->FirstChild(nsnull, &frame);
frame->FirstChild(nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
frame->FirstChild(aPresContext, nsnull, &frame);
if (reflow) {
StyleChangeReflow(aPresContext, frame, nsnull);
}
@ -7771,6 +7775,7 @@ nsCSSFrameConstructor::ConstructAlternateImageFrame(nsIPresShell* aPresShell,
// Create either an inline frame, block frame, or area frame
nsIFrame* containerFrame;
PRBool isOutOfFlow = PR_FALSE;
const nsStyleDisplay* display = (const nsStyleDisplay*)
aStyleContext->GetStyleData(eStyleStruct_Display);
const nsStylePosition* position = (const nsStylePosition*)
@ -7778,7 +7783,11 @@ nsCSSFrameConstructor::ConstructAlternateImageFrame(nsIPresShell* aPresShell,
if (position->IsAbsolutelyPositioned()) {
NS_NewAbsoluteItemWrapperFrame(aPresShell, &containerFrame);
} else if (display->IsFloating() || (NS_STYLE_DISPLAY_BLOCK == display->mDisplay)) {
isOutOfFlow = PR_TRUE;
} else if (display->IsFloating()) {
NS_NewFloatingItemWrapperFrame(aPresShell, &containerFrame);
isOutOfFlow = PR_TRUE;
} else if (NS_STYLE_DISPLAY_BLOCK == display->mDisplay) {
NS_NewBlockFrame(aPresShell, &containerFrame);
} else {
NS_NewInlineFrame(aPresShell, &containerFrame);
@ -7787,6 +7796,11 @@ nsCSSFrameConstructor::ConstructAlternateImageFrame(nsIPresShell* aPresShell,
nsHTMLContainerFrame::CreateViewForFrame(aPresContext, containerFrame,
aStyleContext, PR_FALSE);
// If the frame is out-of-flow, then mark it as such
nsFrameState frameState;
containerFrame->GetFrameState(&frameState);
containerFrame->SetFrameState(frameState | NS_FRAME_OUT_OF_FLOW);
// Create a text frame to display the alt-text. It gets a pseudo-element
// style context
nsIFrame* textFrame;
@ -7843,7 +7857,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Get the child list name that the frame is contained in
nsCOMPtr<nsIAtom> listName;
GetChildListNameFor(parentFrame, aFrame, getter_AddRefs(listName));
GetChildListNameFor(aPresContext, parentFrame, aFrame, getter_AddRefs(listName));
// If the frame is out of the flow, then it has a placeholder frame.
nsIFrame* placeholderFrame = nsnull;
@ -7855,7 +7869,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Get the previous sibling frame
nsIFrame* firstChild;
parentFrame->FirstChild(listName, &firstChild);
parentFrame->FirstChild(aPresContext, listName, &firstChild);
nsFrameList frameList(firstChild);
// See whether it's an IMG or an OBJECT element
@ -7893,6 +7907,12 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
// Placeholder frames have a pointer back to the out-of-flow frame.
// Make sure that's correct, too.
((nsPlaceholderFrame*)placeholderFrame)->SetOutOfFlowFrame(newFrame);
// XXX Work around a bug in the block code where the floater won't get
// reflowed unless the line containing the placeholder frame is reflowed...
nsIFrame* placeholderParentFrame;
placeholderFrame->GetParent(&placeholderParentFrame);
placeholderParentFrame->ReflowDirtyChild(aPresShell, placeholderFrame);
}
}
@ -8041,7 +8061,7 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
nsIFrame* childFrame;
nsFrameItems newChildFrames;
aFrame->FirstChild(nsnull, &childFrame);
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
nsIAtom* tableType;
@ -8121,7 +8141,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
nsIFrame* rowGroupFrame;
nsFrameItems childFrames;
aFrame->FirstChild(nsnull, &rowGroupFrame);
aFrame->FirstChild(aPresContext, nsnull, &rowGroupFrame);
while (rowGroupFrame) {
// See if it's a header/footer
nsIStyleContext* rowGroupStyle;
@ -8153,7 +8173,7 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell* aPresShell,
// Table specific initialization
((nsTableRowGroupFrame*)headerFooterFrame)->InitRepeatedFrame
((nsTableRowGroupFrame*)rowGroupFrame);
(aPresContext, (nsTableRowGroupFrame*)rowGroupFrame);
// XXX Deal with absolute and fixed frames...
childFrames.AddChild(headerFooterFrame);
@ -8274,7 +8294,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
nsIFrame* cellFrame;
nsFrameItems newChildList;
aFrame->FirstChild(nsnull, &cellFrame);
aFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (cellFrame) {
nsIAtom* tableType;
@ -8305,7 +8325,7 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// Create a continuing area frame
nsIFrame* areaFrame;
nsIFrame* continuingAreaFrame;
aFrame->FirstChild(nsnull, &areaFrame);
aFrame->FirstChild(aPresContext, nsnull, &areaFrame);
CreateContinuingFrame(aPresShell, aPresContext, areaFrame, newFrame, &continuingAreaFrame);
// Set the table cell's initial child list
@ -8343,9 +8363,10 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsIPresShell* aPresShell,
// Helper function that searches the immediate child frames for a frame that
// maps the specified content object
static nsIFrame*
FindFrameWithContent(nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent)
FindFrameWithContent(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsIContent* aContent)
{
NS_PRECONDITION(aParentFrame, "No frame to search!");
if (!aParentFrame) {
@ -8358,7 +8379,7 @@ keepLooking:
PRInt32 listIndex = 0;
do {
nsIFrame* kidFrame;
aParentFrame->FirstChild(listName, &kidFrame);
aParentFrame->FirstChild(aPresContext, listName, &kidFrame);
while (kidFrame) {
nsCOMPtr<nsIContent> kidContent;
@ -8383,7 +8404,7 @@ keepLooking:
// the same content pointer as its parent then we need to search its
// child frames, too
if (kidContent.get() == aParentContent) {
nsIFrame* matchingFrame = FindFrameWithContent(kidFrame, aParentContent,
nsIFrame* matchingFrame = FindFrameWithContent(aPresContext, kidFrame, aParentContent,
aContent);
if (matchingFrame) {
@ -8445,7 +8466,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
aFrameManager->GetPrimaryFrameFor(parentContent, &parentFrame);
if (parentFrame) {
// Search the child frames for a match
*aFrame = FindFrameWithContent(parentFrame, parentContent.get(), aContent);
*aFrame = FindFrameWithContent(aPresContext, parentFrame, parentContent.get(), aContent);
// If we found a match, then add a mapping to the hash table so
// next time this will be quick
@ -8803,7 +8824,7 @@ nsCSSFrameConstructor::AppendFirstLineFrames(
// It's possible that aBlockFrame needs to have a first-line frame
// created because it doesn't currently have any children.
nsIFrame* blockKid;
aBlockFrame->FirstChild(nsnull, &blockKid);
aBlockFrame->FirstChild(aPresContext, nsnull, &blockKid);
if (!blockKid) {
return WrapFramesInFirstLineFrame(aPresShell, aPresContext, aState, aContent,
aBlockFrame, aFrameItems);
@ -9352,7 +9373,7 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
else if ((nsLayoutAtoms::inlineFrame == frameType.get()) ||
(nsLayoutAtoms::lineFrame == frameType.get())) {
nsIFrame* kids;
frame->FirstChild(nsnull, &kids);
frame->FirstChild(aPresContext, nsnull, &kids);
WrapFramesInFirstLetterFrame(aPresShell, aPresContext, aState, frame, kids,
aModifiedParent, aTextFrame,
aPrevFrame, aLetterFrames, aStopLooking);
@ -9388,7 +9409,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
{
// First look for the floater frame that is a letter frame
nsIFrame* floater;
aBlockFrame->FirstChild(nsLayoutAtoms::floaterList, &floater);
aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floaterList, &floater);
while (floater) {
// See if we found a floating letter frame
nsCOMPtr<nsIAtom> frameType;
@ -9406,7 +9427,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
// Take the text frame away from the letter frame (so it isn't
// destroyed when we destroy the letter frame).
nsIFrame* textFrame;
floater->FirstChild(nsnull, &textFrame);
floater->FirstChild(aPresContext, nsnull, &textFrame);
if (!textFrame) {
return NS_OK;
}
@ -9511,7 +9532,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
{
nsIFrame* kid;
nsIFrame* prevSibling = nsnull;
aFrame->FirstChild(nsnull, &kid);
aFrame->FirstChild(aPresContext, nsnull, &kid);
while (kid) {
nsCOMPtr<nsIAtom> frameType;
@ -9519,7 +9540,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
if (nsLayoutAtoms::letterFrame == frameType.get()) {
// Bingo. Found it. First steal away the text frame.
nsIFrame* textFrame;
kid->FirstChild(nsnull, &textFrame);
kid->FirstChild(aPresContext, nsnull, &textFrame);
if (!textFrame) {
break;
}
@ -9600,7 +9621,7 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont
nsresult rv = NS_OK;
nsIFrame* blockKids;
aBlockFrame->FirstChild(nsnull, &blockKids);
aBlockFrame->FirstChild(aPresContext, nsnull, &blockKids);
nsIFrame* parentFrame = nsnull;
nsIFrame* textFrame = nsnull;
nsIFrame* prevFrame = nsnull;
@ -9685,7 +9706,7 @@ nsCSSFrameConstructor::CreateTreeWidgetContent(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv) && (nsnull != newFrame)) {
// Notify the parent frame
if (aIsScrollbar)
((nsTreeRowGroupFrame*)aParentFrame)->SetScrollbarFrame(newFrame);
((nsTreeRowGroupFrame*)aParentFrame)->SetScrollbarFrame(aPresContext, newFrame);
else if (aIsAppend)
rv = ((nsTreeRowGroupFrame*)aParentFrame)->TreeAppendFrames(newFrame);
else
@ -10182,7 +10203,8 @@ nsCSSFrameConstructor::ProcessInlineChildren(nsIPresShell* aPresShell,
// This differs from DeletingFrameSubtree() because the frames have not yet been
// added to the frame hierarchy
static void
DoCleanupFrameReferences(nsIFrameManager* aFrameManager,
DoCleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIFrame* aFrame)
{
nsCOMPtr<nsIContent> content;
@ -10195,9 +10217,9 @@ DoCleanupFrameReferences(nsIFrameManager* aFrameManager,
// Recursively walk the child frames.
// Note: we only need to look at the principal child list
nsIFrame* childFrame;
aFrame->FirstChild(nsnull, &childFrame);
aFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
DoCleanupFrameReferences(aFrameManager, childFrame);
DoCleanupFrameReferences(aPresContext, aFrameManager, childFrame);
// Get the next sibling child frame
childFrame->GetNextSibling(&childFrame);
@ -10206,11 +10228,12 @@ DoCleanupFrameReferences(nsIFrameManager* aFrameManager,
// Helper function that walks a frame list and calls DoCleanupFrameReference()
static void
CleanupFrameReferences(nsIFrameManager* aFrameManager,
CleanupFrameReferences(nsIPresContext* aPresContext,
nsIFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
while (aFrameList) {
DoCleanupFrameReferences(aFrameManager, aFrameList);
DoCleanupFrameReferences(aPresContext, aFrameManager, aFrameList);
// Get the sibling frame
aFrameList->GetNextSibling(&aFrameList);
@ -10241,21 +10264,21 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
// Destroy the frames. As we do make sure any content to frame mappings
// or entries in the undisplayed content map are removed
CleanupFrameReferences(frameManager, aFrameList);
CleanupFrameReferences(aPresContext, frameManager, aFrameList);
nsFrameList tmp(aFrameList);
tmp.DestroyFrames(aPresContext);
if (aState.mAbsoluteItems.childList) {
CleanupFrameReferences(frameManager, aState.mAbsoluteItems.childList);
CleanupFrameReferences(aPresContext, frameManager, aState.mAbsoluteItems.childList);
tmp.SetFrames(aState.mAbsoluteItems.childList);
tmp.DestroyFrames(aPresContext);
}
if (aState.mFixedItems.childList) {
CleanupFrameReferences(frameManager, aState.mFixedItems.childList);
CleanupFrameReferences(aPresContext, frameManager, aState.mFixedItems.childList);
tmp.SetFrames(aState.mFixedItems.childList);
tmp.DestroyFrames(aPresContext);
}
if (aState.mFloatedItems.childList) {
CleanupFrameReferences(frameManager, aState.mFloatedItems.childList);
CleanupFrameReferences(aPresContext, frameManager, aState.mFloatedItems.childList);
tmp.SetFrames(aState.mFloatedItems.childList);
tmp.DestroyFrames(aPresContext);
}

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

@ -579,9 +579,10 @@ protected:
nsIStyleContext* aStyleContext,
nsFrameItems& aFrameItems);
nsresult GetAdjustedParentFrame(nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame);
nsresult GetAdjustedParentFrame(nsIPresContext* aPresContext,
nsIFrame* aCurrentParentFrame,
PRUint8 aChildDisplayType,
nsIFrame*& aNewParentFrame);
nsresult ProcessChildren(nsIPresShell* aPresShell,

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

@ -79,8 +79,9 @@ BasicTableLayoutStrategy::~BasicTableLayoutStrategy()
MOZ_COUNT_DTOR(BasicTableLayoutStrategy);
}
PRBool BasicTableLayoutStrategy::Initialize(nsSize* aMaxElementSize,
nscoord aMaxWidth)
PRBool BasicTableLayoutStrategy::Initialize(nsIPresContext* aPresContext,
nsSize* aMaxElementSize,
nscoord aMaxWidth)
{
ContinuingFrameCheck();
@ -92,7 +93,7 @@ PRBool BasicTableLayoutStrategy::Initialize(nsSize* aMaxElementSize,
mCellSpacingTotal = 0;
mCols = mTableFrame->GetEffectiveCOLSAttribute();
// assign the width of all fixed-width columns
AssignPreliminaryColumnWidths(aMaxWidth);
AssignPreliminaryColumnWidths(aPresContext, aMaxWidth);
// set aMaxElementSize here because we compute mMinTableWidth in AssignPreliminaryColumnWidths
if (nsnull != aMaxElementSize) {
@ -137,13 +138,14 @@ void BasicTableLayoutStrategy::ContinuingFrameCheck()
#endif
}
PRBool BCW_Wrapup(BasicTableLayoutStrategy* aStrategy,
PRBool BCW_Wrapup(nsIPresContext* aPresContext,
BasicTableLayoutStrategy* aStrategy,
nsTableFrame* aTableFrame,
PRInt32* aAllocTypes)
{
if (aAllocTypes)
delete [] aAllocTypes;
if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
return PR_TRUE;
}
@ -158,11 +160,12 @@ PRBool BCW_Wrapup(BasicTableLayoutStrategy* aStrategy,
// space if the sum of the col allocations is insufficient
PRBool
BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableStyle,
BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidthIn)
{
if (gsDebugBalance) {printf("BalanceColumnWidths en max=%d\n", aMaxWidthIn); mTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugBalance) {printf("BalanceColumnWidths en max=%d\n", aMaxWidthIn); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
ContinuingFrameCheck();
if (!aTableStyle) {
@ -219,13 +222,13 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
// if the max width available is less than the min content width for fixed table, we're done
if (!tableIsAutoWidth && (maxWidth < mMinTableContentWidth)) {
return BCW_Wrapup(this, mTableFrame, nsnull);
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
// if the max width available is less than the min content width for auto table
// that had no % cells/cols, we're done
if (tableIsAutoWidth && (maxWidth < mMinTableContentWidth) && (0 == perAdjTableWidth)) {
return BCW_Wrapup(this, mTableFrame, nsnull);
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
PRInt32 cellSpacingTotal;
@ -260,7 +263,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, PCT, PR_FALSE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// allocate fixed cols
@ -271,7 +274,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, FIX, PR_TRUE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// allocate fixed adjusted cols
@ -282,7 +285,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, FIX_ADJ, PR_TRUE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// allocate proportional cols up to their min proportional value
@ -293,7 +296,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, MIN_PRO, PR_FALSE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
@ -305,13 +308,13 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, DES_CON, PR_FALSE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// if this is a nested non auto table and pass1 reflow, we are done
if ((maxWidth == NS_UNCONSTRAINEDSIZE) && (!tableIsAutoWidth)) {
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
// allocate the rest unconstrained
@ -347,7 +350,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
@ -691,9 +694,10 @@ BasicTableLayoutStrategy::ComputeColspanWidths(PRInt32 aWidthIndex,
// Determine min, desired, fixed, and proportional sizes for the cols and
// and calculate min/max table width
PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth)
PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aMaxWidth)
{
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n", aMaxWidth); mTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n", aMaxWidth); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
PRBool rv = PR_FALSE;
PRInt32 numRows = mTableFrame->GetRowCount();
PRInt32 numCols = mTableFrame->GetColCount();
@ -912,7 +916,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
}
SetMinAndMaxTableContentWidths();
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
return rv;
}

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

@ -58,8 +58,9 @@ public:
* in the table (content, structure, or style)
* @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param
*/
virtual PRBool Initialize(nsSize* aMaxElementSize,
nscoord aMaxSize);
virtual PRBool Initialize(nsIPresContext* aPresContext,
nsSize* aMaxElementSize,
nscoord aMaxSize);
/** compute the max element size of the table.
* assumes that Initialize has been called
@ -73,7 +74,8 @@ public:
* @param aReflowState - the reflow state for mTableFrame
* @param aMaxWidth - the computed max width for columns to fit into
*/
virtual PRBool BalanceColumnWidths(nsIStyleContext* aTableStyle,
virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth);
@ -97,7 +99,8 @@ protected:
* @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error
*
*/
virtual PRBool AssignPreliminaryColumnWidths(nscoord aComputedWidth);
virtual PRBool AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aComputedWidth);
/**
* Calculate the adjusted widths (min, desired, fixed, or pct) for a cell

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

@ -40,7 +40,8 @@ FixedTableLayoutStrategy::~FixedTableLayoutStrategy()
{
}
PRBool FixedTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableStyle,
PRBool FixedTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth)
{
@ -55,7 +56,8 @@ PRBool FixedTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aT
* otherwise the cell get a proportion of the remaining space
* as determined by the table width attribute. If no table width attribute, it gets 0 width
*/
PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aComputedWidth)
PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aComputedWidth)
{
// NS_ASSERTION(aComputedWidth != NS_UNCONSTRAINEDSIZE, "bad computed width");
const nsStylePosition* tablePosition;

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

@ -58,7 +58,8 @@ public:
* @param aReflowState - the reflow state for mTableFrame
* @param aMaxWidth - the computed max width for columns to fit into
*/
virtual PRBool BalanceColumnWidths(nsIStyleContext* aTableStyle,
virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth);
@ -95,7 +96,8 @@ protected:
* @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error
*
*/
virtual PRBool AssignPreliminaryColumnWidths(nscoord aComputedWidth);
virtual PRBool AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aComputedWidth);
};

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

@ -46,13 +46,13 @@ MOZ_DECL_CTOR_COUNTER(nsCellMap);
// nsTableCellMap
nsTableCellMap::nsTableCellMap(nsTableFrame& aTableFrame)
nsTableCellMap::nsTableCellMap(nsIPresContext* aPresContext, nsTableFrame& aTableFrame)
{
MOZ_COUNT_CTOR(nsTableCellMap);
mFirstMap = nsnull;
nsTableRowGroupFrame* prior = nsnull;
nsIFrame* child;
aTableFrame.FirstChild(nsnull, &child);
aTableFrame.FirstChild(aPresContext, nsnull, &child);
while(child) {
nsTableRowGroupFrame* groupFrame = aTableFrame.GetRowGroupFrame(child);
if (groupFrame) {
@ -250,7 +250,8 @@ nsTableCellMap::AddColsAtEnd(PRUint32 aNumCols)
}
void
nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
nsTableCellMap::InsertRows(nsIPresContext* aPresContext,
nsTableRowGroupFrame& aParent,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans)
@ -260,7 +261,7 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
nsCellMap* cellMap = mFirstMap;
while (cellMap) {
if (cellMap->GetRowGroup() == &aParent) {
cellMap->InsertRows(*this, aRows, rowIndex, aConsiderSpans);
cellMap->InsertRows(aPresContext, *this, aRows, rowIndex, aConsiderSpans);
return;
}
rowIndex -= cellMap->GetRowCount();
@ -273,15 +274,16 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
}
void
nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans)
nsTableCellMap::RemoveRows(nsIPresContext* aPresContext,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans)
{
PRInt32 rowIndex = aFirstRowIndex;
nsCellMap* cellMap = mFirstMap;
while (cellMap) {
if (cellMap->GetRowCount() > rowIndex) {
cellMap->RemoveRows(*this, rowIndex, aNumRowsToRemove, aConsiderSpans);
cellMap->RemoveRows(aPresContext, *this, rowIndex, aNumRowsToRemove, aConsiderSpans);
break;
}
rowIndex -= cellMap->GetRowCount();
@ -614,7 +616,8 @@ void nsCellMap::GrowRow(nsVoidArray& aRow,
}
void
nsCellMap::InsertRows(nsTableCellMap& aMap,
nsCellMap::InsertRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans)
@ -627,7 +630,7 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
}
if (!aConsiderSpans) {
ExpandWithRows(aMap, aRows, aFirstRowIndex);
ExpandWithRows(aPresContext, aMap, aRows, aFirstRowIndex);
return;
}
@ -638,19 +641,20 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
// if any of the new cells span out of the new rows being added, then rebuild
// XXX it would be better to only rebuild the portion of the map that follows the new rows
if (!spansCauseRebuild && (aFirstRowIndex < mRows.Count())) {
spansCauseRebuild = CellsSpanOut(aRows);
spansCauseRebuild = CellsSpanOut(aPresContext, aRows);
}
if (spansCauseRebuild) {
RebuildConsideringRows(aMap, aFirstRowIndex, &aRows);
RebuildConsideringRows(aPresContext, aMap, aFirstRowIndex, &aRows);
}
else {
ExpandWithRows(aMap, aRows, aFirstRowIndex);
ExpandWithRows(aPresContext, aMap, aRows, aFirstRowIndex);
}
}
void
nsCellMap::RemoveRows(nsTableCellMap& aMap,
nsCellMap::RemoveRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans)
@ -674,7 +678,7 @@ nsCellMap::RemoveRows(nsTableCellMap& aMap,
0, numCols - 1, numCols);
if (spansCauseRebuild) {
RebuildConsideringRows(aMap, aFirstRowIndex, nsnull, aNumRowsToRemove);
RebuildConsideringRows(aPresContext, aMap, aFirstRowIndex, nsnull, aNumRowsToRemove);
}
else {
ShrinkWithoutRows(aMap, aFirstRowIndex, aNumRowsToRemove);
@ -800,13 +804,13 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
return startColIndex;
}
PRBool nsCellMap::CellsSpanOut(nsVoidArray& aRows)
PRBool nsCellMap::CellsSpanOut(nsIPresContext* aPresContext, nsVoidArray& aRows)
{
PRInt32 numNewRows = aRows.Count();
for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) {
nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX);
nsIFrame* cellFrame = nsnull;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (cellFrame) {
nsIAtom* frameType;
cellFrame->GetFrameType(&frameType);
@ -921,7 +925,8 @@ void nsCellMap::InsertCells(nsTableCellMap& aMap,
}
void
nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
nsCellMap::ExpandWithRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRowFrames,
PRInt32 aStartRowIndex)
{
@ -940,7 +945,7 @@ nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowFrames.ElementAt(newRowIndex);
// append cells
nsIFrame* cFrame = nsnull;
rFrame->FirstChild(nsnull, &cFrame);
rFrame->FirstChild(aPresContext, nsnull, &cFrame);
while (cFrame) {
nsIAtom* cFrameType;
cFrame->GetFrameType(&cFrameType);
@ -1295,7 +1300,8 @@ nsCellMap::RemoveCol(PRInt32 aColIndex)
}
void
nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aStartRowIndex,
nsVoidArray* aRowsToInsert,
PRBool aNumRowsToRemove)
@ -1341,7 +1347,7 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
for (PRInt32 newRowX = 0; newRowX < numNewRows; newRowX++) {
nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowsToInsert->ElementAt(newRowX);
nsIFrame* cFrame = nsnull;
rFrame->FirstChild(nsnull, &cFrame);
rFrame->FirstChild(aPresContext, nsnull, &cFrame);
while (cFrame) {
nsIAtom* cFrameType;
cFrame->GetFrameType(&cFrameType);

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

@ -45,7 +45,7 @@ struct nsColInfo
class nsTableCellMap
{
public:
nsTableCellMap(nsTableFrame& aTableFrame);
nsTableCellMap(nsIPresContext* aPresContext, nsTableFrame& aTableFrame);
/** destructor
* NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
@ -82,14 +82,16 @@ public:
void RemoveCell(nsTableCellFrame* aCellFrame,
PRInt32 aRowIndex);
void InsertRows(nsTableRowGroupFrame& aRowGroup,
void InsertRows(nsIPresContext* aPresContext,
nsTableRowGroupFrame& aRowGroup,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans);
void RemoveRows(PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans);
void RemoveRows(nsIPresContext* aPresContext,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans);
PRInt32 GetEffectiveColSpan(PRInt32 aColIndex,
const nsTableCellFrame& aCell);
@ -203,12 +205,14 @@ public:
void RemoveCol(PRInt32 aColIndex);
void InsertRows(nsTableCellMap& aMap,
void InsertRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans);
void RemoveRows(nsTableCellMap& aMap,
void RemoveRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans);
@ -279,7 +283,8 @@ protected:
PRInt32 GetNumCellsIn(PRInt32 aColIndex) const;
void ExpandWithRows(nsTableCellMap& aMap,
void ExpandWithRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRowFrames,
PRInt32 aStartRowIndex);
@ -299,7 +304,8 @@ protected:
PRInt32 aRowIndex,
PRInt32 aColIndex);
void RebuildConsideringRows(nsTableCellMap& aMap,
void RebuildConsideringRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aStartRowIndex,
nsVoidArray* aRowsToInsert,
PRInt32 aNumRowsToRemove = 0);
@ -310,7 +316,7 @@ protected:
PRInt32 aColIndex,
PRBool aInsert);
PRBool CellsSpanOut(nsVoidArray& aNewRows);
PRBool CellsSpanOut(nsIPresContext* aPresContext, nsVoidArray& aNewRows);
PRBool CellsSpanInOrOut(PRInt32 aStartRowIndex,
PRInt32 aEndRowIndex,

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

@ -26,6 +26,7 @@
#include "nscore.h"
#include "nsSize.h"
class nsIPresContext;
class nsIStyleContext;
struct nsHTMLReflowState;
class nsTableCellFrame;
@ -40,8 +41,9 @@ public:
* @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param
* @param aComputedWidth the computed size of the table
*/
virtual PRBool Initialize(nsSize* aMaxElementSize,
nscoord aComputedWidth)=0;
virtual PRBool Initialize(nsIPresContext* aPresContext,
nsSize* aMaxElementSize,
nscoord aComputedWidth)=0;
/** compute the max-element-size for the table
* @param aMaxElementSize [OUT] width field set to the min legal width of the table
@ -55,7 +57,8 @@ public:
* @param aMaxWidth the width constraint
*/
virtual PRBool BalanceColumnWidths(nsIStyleContext* aTableStyle,
virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth)=0;

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

@ -62,9 +62,10 @@ void nsTableColGroupFrame::SetType(nsTableColGroupType aType) {
mBits.mType = aType - eColGroupContent;
}
void nsTableColGroupFrame::ResetColIndices(nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame)
void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext,
nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame)
{
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame*)aFirstColGroup;
PRInt32 colIndex = aFirstColIndex;
@ -75,7 +76,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIFrame* aFirstColGroup,
colGroupFrame->SetStartColumnIndex(colIndex);
nsIFrame* colFrame = aStartColFrame;
if (!colFrame || (colIndex != aFirstColIndex)) {
colGroupFrame->FirstChild(nsnull, &colFrame);
colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame);
}
while (colFrame) {
nsIAtom* colType;
@ -134,7 +135,7 @@ nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext,
nsIFrame* nextSibling;
GetNextSibling(&nextSibling);
if (nextSibling) {
ResetColIndices(nextSibling, colIndex);
ResetColIndices(&aPresContext, nextSibling, colIndex);
}
}
@ -319,7 +320,7 @@ nsTableColGroupFrame::InsertFrames(nsIPresContext* aPresContext,
nsIFrame* lastFrame = frames.LastChild();
mFrames.InsertFrames(this, aPrevFrameIn, aFrameList);
nsIFrame* prevFrame = nsTableFrame::GetFrameAtOrBefore(this, aPrevFrameIn,
nsIFrame* prevFrame = nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrameIn,
nsLayoutAtoms::tableColFrame);
PRInt32 colIndex = (prevFrame) ? ((nsTableColFrame*)prevFrame)->GetColIndex() + 1 : 0;
@ -359,7 +360,7 @@ nsTableColGroupFrame::RemoveChild(nsIPresContext& aPresContext,
if (mFrames.DestroyFrame(&aPresContext, (nsIFrame*)&aChild)) {
mColCount--;
if (aResetColIndices) {
ResetColIndices(this, colIndex, nextChild);
ResetColIndices(&aPresContext, this, colIndex, nextChild);
}
}
}
@ -703,7 +704,8 @@ PRInt32 nsTableColGroupFrame::SetStartColumnIndex (int aIndex)
// this could be optimized by using col group frame starting indicies,
// but typically there aren't enough very large col groups for the added complexity.
nsTableColGroupFrame*
nsTableColGroupFrame::GetColGroupFrameContaining(nsFrameList& aColGroupList,
nsTableColGroupFrame::GetColGroupFrameContaining(nsIPresContext* aPresContext,
nsFrameList& aColGroupList,
nsTableColFrame& aColFrame)
{
nsIFrame* childFrame = aColGroupList.FirstChild();
@ -712,7 +714,7 @@ nsTableColGroupFrame::GetColGroupFrameContaining(nsFrameList& aColGroupList,
childFrame->GetFrameType(&frameType);
if (nsLayoutAtoms::tableColGroupFrame == frameType) {
nsTableColFrame* colFrame = nsnull;
childFrame->FirstChild(nsnull, (nsIFrame **)&colFrame);
childFrame->FirstChild(aPresContext, nsnull, (nsIFrame **)&colFrame);
while (colFrame) {
if (colFrame == &aColFrame) {
NS_RELEASE(frameType);

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

@ -154,13 +154,15 @@ public:
void DeleteColFrame(nsIPresContext* aPresContext, nsTableColFrame* aColFrame);
static nsTableColGroupFrame* GetColGroupFrameContaining(nsFrameList& aColGroupList,
static nsTableColGroupFrame* GetColGroupFrameContaining(nsIPresContext* aPresContext,
nsFrameList& aColGroupList,
nsTableColFrame& aColFrame);
nsFrameList& GetChildList();
static void ResetColIndices(nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame = nsnull);
static void ResetColIndices(nsIPresContext* aPresContext,
nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame = nsnull);
protected:
nsTableColGroupFrame();

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

@ -168,7 +168,6 @@ nsTableFrame::nsTableFrame()
mColumnWidths = new PRInt32[mColumnWidthsLength];
nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
#endif
mCellMap = new nsTableCellMap(*this);
}
NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame)
@ -197,6 +196,10 @@ nsTableFrame::Init(nsIPresContext* aPresContext,
{
nsresult rv;
// Create the cell map
// XXX Why do we do this for continuing frames?
mCellMap = new nsTableCellMap(aPresContext, *this);
// Let the base class do its processing
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext,
aPrevInFlow);
@ -614,8 +617,9 @@ void nsTableFrame::ProcessGroupRules(nsIPresContext* aPresContext)
}
void nsTableFrame::AdjustRowIndices(PRInt32 aRowIndex,
PRInt32 aAdjustment)
void nsTableFrame::AdjustRowIndices(nsIPresContext* aPresContext,
PRInt32 aRowIndex,
PRInt32 aAdjustment)
{
// Iterate over the row groups and adjust the row indices of all rows
// whose index is >= aRowIndex.
@ -624,18 +628,19 @@ void nsTableFrame::AdjustRowIndices(PRInt32 aRowIndex,
const nsStyleDisplay *rowGroupDisplay;
rowGroupFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)rowGroupDisplay);
if (IsRowGroup(rowGroupDisplay->mDisplay)) {
AdjustRowIndices(rowGroupFrame, aRowIndex, aAdjustment);
AdjustRowIndices(aPresContext, rowGroupFrame, aRowIndex, aAdjustment);
}
}
}
NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment)
NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIPresContext* aPresContext,
nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment)
{
nsresult rv = NS_OK;
nsIFrame *rowFrame;
aRowGroup->FirstChild(nsnull, &rowFrame);
aRowGroup->FirstChild(aPresContext, nsnull, &rowFrame);
for ( ; nsnull!=rowFrame; rowFrame->GetNextSibling(&rowFrame))
{
const nsStyleDisplay *rowDisplay;
@ -648,7 +653,7 @@ NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIFrame* aRowGroup,
}
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP==rowDisplay->mDisplay)
{
AdjustRowIndices(rowFrame, aRowIndex, anAdjustment);
AdjustRowIndices(aPresContext, rowFrame, aRowIndex, anAdjustment);
}
}
return rv;
@ -676,7 +681,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext,
nsTableColGroupFrame* cgFrame = (nsTableColGroupFrame*)kidFrame;
cgFrame->SetStartColumnIndex(colIndex);
nsIFrame* firstCol;
kidFrame->FirstChild(nsnull, &firstCol);
kidFrame->FirstChild(&aPresContext, nsnull, &firstCol);
cgFrame->AddColsToTable(aPresContext, colIndex, PR_FALSE, firstCol);
PRInt32 numCols = cgFrame->GetColCount();
colIndex += numCols;
@ -690,7 +695,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext,
}
if (firstColGroupToReset) {
nsTableColGroupFrame::ResetColIndices(firstColGroupToReset, aStartColIndex);
nsTableColGroupFrame::ResetColIndices(&aPresContext, firstColGroupToReset, aStartColIndex);
}
}
@ -867,7 +872,7 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
nsIFrame* childFrame;
// Get the last col frame
aColGroupFrame.FirstChild(nsnull, &childFrame);
aColGroupFrame.FirstChild(&aPresContext, nsnull, &childFrame);
while (childFrame) {
nsIAtom* frameType = nsnull;
childFrame->GetFrameType(&frameType);
@ -925,7 +930,8 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
PRInt32 startColIndex = aColGroupFrame.GetStartColumnIndex();
if (aPrevFrameIn) {
nsTableColFrame* colFrame =
(nsTableColFrame*)nsTableFrame::GetFrameAtOrBefore((nsIFrame*)&aColGroupFrame, aPrevFrameIn,
(nsTableColFrame*)nsTableFrame::GetFrameAtOrBefore(&aPresContext,
(nsIFrame*)&aColGroupFrame, aPrevFrameIn,
nsLayoutAtoms::tableColFrame);
if (colFrame) {
startColIndex = colFrame->GetColIndex();
@ -1057,7 +1063,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext,
if (cellMap) {
PRInt32 origNumRows = cellMap->GetRowCount();
PRInt32 numNewRows = aRowFrames.Count();
cellMap->InsertRows(aRowGroupFrame, aRowFrames, aRowIndex, aConsiderSpans);
cellMap->InsertRows(&aPresContext, aRowGroupFrame, aRowFrames, aRowIndex, aConsiderSpans);
PRInt32 numColsInMap = GetColCount(); // cell map's notion of num cols
PRInt32 numColsInCache = mColFrames.Count();
numColsToAdd = numColsInMap - numColsInCache;
@ -1067,7 +1073,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext,
PR_TRUE);
}
if (aRowIndex < origNumRows) {
AdjustRowIndices(aRowIndex, numNewRows);
AdjustRowIndices(&aPresContext, aRowIndex, numNewRows);
}
// assign the correct row indices to the new rows. If they were adjusted above
// it may not have been done correctly because each row is constructed with index 0
@ -1094,7 +1100,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext,
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
cellMap->RemoveRows(aFirstRowIndex, aNumRowsToRemove, aConsiderSpans);
cellMap->RemoveRows(&aPresContext, aFirstRowIndex, aNumRowsToRemove, aConsiderSpans);
// only remove cols that are of type eTypeAnonymous cell (they are at the end)
PRInt32 numColsInMap = GetColCount(); // cell map's notion of num cols
PRInt32 numColsInCache = mColFrames.Count();
@ -1104,7 +1110,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext,
cellMap->AddColsAtEnd(numColsNotRemoved);
}
}
AdjustRowIndices(aFirstRowIndex, -aNumRowsToRemove);
AdjustRowIndices(&aPresContext, aFirstRowIndex, -aNumRowsToRemove);
//printf("removeRowsAfter\n");
//Dump(PR_TRUE, PR_FALSE, PR_TRUE);
}
@ -1155,15 +1161,16 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame,
// collect the rows ancestors of aFrame
PRInt32
nsTableFrame::CollectRows(nsIFrame* aFrame,
nsVoidArray& aCollection)
nsTableFrame::CollectRows(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsVoidArray& aCollection)
{
if (!aFrame) return 0;
PRInt32 numRows = 0;
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aFrame);
if (rgFrame) {
nsIFrame* childFrame = nsnull;
rgFrame->FirstChild(nsnull, &childFrame);
rgFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
nsIAtom* childType;
childFrame->GetFrameType(&childType);
@ -1172,7 +1179,7 @@ nsTableFrame::CollectRows(nsIFrame* aFrame,
numRows++;
}
else {
numRows += CollectRows(childFrame, aCollection);
numRows += CollectRows(aPresContext, childFrame, aCollection);
}
NS_IF_RELEASE(childType);
childFrame->GetNextSibling(&childFrame);
@ -1196,7 +1203,7 @@ nsTableFrame::InsertRowGroups(nsIPresContext& aPresContext,
// create and add the cell map for the row group
cellMap->InsertGroupCellMap(rowIndex, *rgFrame);
// collect the new row frames in an array and add them to the table
PRInt32 numRows = CollectRows(kidFrame, rows);
PRInt32 numRows = CollectRows(&aPresContext, kidFrame, rows);
if (numRows > 0) {
InsertRows(aPresContext, *rgFrame, rows, rowIndex, PR_TRUE);
rowIndex += numRows;
@ -1254,18 +1261,17 @@ void nsTableFrame::ListColumnLayoutData(FILE* out, PRInt32 aIndent)
// Child frame enumeration
NS_IMETHODIMP
nsTableFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsTableFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
if (nsnull == aListName) {
*aFirstChild = mFrames.FirstChild();
return NS_OK;
}
else if (aListName == nsLayoutAtoms::colGroupList) {
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::colGroupList) {
*aFirstChild = mColGroups.FirstChild();
return NS_OK;
}
*aFirstChild = nsnull;
return NS_ERROR_INVALID_ARG;
return nsHTMLContainerFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
NS_IMETHODIMP
@ -1528,7 +1534,7 @@ void nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext, nscoord aHe
while (nsnull != colGroupFrame) {
nscoord colGroupWidth = 0;
nsIFrame* colFrame = nsnull;
colGroupFrame->FirstChild(nsnull, &colFrame);
colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame);
nsPoint colOrigin(0, 0);
while (nsnull != colFrame) {
const nsStyleDisplay* colDisplay;
@ -1616,7 +1622,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
if (mTableLayoutStrategy && (needsRecalc || !IsColumnWidthsValid())) {
nscoord boxWidth = CalcBorderBoxWidth(aReflowState);
mTableLayoutStrategy->Initialize(aDesiredSize.maxElementSize, boxWidth);
mTableLayoutStrategy->Initialize(aPresContext, aDesiredSize.maxElementSize, boxWidth);
mBits.mColumnWidthsValid = PR_TRUE; //so we don't do this a second time below
}
@ -1681,7 +1687,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if (isAutoWidth && !IsMaximumWidthValid()) {
// Initialize the strategy and have it compute the natural size of
// the table
mTableLayoutStrategy->Initialize(nsnull, NS_UNCONSTRAINEDSIZE);
mTableLayoutStrategy->Initialize(aPresContext, nsnull, NS_UNCONSTRAINEDSIZE);
// Now the maximum width is valid
mBits.mMaximumWidthValid = PR_TRUE;
@ -2043,7 +2049,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible);
nsIFrame* rowFrame;
aRowGroupFrame->FirstChild(nsnull, &rowFrame);
aRowGroupFrame->FirstChild(aPresContext, nsnull, &rowFrame);
while (nsnull != rowFrame) {
const nsStyleDisplay* rowDisplay;
@ -2059,7 +2065,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
rowRect.height = 0;
rowFrame->SetRect(aPresContext, rowRect);
nsIFrame* cellFrame;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (nsnull != cellFrame) {
const nsStyleDisplay* cellDisplay;
cellFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)cellDisplay));
@ -2158,7 +2164,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
const nsStyleDisplay* groupDisplay;
groupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)groupDisplay));
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible);
nsTableIterator colIter(*groupFrame, eTableDIR);
nsTableIterator colIter(aPresContext, *groupFrame, eTableDIR);
nsIFrame* colFrame = colIter.First();
// iterate over the cols in the col group
while (nsnull != colFrame) {
@ -2286,7 +2292,8 @@ nsTableFrame::AppendFrames(nsIPresContext* aPresContext,
firstAppendedColGroup = f;
nsIFrame* lastChild = mFrames.LastChild();
nsTableColGroupFrame* lastColGroup =
(nsTableColGroupFrame*)GetFrameAtOrBefore(this, lastChild, nsLayoutAtoms::tableColGroupFrame);
(nsTableColGroupFrame*)GetFrameAtOrBefore(aPresContext, this, lastChild,
nsLayoutAtoms::tableColGroupFrame);
startColIndex = (lastColGroup)
? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
}
@ -2361,7 +2368,8 @@ nsTableFrame::InsertFrames(nsIPresContext* aPresContext,
PRInt32 startColIndex = 0;
if (aPrevFrame) {
nsTableColGroupFrame* prevColGroup =
(nsTableColGroupFrame*)GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableColGroupFrame);
(nsTableColGroupFrame*)GetFrameAtOrBefore(aPresContext, this, aPrevFrame,
nsLayoutAtoms::tableColGroupFrame);
if (prevColGroup) {
startColIndex = prevColGroup->GetStartColumnIndex() + prevColGroup->GetColCount();
}
@ -2370,7 +2378,7 @@ nsTableFrame::InsertFrames(nsIPresContext* aPresContext,
} else if (IsRowGroup(display->mDisplay)) {
// get the starting row index of the new rows and insert them into the table
PRInt32 rowIndex = 0;
nsTableRowGroupFrame* prevRowGroup = (nsTableRowGroupFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableRowGroupFrame);
nsTableRowGroupFrame* prevRowGroup = (nsTableRowGroupFrame *)nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrame, nsLayoutAtoms::tableRowGroupFrame);
if (prevRowGroup) {
PRInt32 numRows;
prevRowGroup->GetRowCount(numRows);
@ -2427,7 +2435,7 @@ nsTableFrame::RemoveFrame(nsIPresContext* aPresContext,
// remove the col frames, the colGroup frame and reset col indices
colGroup->RemoveChildrenAtEnd(*aPresContext, colGroup->GetColCount());
mColGroups.DestroyFrame(aPresContext, aOldFrame);
nsTableColGroupFrame::ResetColIndices(nextColGroupFrame, firstColIndex);
nsTableColGroupFrame::ResetColIndices(aPresContext, nextColGroupFrame, firstColIndex);
// remove the cols from the table
PRInt32 colX;
for (colX = lastColIndex; colX >= firstColIndex; colX--) {
@ -2471,7 +2479,7 @@ nsTableFrame::RemoveFrame(nsIPresContext* aPresContext,
if (numColsNotRemoved > 0) {
cellMap->AddColsAtEnd(numColsNotRemoved);
}
AdjustRowIndices(startRowIndex, -numRows);
AdjustRowIndices(aPresContext, startRowIndex, -numRows);
// remove the row group frame from the sibling chain
mFrames.DestroyFrame(aPresContext, aOldFrame);
@ -2531,15 +2539,16 @@ NS_METHOD nsTableFrame::IncrementalReflow(nsIPresContext* aPresContext,
}
// this assumes the dirty children are contiguous
PRBool GetDirtyChildren(nsIFrame* aFrame,
nsIFrame** aFirstDirty,
PRInt32& aNumDirty)
PRBool GetDirtyChildren(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame** aFirstDirty,
PRInt32& aNumDirty)
{
*aFirstDirty = nsnull;
aNumDirty = 0;
nsIFrame* kidFrame;
aFrame->FirstChild(nsnull, &kidFrame);
aFrame->FirstChild(aPresContext, nsnull, &kidFrame);
while (kidFrame) {
nsFrameState frameState;
kidFrame->GetFrameState(&frameState);
@ -3248,16 +3257,16 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
else
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
mTableLayoutStrategy->Initialize(aMaxElementSize, boxWidth);
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth);
mBits.mColumnWidthsValid=PR_TRUE;
}
// fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars
// reflow gets called twice and the 2nd time has the correct space available.
else if (!RequiresPass1Layout()) {
mTableLayoutStrategy->Initialize(aMaxElementSize, boxWidth);
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth);
}
mTableLayoutStrategy->BalanceColumnWidths(mStyleContext, aReflowState, maxWidth);
mTableLayoutStrategy->BalanceColumnWidths(aPresContext, mStyleContext, aReflowState, maxWidth);
//Dump(PR_TRUE, PR_TRUE);
mBits.mColumnWidthsSet=PR_TRUE;
@ -3526,7 +3535,7 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext* aPresContext
childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
if (IsRowGroup(childDisplay->mDisplay)) {
if (((nsTableRowGroupFrame*)childFrame)->RowGroupReceivesExcessSpace()) {
((nsTableRowGroupFrame*)childFrame)->GetHeightOfRows(sumOfRowHeights);
((nsTableRowGroupFrame*)childFrame)->GetHeightOfRows(aPresContext, sumOfRowHeights);
}
if (!firstRowGroupFrame) {
// the first row group's y position starts inside our padding
@ -4237,9 +4246,10 @@ nsTableFrame::IsFinalPass(const nsHTMLReflowState& aState)
// Find the closet sibling before aPriorChildFrame (including aPriorChildFrame) that
// is of type aChildType
nsIFrame*
nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType)
nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType)
{
nsIFrame* result = nsnull;
if (!aPriorChildFrame) {
@ -4257,7 +4267,7 @@ nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
// the beginnng and find the closest one
nsIFrame* childFrame;
nsIFrame* lastMatchingFrame = nsnull;
aParentFrame->FirstChild(nsnull, &childFrame);
aParentFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame != aPriorChildFrame) {
childFrame->GetFrameType(&frameType);
if (aChildType == frameType) {
@ -4270,19 +4280,19 @@ nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
}
void
nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame)
{
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aKidFrame);
if (rgFrame) {
nsIFrame* rowFrame;
rgFrame->FirstChild(nsnull, &rowFrame);
rgFrame->FirstChild(aPresContext, nsnull, &rowFrame);
while (rowFrame) {
nsIAtom* rowType;
rowFrame->GetFrameType(&rowType);
if (nsLayoutAtoms::tableRowFrame == rowType) {
printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame);
nsIFrame* cellFrame;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (cellFrame) {
nsIAtom* cellType;
cellFrame->GetFrameType(&cellType);
@ -4297,7 +4307,7 @@ nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
printf("\n");
}
else {
DumpRowGroup(rowFrame);
DumpRowGroup(aPresContext, rowFrame);
}
NS_IF_RELEASE(rowType);
rowFrame->GetNextSibling(&rowFrame);
@ -4305,9 +4315,10 @@ nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
}
}
void nsTableFrame::Dump(PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap)
void nsTableFrame::Dump(nsIPresContext* aPresContext,
PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap)
{
printf("***START TABLE DUMP*** \n");
// dump the columns widths array
@ -4322,7 +4333,7 @@ void nsTableFrame::Dump(PRBool aDumpRows,
if (aDumpRows) {
nsIFrame* kidFrame = mFrames.FirstChild();
while (kidFrame) {
DumpRowGroup(kidFrame);
DumpRowGroup(aPresContext, kidFrame);
kidFrame->GetNextSibling(&kidFrame);
}
}
@ -4353,11 +4364,12 @@ void nsTableFrame::Dump(PRBool aDumpRows,
}
// nsTableIterator
nsTableIterator::nsTableIterator(nsIFrame& aSource,
nsTableIterator::nsTableIterator(nsIPresContext* aPresContext,
nsIFrame& aSource,
nsTableIteration aType)
{
nsIFrame* firstChild;
aSource.FirstChild(nsnull, &firstChild);
aSource.FirstChild(aPresContext, nsnull, &firstChild);
Init(firstChild, aType);
}

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

@ -150,9 +150,10 @@ public:
// Return the closest sibling of aPriorChildFrame (including aPriroChildFrame)
// of type aChildType.
static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType);
static nsIFrame* GetFrameAtOrBefore(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType);
PRBool IsAutoWidth();
/** @return PR_TRUE if aDisplayType represents a rowgroup of any sort
@ -170,7 +171,9 @@ public:
/** return the first child belonging to the list aListName.
* @see nsIFrame::FirstChild
*/
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
/** @see nsIFrame::GetAdditionalChildListName */
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
@ -702,12 +705,14 @@ public:
*/
virtual nsTableCellMap* GetCellMap() const;
void AdjustRowIndices(PRInt32 aRowIndex,
PRInt32 aAdjustment);
void AdjustRowIndices(nsIPresContext* aPresContext,
PRInt32 aRowIndex,
PRInt32 aAdjustment);
NS_IMETHOD AdjustRowIndices(nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment);
NS_IMETHOD AdjustRowIndices(nsIPresContext* aPresContext,
nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment);
// Return PR_TRUE if rules=groups is set for the table content
PRBool HasGroupRules() const;
@ -744,8 +749,9 @@ protected:
*/
virtual PRInt32 GetSpecifiedColumnCount ();
PRInt32 CollectRows(nsIFrame* aFrame,
nsVoidArray& aCollection);
PRInt32 CollectRows(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsVoidArray& aCollection);
public: /* ----- Cell Map public methods ----- */
@ -817,14 +823,15 @@ public: /* ----- Cell Map public methods ----- */
public:
static nsIAtom* gColGroupAtom;
void Dump(PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap);
void Dump(nsIPresContext* aPresContext,
PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap);
nsVoidArray mColFrames; // XXX temporarily public
protected:
void DumpRowGroup(nsIFrame* aChildFrame);
void DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aChildFrame);
void DebugPrintCount() const; // Debugging routine
// data members
@ -892,7 +899,8 @@ enum nsTableIteration {
class nsTableIterator
{
public:
nsTableIterator(nsIFrame& aSource,
nsTableIterator(nsIPresContext* aPresContext,
nsIFrame& aSource,
nsTableIteration aType);
nsTableIterator(nsFrameList& aSource,
nsTableIteration aType);

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

@ -162,7 +162,7 @@ nsTableRowFrame::InsertFrames(nsIPresContext* aPresContext,
nsTableFrame::GetTableFrame(this, tableFrame);
// gather the new frames (only those which are cells) into an array
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableCellFrame);
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrame, nsLayoutAtoms::tableCellFrame);
nsVoidArray cellChildren;
for (nsIFrame* childFrame = aFrameList; childFrame; childFrame->GetNextSibling(&childFrame)) {
nsIAtom* frameType;
@ -245,7 +245,7 @@ nsTableRowFrame::DidResize(nsIPresContext* aPresContext,
nsTableFrame* tableFrame;
nsTableFrame::GetTableFrame(this, tableFrame);
nsTableIterator iter(*this, eTableDIR);
nsTableIterator iter(aPresContext, *this, eTableDIR);
nsIFrame* cellFrame = iter.First();
while (nsnull != cellFrame) {
@ -320,16 +320,17 @@ void nsTableRowFrame::SetMaxChildHeight(nscoord aChildHeight)
}
static
PRBool IsFirstRow(nsTableFrame& aTable,
PRBool IsFirstRow(nsIPresContext* aPresContext,
nsTableFrame& aTable,
nsTableRowFrame& aRow)
{
nsIFrame* firstRowGroup = nsnull;
aTable.FirstChild(nsnull, &firstRowGroup);
aTable.FirstChild(aPresContext, nsnull, &firstRowGroup);
nsIFrame* rowGroupFrame = nsnull;
nsresult rv = aRow.GetParent(&rowGroupFrame);
if (NS_SUCCEEDED(rv) && (rowGroupFrame == firstRowGroup)) {
nsIFrame* firstRow;
rowGroupFrame->FirstChild(nsnull, &firstRow);
rowGroupFrame->FirstChild(aPresContext, nsnull, &firstRow);
return (&aRow == firstRow);
}
return PR_FALSE;
@ -365,7 +366,7 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext* aPresContext,
nsRect rect(0, 0, mRect.width + cellSpacingX, mRect.height);
// first row may have gotten too much cell spacing Y
if (tableFrame->GetRowCount() != 1) {
if (IsFirstRow(*tableFrame, *this)) {
if (IsFirstRow(aPresContext, *tableFrame, *this)) {
rect.height -= halfCellSpacingY;
}
else {
@ -696,7 +697,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
nsTableIteration dir = (aReflowState.reflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
? eTableLTR : eTableDIR;
nsTableIterator iter(*this, dir);
nsTableIterator iter(aPresContext, *this, dir);
if (iter.IsLeftToRight()) {
prevColIndex = -1;
}
@ -1409,7 +1410,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
* so the default "get the child rect, see if it contains the event point" action isn't
* sufficient. We have to ask the row if it has a child that contains the point.
*/
PRBool nsTableRowFrame::Contains(const nsPoint& aPoint)
PRBool nsTableRowFrame::Contains(nsIPresContext* aPresContext, const nsPoint& aPoint)
{
PRBool result = PR_FALSE;
// first, check the row rect and see if the point is in their
@ -1419,7 +1420,7 @@ PRBool nsTableRowFrame::Contains(const nsPoint& aPoint)
// if that fails, check the cells, they might span outside the row rect
else {
nsIFrame* kid;
FirstChild(nsnull, &kid);
FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
nsRect kidRect;
kid->GetRect(kidRect);

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

@ -172,7 +172,7 @@ public:
/** set this row's starting row index */
void SetRowIndex (int aRowIndex);
virtual PRBool Contains(const nsPoint& aPoint);
virtual PRBool Contains(nsIPresContext* aPresContext, const nsPoint& aPoint);
void GetMaxElementSize(nsSize& aMaxElementSize) const;

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

@ -113,12 +113,13 @@ PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
}
nsresult
nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame)
nsTableRowGroupFrame::InitRepeatedFrame(nsIPresContext* aPresContext,
nsTableRowGroupFrame* aHeaderFooterFrame)
{
nsIFrame* originalRowFrame;
nsIFrame* copyRowFrame = GetFirstFrame();
aHeaderFooterFrame->FirstChild(nsnull, &originalRowFrame);
aHeaderFooterFrame->FirstChild(aPresContext, nsnull, &originalRowFrame);
while (copyRowFrame) {
// Set the row frame index
int rowIndex = ((nsTableRowFrame*)originalRowFrame)->GetRowIndex();
@ -127,8 +128,8 @@ nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame
// For each table cell frame set its column index
nsIFrame* originalCellFrame;
nsIFrame* copyCellFrame;
originalRowFrame->FirstChild(nsnull, &originalCellFrame);
copyRowFrame->FirstChild(nsnull, &copyCellFrame);
originalRowFrame->FirstChild(aPresContext, nsnull, &originalCellFrame);
copyRowFrame->FirstChild(aPresContext, nsnull, &copyCellFrame);
while (copyCellFrame) {
nsIAtom* frameType;
copyCellFrame->GetFrameType(&frameType);
@ -189,7 +190,7 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext* aPresContext,
// every row group is short by the ending cell spacing X
nsRect rect(0, 0, mRect.width, mRect.height);
nsIFrame* firstRowGroup = nsnull;
tableFrame->FirstChild(nsnull, &firstRowGroup);
tableFrame->FirstChild(aPresContext, nsnull, &firstRowGroup);
// first row group may have gotten too much cell spacing Y
if (tableFrame->GetRowCount() != 1) {
if (this == firstRowGroup) {
@ -287,13 +288,13 @@ nsTableRowGroupFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsPoint tmp;
*aFrame = this;
FirstChild(nsnull, &kid);
FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
kid->GetRect(kidRect);
const nsStyleDisplay *childDisplay;
kid->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) {
if (((nsTableRowFrame*)(kid))->Contains(aPoint)) {
if (((nsTableRowFrame*)(kid))->Contains(aPresContext, aPoint)) {
tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
return kid->GetFrameForPoint(aPresContext, tmp, aFrame);
}
@ -647,7 +648,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext,
{
// check this row for a cell with rowspans
nsIFrame *cellFrame;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (nsnull != cellFrame)
{
const nsStyleDisplay *cellChildDisplay;
@ -1236,7 +1237,7 @@ nsTableRowGroupFrame::InsertFrames(nsIPresContext* aPresContext,
nsTableFrame* tableFrame = nsnull;
nsTableFrame::GetTableFrame(this, tableFrame);
if (tableFrame) {
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableRowFrame);
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrame, nsLayoutAtoms::tableRowFrame);
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : 0;
tableFrame->InsertRows(*aPresContext, *this, rows, rowIndex, PR_TRUE);
@ -1344,12 +1345,12 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
return rv;
}
NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult)
NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nsIPresContext* aPresContext, nscoord& aResult)
{
// the rows in rowGroupFrame need to be expanded by rowHeightDelta[i]
// and the rowgroup itself needs to be expanded by SUM(row height deltas)
nsIFrame * rowFrame=nsnull;
nsresult rv = FirstChild(nsnull, &rowFrame);
nsresult rv = FirstChild(aPresContext, nsnull, &rowFrame);
while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame))
{
const nsStyleDisplay *rowDisplay;
@ -1362,7 +1363,7 @@ NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult)
}
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay)
{
((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aResult);
((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aPresContext, aResult);
}
GetNextFrame(rowFrame, &rowFrame);
}

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

@ -180,13 +180,14 @@ public:
* @param aHeaderFooterFrame the original header or footer row group frame
* that was repeated
*/
nsresult InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame);
nsresult InitRepeatedFrame(nsIPresContext* aPresContext,
nsTableRowGroupFrame* aHeaderFooterFrame);
/**
* Get the total height of all the row rects
*/
NS_METHOD GetHeightOfRows(nscoord& aResult);
NS_METHOD GetHeightOfRows(nsIPresContext* aPresContext, nscoord& aResult);
virtual PRBool RowGroupReceivesExcessSpace() { return PR_TRUE; }

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

@ -79,8 +79,9 @@ BasicTableLayoutStrategy::~BasicTableLayoutStrategy()
MOZ_COUNT_DTOR(BasicTableLayoutStrategy);
}
PRBool BasicTableLayoutStrategy::Initialize(nsSize* aMaxElementSize,
nscoord aMaxWidth)
PRBool BasicTableLayoutStrategy::Initialize(nsIPresContext* aPresContext,
nsSize* aMaxElementSize,
nscoord aMaxWidth)
{
ContinuingFrameCheck();
@ -92,7 +93,7 @@ PRBool BasicTableLayoutStrategy::Initialize(nsSize* aMaxElementSize,
mCellSpacingTotal = 0;
mCols = mTableFrame->GetEffectiveCOLSAttribute();
// assign the width of all fixed-width columns
AssignPreliminaryColumnWidths(aMaxWidth);
AssignPreliminaryColumnWidths(aPresContext, aMaxWidth);
// set aMaxElementSize here because we compute mMinTableWidth in AssignPreliminaryColumnWidths
if (nsnull != aMaxElementSize) {
@ -137,13 +138,14 @@ void BasicTableLayoutStrategy::ContinuingFrameCheck()
#endif
}
PRBool BCW_Wrapup(BasicTableLayoutStrategy* aStrategy,
PRBool BCW_Wrapup(nsIPresContext* aPresContext,
BasicTableLayoutStrategy* aStrategy,
nsTableFrame* aTableFrame,
PRInt32* aAllocTypes)
{
if (aAllocTypes)
delete [] aAllocTypes;
if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugBalance) {printf("BalanceColumnWidths ex \n"); aTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
return PR_TRUE;
}
@ -158,11 +160,12 @@ PRBool BCW_Wrapup(BasicTableLayoutStrategy* aStrategy,
// space if the sum of the col allocations is insufficient
PRBool
BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableStyle,
BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidthIn)
{
if (gsDebugBalance) {printf("BalanceColumnWidths en max=%d\n", aMaxWidthIn); mTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugBalance) {printf("BalanceColumnWidths en max=%d\n", aMaxWidthIn); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
ContinuingFrameCheck();
if (!aTableStyle) {
@ -219,13 +222,13 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
// if the max width available is less than the min content width for fixed table, we're done
if (!tableIsAutoWidth && (maxWidth < mMinTableContentWidth)) {
return BCW_Wrapup(this, mTableFrame, nsnull);
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
// if the max width available is less than the min content width for auto table
// that had no % cells/cols, we're done
if (tableIsAutoWidth && (maxWidth < mMinTableContentWidth) && (0 == perAdjTableWidth)) {
return BCW_Wrapup(this, mTableFrame, nsnull);
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
PRInt32 cellSpacingTotal;
@ -260,7 +263,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, PCT, PR_FALSE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// allocate fixed cols
@ -271,7 +274,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, FIX, PR_TRUE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// allocate fixed adjusted cols
@ -282,7 +285,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, FIX_ADJ, PR_TRUE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// allocate proportional cols up to their min proportional value
@ -293,7 +296,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, MIN_PRO, PR_FALSE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
@ -305,13 +308,13 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
else {
AllocateConstrained(maxWidth - totalAllocated, DES_CON, PR_FALSE, allocTypes);
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
}
// if this is a nested non auto table and pass1 reflow, we are done
if ((maxWidth == NS_UNCONSTRAINEDSIZE) && (!tableIsAutoWidth)) {
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
// allocate the rest unconstrained
@ -347,7 +350,7 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty
}
return BCW_Wrapup(this, mTableFrame, allocTypes);
return BCW_Wrapup(aPresContext, this, mTableFrame, allocTypes);
}
@ -691,9 +694,10 @@ BasicTableLayoutStrategy::ComputeColspanWidths(PRInt32 aWidthIndex,
// Determine min, desired, fixed, and proportional sizes for the cols and
// and calculate min/max table width
PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth)
PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aMaxWidth)
{
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n", aMaxWidth); mTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n", aMaxWidth); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
PRBool rv = PR_FALSE;
PRInt32 numRows = mTableFrame->GetRowCount();
PRInt32 numCols = mTableFrame->GetColCount();
@ -912,7 +916,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
}
SetMinAndMaxTableContentWidths();
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(PR_FALSE, PR_TRUE, PR_FALSE);}
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
return rv;
}

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

@ -58,8 +58,9 @@ public:
* in the table (content, structure, or style)
* @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param
*/
virtual PRBool Initialize(nsSize* aMaxElementSize,
nscoord aMaxSize);
virtual PRBool Initialize(nsIPresContext* aPresContext,
nsSize* aMaxElementSize,
nscoord aMaxSize);
/** compute the max element size of the table.
* assumes that Initialize has been called
@ -73,7 +74,8 @@ public:
* @param aReflowState - the reflow state for mTableFrame
* @param aMaxWidth - the computed max width for columns to fit into
*/
virtual PRBool BalanceColumnWidths(nsIStyleContext* aTableStyle,
virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth);
@ -97,7 +99,8 @@ protected:
* @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error
*
*/
virtual PRBool AssignPreliminaryColumnWidths(nscoord aComputedWidth);
virtual PRBool AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aComputedWidth);
/**
* Calculate the adjusted widths (min, desired, fixed, or pct) for a cell

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

@ -40,7 +40,8 @@ FixedTableLayoutStrategy::~FixedTableLayoutStrategy()
{
}
PRBool FixedTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableStyle,
PRBool FixedTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth)
{
@ -55,7 +56,8 @@ PRBool FixedTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aT
* otherwise the cell get a proportion of the remaining space
* as determined by the table width attribute. If no table width attribute, it gets 0 width
*/
PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aComputedWidth)
PRBool FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aComputedWidth)
{
// NS_ASSERTION(aComputedWidth != NS_UNCONSTRAINEDSIZE, "bad computed width");
const nsStylePosition* tablePosition;

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

@ -58,7 +58,8 @@ public:
* @param aReflowState - the reflow state for mTableFrame
* @param aMaxWidth - the computed max width for columns to fit into
*/
virtual PRBool BalanceColumnWidths(nsIStyleContext* aTableStyle,
virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth);
@ -95,7 +96,8 @@ protected:
* @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error
*
*/
virtual PRBool AssignPreliminaryColumnWidths(nscoord aComputedWidth);
virtual PRBool AssignPreliminaryColumnWidths(nsIPresContext* aPresContext,
nscoord aComputedWidth);
};

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

@ -46,13 +46,13 @@ MOZ_DECL_CTOR_COUNTER(nsCellMap);
// nsTableCellMap
nsTableCellMap::nsTableCellMap(nsTableFrame& aTableFrame)
nsTableCellMap::nsTableCellMap(nsIPresContext* aPresContext, nsTableFrame& aTableFrame)
{
MOZ_COUNT_CTOR(nsTableCellMap);
mFirstMap = nsnull;
nsTableRowGroupFrame* prior = nsnull;
nsIFrame* child;
aTableFrame.FirstChild(nsnull, &child);
aTableFrame.FirstChild(aPresContext, nsnull, &child);
while(child) {
nsTableRowGroupFrame* groupFrame = aTableFrame.GetRowGroupFrame(child);
if (groupFrame) {
@ -250,7 +250,8 @@ nsTableCellMap::AddColsAtEnd(PRUint32 aNumCols)
}
void
nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
nsTableCellMap::InsertRows(nsIPresContext* aPresContext,
nsTableRowGroupFrame& aParent,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans)
@ -260,7 +261,7 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
nsCellMap* cellMap = mFirstMap;
while (cellMap) {
if (cellMap->GetRowGroup() == &aParent) {
cellMap->InsertRows(*this, aRows, rowIndex, aConsiderSpans);
cellMap->InsertRows(aPresContext, *this, aRows, rowIndex, aConsiderSpans);
return;
}
rowIndex -= cellMap->GetRowCount();
@ -273,15 +274,16 @@ nsTableCellMap::InsertRows(nsTableRowGroupFrame& aParent,
}
void
nsTableCellMap::RemoveRows(PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans)
nsTableCellMap::RemoveRows(nsIPresContext* aPresContext,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans)
{
PRInt32 rowIndex = aFirstRowIndex;
nsCellMap* cellMap = mFirstMap;
while (cellMap) {
if (cellMap->GetRowCount() > rowIndex) {
cellMap->RemoveRows(*this, rowIndex, aNumRowsToRemove, aConsiderSpans);
cellMap->RemoveRows(aPresContext, *this, rowIndex, aNumRowsToRemove, aConsiderSpans);
break;
}
rowIndex -= cellMap->GetRowCount();
@ -614,7 +616,8 @@ void nsCellMap::GrowRow(nsVoidArray& aRow,
}
void
nsCellMap::InsertRows(nsTableCellMap& aMap,
nsCellMap::InsertRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans)
@ -627,7 +630,7 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
}
if (!aConsiderSpans) {
ExpandWithRows(aMap, aRows, aFirstRowIndex);
ExpandWithRows(aPresContext, aMap, aRows, aFirstRowIndex);
return;
}
@ -638,19 +641,20 @@ nsCellMap::InsertRows(nsTableCellMap& aMap,
// if any of the new cells span out of the new rows being added, then rebuild
// XXX it would be better to only rebuild the portion of the map that follows the new rows
if (!spansCauseRebuild && (aFirstRowIndex < mRows.Count())) {
spansCauseRebuild = CellsSpanOut(aRows);
spansCauseRebuild = CellsSpanOut(aPresContext, aRows);
}
if (spansCauseRebuild) {
RebuildConsideringRows(aMap, aFirstRowIndex, &aRows);
RebuildConsideringRows(aPresContext, aMap, aFirstRowIndex, &aRows);
}
else {
ExpandWithRows(aMap, aRows, aFirstRowIndex);
ExpandWithRows(aPresContext, aMap, aRows, aFirstRowIndex);
}
}
void
nsCellMap::RemoveRows(nsTableCellMap& aMap,
nsCellMap::RemoveRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans)
@ -674,7 +678,7 @@ nsCellMap::RemoveRows(nsTableCellMap& aMap,
0, numCols - 1, numCols);
if (spansCauseRebuild) {
RebuildConsideringRows(aMap, aFirstRowIndex, nsnull, aNumRowsToRemove);
RebuildConsideringRows(aPresContext, aMap, aFirstRowIndex, nsnull, aNumRowsToRemove);
}
else {
ShrinkWithoutRows(aMap, aFirstRowIndex, aNumRowsToRemove);
@ -800,13 +804,13 @@ nsCellMap::AppendCell(nsTableCellMap& aMap,
return startColIndex;
}
PRBool nsCellMap::CellsSpanOut(nsVoidArray& aRows)
PRBool nsCellMap::CellsSpanOut(nsIPresContext* aPresContext, nsVoidArray& aRows)
{
PRInt32 numNewRows = aRows.Count();
for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) {
nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX);
nsIFrame* cellFrame = nsnull;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (cellFrame) {
nsIAtom* frameType;
cellFrame->GetFrameType(&frameType);
@ -921,7 +925,8 @@ void nsCellMap::InsertCells(nsTableCellMap& aMap,
}
void
nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
nsCellMap::ExpandWithRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRowFrames,
PRInt32 aStartRowIndex)
{
@ -940,7 +945,7 @@ nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowFrames.ElementAt(newRowIndex);
// append cells
nsIFrame* cFrame = nsnull;
rFrame->FirstChild(nsnull, &cFrame);
rFrame->FirstChild(aPresContext, nsnull, &cFrame);
while (cFrame) {
nsIAtom* cFrameType;
cFrame->GetFrameType(&cFrameType);
@ -1295,7 +1300,8 @@ nsCellMap::RemoveCol(PRInt32 aColIndex)
}
void
nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
nsCellMap::RebuildConsideringRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aStartRowIndex,
nsVoidArray* aRowsToInsert,
PRBool aNumRowsToRemove)
@ -1341,7 +1347,7 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
for (PRInt32 newRowX = 0; newRowX < numNewRows; newRowX++) {
nsTableRowFrame* rFrame = (nsTableRowFrame *)aRowsToInsert->ElementAt(newRowX);
nsIFrame* cFrame = nsnull;
rFrame->FirstChild(nsnull, &cFrame);
rFrame->FirstChild(aPresContext, nsnull, &cFrame);
while (cFrame) {
nsIAtom* cFrameType;
cFrame->GetFrameType(&cFrameType);

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

@ -45,7 +45,7 @@ struct nsColInfo
class nsTableCellMap
{
public:
nsTableCellMap(nsTableFrame& aTableFrame);
nsTableCellMap(nsIPresContext* aPresContext, nsTableFrame& aTableFrame);
/** destructor
* NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
@ -82,14 +82,16 @@ public:
void RemoveCell(nsTableCellFrame* aCellFrame,
PRInt32 aRowIndex);
void InsertRows(nsTableRowGroupFrame& aRowGroup,
void InsertRows(nsIPresContext* aPresContext,
nsTableRowGroupFrame& aRowGroup,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans);
void RemoveRows(PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans);
void RemoveRows(nsIPresContext* aPresContext,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans);
PRInt32 GetEffectiveColSpan(PRInt32 aColIndex,
const nsTableCellFrame& aCell);
@ -203,12 +205,14 @@ public:
void RemoveCol(PRInt32 aColIndex);
void InsertRows(nsTableCellMap& aMap,
void InsertRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRows,
PRInt32 aFirstRowIndex,
PRBool aConsiderSpans);
void RemoveRows(nsTableCellMap& aMap,
void RemoveRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aFirstRowIndex,
PRInt32 aNumRowsToRemove,
PRBool aConsiderSpans);
@ -279,7 +283,8 @@ protected:
PRInt32 GetNumCellsIn(PRInt32 aColIndex) const;
void ExpandWithRows(nsTableCellMap& aMap,
void ExpandWithRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
nsVoidArray& aRowFrames,
PRInt32 aStartRowIndex);
@ -299,7 +304,8 @@ protected:
PRInt32 aRowIndex,
PRInt32 aColIndex);
void RebuildConsideringRows(nsTableCellMap& aMap,
void RebuildConsideringRows(nsIPresContext* aPresContext,
nsTableCellMap& aMap,
PRInt32 aStartRowIndex,
nsVoidArray* aRowsToInsert,
PRInt32 aNumRowsToRemove = 0);
@ -310,7 +316,7 @@ protected:
PRInt32 aColIndex,
PRBool aInsert);
PRBool CellsSpanOut(nsVoidArray& aNewRows);
PRBool CellsSpanOut(nsIPresContext* aPresContext, nsVoidArray& aNewRows);
PRBool CellsSpanInOrOut(PRInt32 aStartRowIndex,
PRInt32 aEndRowIndex,

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

@ -26,6 +26,7 @@
#include "nscore.h"
#include "nsSize.h"
class nsIPresContext;
class nsIStyleContext;
struct nsHTMLReflowState;
class nsTableCellFrame;
@ -40,8 +41,9 @@ public:
* @param aMaxElementSize [OUT] if not null, the max element size is computed and returned in this param
* @param aComputedWidth the computed size of the table
*/
virtual PRBool Initialize(nsSize* aMaxElementSize,
nscoord aComputedWidth)=0;
virtual PRBool Initialize(nsIPresContext* aPresContext,
nsSize* aMaxElementSize,
nscoord aComputedWidth)=0;
/** compute the max-element-size for the table
* @param aMaxElementSize [OUT] width field set to the min legal width of the table
@ -55,7 +57,8 @@ public:
* @param aMaxWidth the width constraint
*/
virtual PRBool BalanceColumnWidths(nsIStyleContext* aTableStyle,
virtual PRBool BalanceColumnWidths(nsIPresContext* aPresContext,
nsIStyleContext* aTableStyle,
const nsHTMLReflowState& aReflowState,
nscoord aMaxWidth)=0;

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

@ -62,9 +62,10 @@ void nsTableColGroupFrame::SetType(nsTableColGroupType aType) {
mBits.mType = aType - eColGroupContent;
}
void nsTableColGroupFrame::ResetColIndices(nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame)
void nsTableColGroupFrame::ResetColIndices(nsIPresContext* aPresContext,
nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame)
{
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame*)aFirstColGroup;
PRInt32 colIndex = aFirstColIndex;
@ -75,7 +76,7 @@ void nsTableColGroupFrame::ResetColIndices(nsIFrame* aFirstColGroup,
colGroupFrame->SetStartColumnIndex(colIndex);
nsIFrame* colFrame = aStartColFrame;
if (!colFrame || (colIndex != aFirstColIndex)) {
colGroupFrame->FirstChild(nsnull, &colFrame);
colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame);
}
while (colFrame) {
nsIAtom* colType;
@ -134,7 +135,7 @@ nsTableColGroupFrame::AddColsToTable(nsIPresContext& aPresContext,
nsIFrame* nextSibling;
GetNextSibling(&nextSibling);
if (nextSibling) {
ResetColIndices(nextSibling, colIndex);
ResetColIndices(&aPresContext, nextSibling, colIndex);
}
}
@ -319,7 +320,7 @@ nsTableColGroupFrame::InsertFrames(nsIPresContext* aPresContext,
nsIFrame* lastFrame = frames.LastChild();
mFrames.InsertFrames(this, aPrevFrameIn, aFrameList);
nsIFrame* prevFrame = nsTableFrame::GetFrameAtOrBefore(this, aPrevFrameIn,
nsIFrame* prevFrame = nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrameIn,
nsLayoutAtoms::tableColFrame);
PRInt32 colIndex = (prevFrame) ? ((nsTableColFrame*)prevFrame)->GetColIndex() + 1 : 0;
@ -359,7 +360,7 @@ nsTableColGroupFrame::RemoveChild(nsIPresContext& aPresContext,
if (mFrames.DestroyFrame(&aPresContext, (nsIFrame*)&aChild)) {
mColCount--;
if (aResetColIndices) {
ResetColIndices(this, colIndex, nextChild);
ResetColIndices(&aPresContext, this, colIndex, nextChild);
}
}
}
@ -703,7 +704,8 @@ PRInt32 nsTableColGroupFrame::SetStartColumnIndex (int aIndex)
// this could be optimized by using col group frame starting indicies,
// but typically there aren't enough very large col groups for the added complexity.
nsTableColGroupFrame*
nsTableColGroupFrame::GetColGroupFrameContaining(nsFrameList& aColGroupList,
nsTableColGroupFrame::GetColGroupFrameContaining(nsIPresContext* aPresContext,
nsFrameList& aColGroupList,
nsTableColFrame& aColFrame)
{
nsIFrame* childFrame = aColGroupList.FirstChild();
@ -712,7 +714,7 @@ nsTableColGroupFrame::GetColGroupFrameContaining(nsFrameList& aColGroupList,
childFrame->GetFrameType(&frameType);
if (nsLayoutAtoms::tableColGroupFrame == frameType) {
nsTableColFrame* colFrame = nsnull;
childFrame->FirstChild(nsnull, (nsIFrame **)&colFrame);
childFrame->FirstChild(aPresContext, nsnull, (nsIFrame **)&colFrame);
while (colFrame) {
if (colFrame == &aColFrame) {
NS_RELEASE(frameType);

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

@ -154,13 +154,15 @@ public:
void DeleteColFrame(nsIPresContext* aPresContext, nsTableColFrame* aColFrame);
static nsTableColGroupFrame* GetColGroupFrameContaining(nsFrameList& aColGroupList,
static nsTableColGroupFrame* GetColGroupFrameContaining(nsIPresContext* aPresContext,
nsFrameList& aColGroupList,
nsTableColFrame& aColFrame);
nsFrameList& GetChildList();
static void ResetColIndices(nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame = nsnull);
static void ResetColIndices(nsIPresContext* aPresContext,
nsIFrame* aFirstColGroup,
PRInt32 aFirstColIndex,
nsIFrame* aStartColFrame = nsnull);
protected:
nsTableColGroupFrame();

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

@ -168,7 +168,6 @@ nsTableFrame::nsTableFrame()
mColumnWidths = new PRInt32[mColumnWidthsLength];
nsCRT::memset (mColumnWidths, 0, mColumnWidthsLength*sizeof(PRInt32));
#endif
mCellMap = new nsTableCellMap(*this);
}
NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame)
@ -197,6 +196,10 @@ nsTableFrame::Init(nsIPresContext* aPresContext,
{
nsresult rv;
// Create the cell map
// XXX Why do we do this for continuing frames?
mCellMap = new nsTableCellMap(aPresContext, *this);
// Let the base class do its processing
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext,
aPrevInFlow);
@ -614,8 +617,9 @@ void nsTableFrame::ProcessGroupRules(nsIPresContext* aPresContext)
}
void nsTableFrame::AdjustRowIndices(PRInt32 aRowIndex,
PRInt32 aAdjustment)
void nsTableFrame::AdjustRowIndices(nsIPresContext* aPresContext,
PRInt32 aRowIndex,
PRInt32 aAdjustment)
{
// Iterate over the row groups and adjust the row indices of all rows
// whose index is >= aRowIndex.
@ -624,18 +628,19 @@ void nsTableFrame::AdjustRowIndices(PRInt32 aRowIndex,
const nsStyleDisplay *rowGroupDisplay;
rowGroupFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)rowGroupDisplay);
if (IsRowGroup(rowGroupDisplay->mDisplay)) {
AdjustRowIndices(rowGroupFrame, aRowIndex, aAdjustment);
AdjustRowIndices(aPresContext, rowGroupFrame, aRowIndex, aAdjustment);
}
}
}
NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment)
NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIPresContext* aPresContext,
nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment)
{
nsresult rv = NS_OK;
nsIFrame *rowFrame;
aRowGroup->FirstChild(nsnull, &rowFrame);
aRowGroup->FirstChild(aPresContext, nsnull, &rowFrame);
for ( ; nsnull!=rowFrame; rowFrame->GetNextSibling(&rowFrame))
{
const nsStyleDisplay *rowDisplay;
@ -648,7 +653,7 @@ NS_IMETHODIMP nsTableFrame::AdjustRowIndices(nsIFrame* aRowGroup,
}
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP==rowDisplay->mDisplay)
{
AdjustRowIndices(rowFrame, aRowIndex, anAdjustment);
AdjustRowIndices(aPresContext, rowFrame, aRowIndex, anAdjustment);
}
}
return rv;
@ -676,7 +681,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext,
nsTableColGroupFrame* cgFrame = (nsTableColGroupFrame*)kidFrame;
cgFrame->SetStartColumnIndex(colIndex);
nsIFrame* firstCol;
kidFrame->FirstChild(nsnull, &firstCol);
kidFrame->FirstChild(&aPresContext, nsnull, &firstCol);
cgFrame->AddColsToTable(aPresContext, colIndex, PR_FALSE, firstCol);
PRInt32 numCols = cgFrame->GetColCount();
colIndex += numCols;
@ -690,7 +695,7 @@ void nsTableFrame::InsertColGroups(nsIPresContext& aPresContext,
}
if (firstColGroupToReset) {
nsTableColGroupFrame::ResetColIndices(firstColGroupToReset, aStartColIndex);
nsTableColGroupFrame::ResetColIndices(&aPresContext, firstColGroupToReset, aStartColIndex);
}
}
@ -867,7 +872,7 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
nsIFrame* childFrame;
// Get the last col frame
aColGroupFrame.FirstChild(nsnull, &childFrame);
aColGroupFrame.FirstChild(&aPresContext, nsnull, &childFrame);
while (childFrame) {
nsIAtom* frameType = nsnull;
childFrame->GetFrameType(&frameType);
@ -925,7 +930,8 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
PRInt32 startColIndex = aColGroupFrame.GetStartColumnIndex();
if (aPrevFrameIn) {
nsTableColFrame* colFrame =
(nsTableColFrame*)nsTableFrame::GetFrameAtOrBefore((nsIFrame*)&aColGroupFrame, aPrevFrameIn,
(nsTableColFrame*)nsTableFrame::GetFrameAtOrBefore(&aPresContext,
(nsIFrame*)&aColGroupFrame, aPrevFrameIn,
nsLayoutAtoms::tableColFrame);
if (colFrame) {
startColIndex = colFrame->GetColIndex();
@ -1057,7 +1063,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext,
if (cellMap) {
PRInt32 origNumRows = cellMap->GetRowCount();
PRInt32 numNewRows = aRowFrames.Count();
cellMap->InsertRows(aRowGroupFrame, aRowFrames, aRowIndex, aConsiderSpans);
cellMap->InsertRows(&aPresContext, aRowGroupFrame, aRowFrames, aRowIndex, aConsiderSpans);
PRInt32 numColsInMap = GetColCount(); // cell map's notion of num cols
PRInt32 numColsInCache = mColFrames.Count();
numColsToAdd = numColsInMap - numColsInCache;
@ -1067,7 +1073,7 @@ nsTableFrame::InsertRows(nsIPresContext& aPresContext,
PR_TRUE);
}
if (aRowIndex < origNumRows) {
AdjustRowIndices(aRowIndex, numNewRows);
AdjustRowIndices(&aPresContext, aRowIndex, numNewRows);
}
// assign the correct row indices to the new rows. If they were adjusted above
// it may not have been done correctly because each row is constructed with index 0
@ -1094,7 +1100,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext,
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
cellMap->RemoveRows(aFirstRowIndex, aNumRowsToRemove, aConsiderSpans);
cellMap->RemoveRows(&aPresContext, aFirstRowIndex, aNumRowsToRemove, aConsiderSpans);
// only remove cols that are of type eTypeAnonymous cell (they are at the end)
PRInt32 numColsInMap = GetColCount(); // cell map's notion of num cols
PRInt32 numColsInCache = mColFrames.Count();
@ -1104,7 +1110,7 @@ void nsTableFrame::RemoveRows(nsIPresContext& aPresContext,
cellMap->AddColsAtEnd(numColsNotRemoved);
}
}
AdjustRowIndices(aFirstRowIndex, -aNumRowsToRemove);
AdjustRowIndices(&aPresContext, aFirstRowIndex, -aNumRowsToRemove);
//printf("removeRowsAfter\n");
//Dump(PR_TRUE, PR_FALSE, PR_TRUE);
}
@ -1155,15 +1161,16 @@ nsTableFrame::GetRowGroupFrame(nsIFrame* aFrame,
// collect the rows ancestors of aFrame
PRInt32
nsTableFrame::CollectRows(nsIFrame* aFrame,
nsVoidArray& aCollection)
nsTableFrame::CollectRows(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsVoidArray& aCollection)
{
if (!aFrame) return 0;
PRInt32 numRows = 0;
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aFrame);
if (rgFrame) {
nsIFrame* childFrame = nsnull;
rgFrame->FirstChild(nsnull, &childFrame);
rgFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame) {
nsIAtom* childType;
childFrame->GetFrameType(&childType);
@ -1172,7 +1179,7 @@ nsTableFrame::CollectRows(nsIFrame* aFrame,
numRows++;
}
else {
numRows += CollectRows(childFrame, aCollection);
numRows += CollectRows(aPresContext, childFrame, aCollection);
}
NS_IF_RELEASE(childType);
childFrame->GetNextSibling(&childFrame);
@ -1196,7 +1203,7 @@ nsTableFrame::InsertRowGroups(nsIPresContext& aPresContext,
// create and add the cell map for the row group
cellMap->InsertGroupCellMap(rowIndex, *rgFrame);
// collect the new row frames in an array and add them to the table
PRInt32 numRows = CollectRows(kidFrame, rows);
PRInt32 numRows = CollectRows(&aPresContext, kidFrame, rows);
if (numRows > 0) {
InsertRows(aPresContext, *rgFrame, rows, rowIndex, PR_TRUE);
rowIndex += numRows;
@ -1254,18 +1261,17 @@ void nsTableFrame::ListColumnLayoutData(FILE* out, PRInt32 aIndent)
// Child frame enumeration
NS_IMETHODIMP
nsTableFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const
nsTableFrame::FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const
{
if (nsnull == aListName) {
*aFirstChild = mFrames.FirstChild();
return NS_OK;
}
else if (aListName == nsLayoutAtoms::colGroupList) {
NS_PRECONDITION(nsnull != aFirstChild, "null OUT parameter pointer");
if (aListName == nsLayoutAtoms::colGroupList) {
*aFirstChild = mColGroups.FirstChild();
return NS_OK;
}
*aFirstChild = nsnull;
return NS_ERROR_INVALID_ARG;
return nsHTMLContainerFrame::FirstChild(aPresContext, aListName, aFirstChild);
}
NS_IMETHODIMP
@ -1528,7 +1534,7 @@ void nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext, nscoord aHe
while (nsnull != colGroupFrame) {
nscoord colGroupWidth = 0;
nsIFrame* colFrame = nsnull;
colGroupFrame->FirstChild(nsnull, &colFrame);
colGroupFrame->FirstChild(aPresContext, nsnull, &colFrame);
nsPoint colOrigin(0, 0);
while (nsnull != colFrame) {
const nsStyleDisplay* colDisplay;
@ -1616,7 +1622,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
if (mTableLayoutStrategy && (needsRecalc || !IsColumnWidthsValid())) {
nscoord boxWidth = CalcBorderBoxWidth(aReflowState);
mTableLayoutStrategy->Initialize(aDesiredSize.maxElementSize, boxWidth);
mTableLayoutStrategy->Initialize(aPresContext, aDesiredSize.maxElementSize, boxWidth);
mBits.mColumnWidthsValid = PR_TRUE; //so we don't do this a second time below
}
@ -1681,7 +1687,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if (isAutoWidth && !IsMaximumWidthValid()) {
// Initialize the strategy and have it compute the natural size of
// the table
mTableLayoutStrategy->Initialize(nsnull, NS_UNCONSTRAINEDSIZE);
mTableLayoutStrategy->Initialize(aPresContext, nsnull, NS_UNCONSTRAINEDSIZE);
// Now the maximum width is valid
mBits.mMaximumWidthValid = PR_TRUE;
@ -2043,7 +2049,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible);
nsIFrame* rowFrame;
aRowGroupFrame->FirstChild(nsnull, &rowFrame);
aRowGroupFrame->FirstChild(aPresContext, nsnull, &rowFrame);
while (nsnull != rowFrame) {
const nsStyleDisplay* rowDisplay;
@ -2059,7 +2065,7 @@ nsTableFrame::CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
rowRect.height = 0;
rowFrame->SetRect(aPresContext, rowRect);
nsIFrame* cellFrame;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (nsnull != cellFrame) {
const nsStyleDisplay* cellDisplay;
cellFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)cellDisplay));
@ -2158,7 +2164,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
const nsStyleDisplay* groupDisplay;
groupFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)groupDisplay));
PRBool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupDisplay->mVisible);
nsTableIterator colIter(*groupFrame, eTableDIR);
nsTableIterator colIter(aPresContext, *groupFrame, eTableDIR);
nsIFrame* colFrame = colIter.First();
// iterate over the cols in the col group
while (nsnull != colFrame) {
@ -2286,7 +2292,8 @@ nsTableFrame::AppendFrames(nsIPresContext* aPresContext,
firstAppendedColGroup = f;
nsIFrame* lastChild = mFrames.LastChild();
nsTableColGroupFrame* lastColGroup =
(nsTableColGroupFrame*)GetFrameAtOrBefore(this, lastChild, nsLayoutAtoms::tableColGroupFrame);
(nsTableColGroupFrame*)GetFrameAtOrBefore(aPresContext, this, lastChild,
nsLayoutAtoms::tableColGroupFrame);
startColIndex = (lastColGroup)
? lastColGroup->GetStartColumnIndex() + lastColGroup->GetColCount() : 0;
}
@ -2361,7 +2368,8 @@ nsTableFrame::InsertFrames(nsIPresContext* aPresContext,
PRInt32 startColIndex = 0;
if (aPrevFrame) {
nsTableColGroupFrame* prevColGroup =
(nsTableColGroupFrame*)GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableColGroupFrame);
(nsTableColGroupFrame*)GetFrameAtOrBefore(aPresContext, this, aPrevFrame,
nsLayoutAtoms::tableColGroupFrame);
if (prevColGroup) {
startColIndex = prevColGroup->GetStartColumnIndex() + prevColGroup->GetColCount();
}
@ -2370,7 +2378,7 @@ nsTableFrame::InsertFrames(nsIPresContext* aPresContext,
} else if (IsRowGroup(display->mDisplay)) {
// get the starting row index of the new rows and insert them into the table
PRInt32 rowIndex = 0;
nsTableRowGroupFrame* prevRowGroup = (nsTableRowGroupFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableRowGroupFrame);
nsTableRowGroupFrame* prevRowGroup = (nsTableRowGroupFrame *)nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrame, nsLayoutAtoms::tableRowGroupFrame);
if (prevRowGroup) {
PRInt32 numRows;
prevRowGroup->GetRowCount(numRows);
@ -2427,7 +2435,7 @@ nsTableFrame::RemoveFrame(nsIPresContext* aPresContext,
// remove the col frames, the colGroup frame and reset col indices
colGroup->RemoveChildrenAtEnd(*aPresContext, colGroup->GetColCount());
mColGroups.DestroyFrame(aPresContext, aOldFrame);
nsTableColGroupFrame::ResetColIndices(nextColGroupFrame, firstColIndex);
nsTableColGroupFrame::ResetColIndices(aPresContext, nextColGroupFrame, firstColIndex);
// remove the cols from the table
PRInt32 colX;
for (colX = lastColIndex; colX >= firstColIndex; colX--) {
@ -2471,7 +2479,7 @@ nsTableFrame::RemoveFrame(nsIPresContext* aPresContext,
if (numColsNotRemoved > 0) {
cellMap->AddColsAtEnd(numColsNotRemoved);
}
AdjustRowIndices(startRowIndex, -numRows);
AdjustRowIndices(aPresContext, startRowIndex, -numRows);
// remove the row group frame from the sibling chain
mFrames.DestroyFrame(aPresContext, aOldFrame);
@ -2531,15 +2539,16 @@ NS_METHOD nsTableFrame::IncrementalReflow(nsIPresContext* aPresContext,
}
// this assumes the dirty children are contiguous
PRBool GetDirtyChildren(nsIFrame* aFrame,
nsIFrame** aFirstDirty,
PRInt32& aNumDirty)
PRBool GetDirtyChildren(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsIFrame** aFirstDirty,
PRInt32& aNumDirty)
{
*aFirstDirty = nsnull;
aNumDirty = 0;
nsIFrame* kidFrame;
aFrame->FirstChild(nsnull, &kidFrame);
aFrame->FirstChild(aPresContext, nsnull, &kidFrame);
while (kidFrame) {
nsFrameState frameState;
kidFrame->GetFrameState(&frameState);
@ -3248,16 +3257,16 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
mTableLayoutStrategy = new FixedTableLayoutStrategy(this);
else
mTableLayoutStrategy = new BasicTableLayoutStrategy(this, eCompatibility_NavQuirks == mode);
mTableLayoutStrategy->Initialize(aMaxElementSize, boxWidth);
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth);
mBits.mColumnWidthsValid=PR_TRUE;
}
// fixed-layout tables need to reinitialize the layout strategy. When there are scroll bars
// reflow gets called twice and the 2nd time has the correct space available.
else if (!RequiresPass1Layout()) {
mTableLayoutStrategy->Initialize(aMaxElementSize, boxWidth);
mTableLayoutStrategy->Initialize(aPresContext, aMaxElementSize, boxWidth);
}
mTableLayoutStrategy->BalanceColumnWidths(mStyleContext, aReflowState, maxWidth);
mTableLayoutStrategy->BalanceColumnWidths(aPresContext, mStyleContext, aReflowState, maxWidth);
//Dump(PR_TRUE, PR_TRUE);
mBits.mColumnWidthsSet=PR_TRUE;
@ -3526,7 +3535,7 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext* aPresContext
childFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
if (IsRowGroup(childDisplay->mDisplay)) {
if (((nsTableRowGroupFrame*)childFrame)->RowGroupReceivesExcessSpace()) {
((nsTableRowGroupFrame*)childFrame)->GetHeightOfRows(sumOfRowHeights);
((nsTableRowGroupFrame*)childFrame)->GetHeightOfRows(aPresContext, sumOfRowHeights);
}
if (!firstRowGroupFrame) {
// the first row group's y position starts inside our padding
@ -4237,9 +4246,10 @@ nsTableFrame::IsFinalPass(const nsHTMLReflowState& aState)
// Find the closet sibling before aPriorChildFrame (including aPriorChildFrame) that
// is of type aChildType
nsIFrame*
nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType)
nsTableFrame::GetFrameAtOrBefore(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType)
{
nsIFrame* result = nsnull;
if (!aPriorChildFrame) {
@ -4257,7 +4267,7 @@ nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
// the beginnng and find the closest one
nsIFrame* childFrame;
nsIFrame* lastMatchingFrame = nsnull;
aParentFrame->FirstChild(nsnull, &childFrame);
aParentFrame->FirstChild(aPresContext, nsnull, &childFrame);
while (childFrame != aPriorChildFrame) {
childFrame->GetFrameType(&frameType);
if (aChildType == frameType) {
@ -4270,19 +4280,19 @@ nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
}
void
nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
nsTableFrame::DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aKidFrame)
{
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aKidFrame);
if (rgFrame) {
nsIFrame* rowFrame;
rgFrame->FirstChild(nsnull, &rowFrame);
rgFrame->FirstChild(aPresContext, nsnull, &rowFrame);
while (rowFrame) {
nsIAtom* rowType;
rowFrame->GetFrameType(&rowType);
if (nsLayoutAtoms::tableRowFrame == rowType) {
printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame);
nsIFrame* cellFrame;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (cellFrame) {
nsIAtom* cellType;
cellFrame->GetFrameType(&cellType);
@ -4297,7 +4307,7 @@ nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
printf("\n");
}
else {
DumpRowGroup(rowFrame);
DumpRowGroup(aPresContext, rowFrame);
}
NS_IF_RELEASE(rowType);
rowFrame->GetNextSibling(&rowFrame);
@ -4305,9 +4315,10 @@ nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
}
}
void nsTableFrame::Dump(PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap)
void nsTableFrame::Dump(nsIPresContext* aPresContext,
PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap)
{
printf("***START TABLE DUMP*** \n");
// dump the columns widths array
@ -4322,7 +4333,7 @@ void nsTableFrame::Dump(PRBool aDumpRows,
if (aDumpRows) {
nsIFrame* kidFrame = mFrames.FirstChild();
while (kidFrame) {
DumpRowGroup(kidFrame);
DumpRowGroup(aPresContext, kidFrame);
kidFrame->GetNextSibling(&kidFrame);
}
}
@ -4353,11 +4364,12 @@ void nsTableFrame::Dump(PRBool aDumpRows,
}
// nsTableIterator
nsTableIterator::nsTableIterator(nsIFrame& aSource,
nsTableIterator::nsTableIterator(nsIPresContext* aPresContext,
nsIFrame& aSource,
nsTableIteration aType)
{
nsIFrame* firstChild;
aSource.FirstChild(nsnull, &firstChild);
aSource.FirstChild(aPresContext, nsnull, &firstChild);
Init(firstChild, aType);
}

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

@ -150,9 +150,10 @@ public:
// Return the closest sibling of aPriorChildFrame (including aPriroChildFrame)
// of type aChildType.
static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType);
static nsIFrame* GetFrameAtOrBefore(nsIPresContext* aPresContext,
nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType);
PRBool IsAutoWidth();
/** @return PR_TRUE if aDisplayType represents a rowgroup of any sort
@ -170,7 +171,9 @@ public:
/** return the first child belonging to the list aListName.
* @see nsIFrame::FirstChild
*/
NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const;
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame** aFirstChild) const;
/** @see nsIFrame::GetAdditionalChildListName */
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
@ -702,12 +705,14 @@ public:
*/
virtual nsTableCellMap* GetCellMap() const;
void AdjustRowIndices(PRInt32 aRowIndex,
PRInt32 aAdjustment);
void AdjustRowIndices(nsIPresContext* aPresContext,
PRInt32 aRowIndex,
PRInt32 aAdjustment);
NS_IMETHOD AdjustRowIndices(nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment);
NS_IMETHOD AdjustRowIndices(nsIPresContext* aPresContext,
nsIFrame* aRowGroup,
PRInt32 aRowIndex,
PRInt32 anAdjustment);
// Return PR_TRUE if rules=groups is set for the table content
PRBool HasGroupRules() const;
@ -744,8 +749,9 @@ protected:
*/
virtual PRInt32 GetSpecifiedColumnCount ();
PRInt32 CollectRows(nsIFrame* aFrame,
nsVoidArray& aCollection);
PRInt32 CollectRows(nsIPresContext* aPresContext,
nsIFrame* aFrame,
nsVoidArray& aCollection);
public: /* ----- Cell Map public methods ----- */
@ -817,14 +823,15 @@ public: /* ----- Cell Map public methods ----- */
public:
static nsIAtom* gColGroupAtom;
void Dump(PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap);
void Dump(nsIPresContext* aPresContext,
PRBool aDumpRows,
PRBool aDumpCols,
PRBool aDumpCellMap);
nsVoidArray mColFrames; // XXX temporarily public
protected:
void DumpRowGroup(nsIFrame* aChildFrame);
void DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aChildFrame);
void DebugPrintCount() const; // Debugging routine
// data members
@ -892,7 +899,8 @@ enum nsTableIteration {
class nsTableIterator
{
public:
nsTableIterator(nsIFrame& aSource,
nsTableIterator(nsIPresContext* aPresContext,
nsIFrame& aSource,
nsTableIteration aType);
nsTableIterator(nsFrameList& aSource,
nsTableIteration aType);

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

@ -162,7 +162,7 @@ nsTableRowFrame::InsertFrames(nsIPresContext* aPresContext,
nsTableFrame::GetTableFrame(this, tableFrame);
// gather the new frames (only those which are cells) into an array
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableCellFrame);
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrame, nsLayoutAtoms::tableCellFrame);
nsVoidArray cellChildren;
for (nsIFrame* childFrame = aFrameList; childFrame; childFrame->GetNextSibling(&childFrame)) {
nsIAtom* frameType;
@ -245,7 +245,7 @@ nsTableRowFrame::DidResize(nsIPresContext* aPresContext,
nsTableFrame* tableFrame;
nsTableFrame::GetTableFrame(this, tableFrame);
nsTableIterator iter(*this, eTableDIR);
nsTableIterator iter(aPresContext, *this, eTableDIR);
nsIFrame* cellFrame = iter.First();
while (nsnull != cellFrame) {
@ -320,16 +320,17 @@ void nsTableRowFrame::SetMaxChildHeight(nscoord aChildHeight)
}
static
PRBool IsFirstRow(nsTableFrame& aTable,
PRBool IsFirstRow(nsIPresContext* aPresContext,
nsTableFrame& aTable,
nsTableRowFrame& aRow)
{
nsIFrame* firstRowGroup = nsnull;
aTable.FirstChild(nsnull, &firstRowGroup);
aTable.FirstChild(aPresContext, nsnull, &firstRowGroup);
nsIFrame* rowGroupFrame = nsnull;
nsresult rv = aRow.GetParent(&rowGroupFrame);
if (NS_SUCCEEDED(rv) && (rowGroupFrame == firstRowGroup)) {
nsIFrame* firstRow;
rowGroupFrame->FirstChild(nsnull, &firstRow);
rowGroupFrame->FirstChild(aPresContext, nsnull, &firstRow);
return (&aRow == firstRow);
}
return PR_FALSE;
@ -365,7 +366,7 @@ NS_METHOD nsTableRowFrame::Paint(nsIPresContext* aPresContext,
nsRect rect(0, 0, mRect.width + cellSpacingX, mRect.height);
// first row may have gotten too much cell spacing Y
if (tableFrame->GetRowCount() != 1) {
if (IsFirstRow(*tableFrame, *this)) {
if (IsFirstRow(aPresContext, *tableFrame, *this)) {
rect.height -= halfCellSpacingY;
}
else {
@ -696,7 +697,7 @@ NS_METHOD nsTableRowFrame::ResizeReflow(nsIPresContext* aPresContext,
nsTableIteration dir = (aReflowState.reflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
? eTableLTR : eTableDIR;
nsTableIterator iter(*this, dir);
nsTableIterator iter(aPresContext, *this, dir);
if (iter.IsLeftToRight()) {
prevColIndex = -1;
}
@ -1409,7 +1410,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
* so the default "get the child rect, see if it contains the event point" action isn't
* sufficient. We have to ask the row if it has a child that contains the point.
*/
PRBool nsTableRowFrame::Contains(const nsPoint& aPoint)
PRBool nsTableRowFrame::Contains(nsIPresContext* aPresContext, const nsPoint& aPoint)
{
PRBool result = PR_FALSE;
// first, check the row rect and see if the point is in their
@ -1419,7 +1420,7 @@ PRBool nsTableRowFrame::Contains(const nsPoint& aPoint)
// if that fails, check the cells, they might span outside the row rect
else {
nsIFrame* kid;
FirstChild(nsnull, &kid);
FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
nsRect kidRect;
kid->GetRect(kidRect);

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

@ -172,7 +172,7 @@ public:
/** set this row's starting row index */
void SetRowIndex (int aRowIndex);
virtual PRBool Contains(const nsPoint& aPoint);
virtual PRBool Contains(nsIPresContext* aPresContext, const nsPoint& aPoint);
void GetMaxElementSize(nsSize& aMaxElementSize) const;

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

@ -113,12 +113,13 @@ PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
}
nsresult
nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame)
nsTableRowGroupFrame::InitRepeatedFrame(nsIPresContext* aPresContext,
nsTableRowGroupFrame* aHeaderFooterFrame)
{
nsIFrame* originalRowFrame;
nsIFrame* copyRowFrame = GetFirstFrame();
aHeaderFooterFrame->FirstChild(nsnull, &originalRowFrame);
aHeaderFooterFrame->FirstChild(aPresContext, nsnull, &originalRowFrame);
while (copyRowFrame) {
// Set the row frame index
int rowIndex = ((nsTableRowFrame*)originalRowFrame)->GetRowIndex();
@ -127,8 +128,8 @@ nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame
// For each table cell frame set its column index
nsIFrame* originalCellFrame;
nsIFrame* copyCellFrame;
originalRowFrame->FirstChild(nsnull, &originalCellFrame);
copyRowFrame->FirstChild(nsnull, &copyCellFrame);
originalRowFrame->FirstChild(aPresContext, nsnull, &originalCellFrame);
copyRowFrame->FirstChild(aPresContext, nsnull, &copyCellFrame);
while (copyCellFrame) {
nsIAtom* frameType;
copyCellFrame->GetFrameType(&frameType);
@ -189,7 +190,7 @@ NS_METHOD nsTableRowGroupFrame::Paint(nsIPresContext* aPresContext,
// every row group is short by the ending cell spacing X
nsRect rect(0, 0, mRect.width, mRect.height);
nsIFrame* firstRowGroup = nsnull;
tableFrame->FirstChild(nsnull, &firstRowGroup);
tableFrame->FirstChild(aPresContext, nsnull, &firstRowGroup);
// first row group may have gotten too much cell spacing Y
if (tableFrame->GetRowCount() != 1) {
if (this == firstRowGroup) {
@ -287,13 +288,13 @@ nsTableRowGroupFrame::GetFrameForPoint(nsIPresContext* aPresContext,
nsPoint tmp;
*aFrame = this;
FirstChild(nsnull, &kid);
FirstChild(aPresContext, nsnull, &kid);
while (nsnull != kid) {
kid->GetRect(kidRect);
const nsStyleDisplay *childDisplay;
kid->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)childDisplay));
if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) {
if (((nsTableRowFrame*)(kid))->Contains(aPoint)) {
if (((nsTableRowFrame*)(kid))->Contains(aPresContext, aPoint)) {
tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
return kid->GetFrameForPoint(aPresContext, tmp, aFrame);
}
@ -647,7 +648,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext,
{
// check this row for a cell with rowspans
nsIFrame *cellFrame;
rowFrame->FirstChild(nsnull, &cellFrame);
rowFrame->FirstChild(aPresContext, nsnull, &cellFrame);
while (nsnull != cellFrame)
{
const nsStyleDisplay *cellChildDisplay;
@ -1236,7 +1237,7 @@ nsTableRowGroupFrame::InsertFrames(nsIPresContext* aPresContext,
nsTableFrame* tableFrame = nsnull;
nsTableFrame::GetTableFrame(this, tableFrame);
if (tableFrame) {
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, nsLayoutAtoms::tableRowFrame);
nsTableRowFrame* prevRow = (nsTableRowFrame *)nsTableFrame::GetFrameAtOrBefore(aPresContext, this, aPrevFrame, nsLayoutAtoms::tableRowFrame);
PRInt32 rowIndex = (prevRow) ? prevRow->GetRowIndex() + 1 : 0;
tableFrame->InsertRows(*aPresContext, *this, rows, rowIndex, PR_TRUE);
@ -1344,12 +1345,12 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsMe(nsIPresContext* aPresContext,
return rv;
}
NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult)
NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nsIPresContext* aPresContext, nscoord& aResult)
{
// the rows in rowGroupFrame need to be expanded by rowHeightDelta[i]
// and the rowgroup itself needs to be expanded by SUM(row height deltas)
nsIFrame * rowFrame=nsnull;
nsresult rv = FirstChild(nsnull, &rowFrame);
nsresult rv = FirstChild(aPresContext, nsnull, &rowFrame);
while ((NS_SUCCEEDED(rv)) && (nsnull!=rowFrame))
{
const nsStyleDisplay *rowDisplay;
@ -1362,7 +1363,7 @@ NS_METHOD nsTableRowGroupFrame::GetHeightOfRows(nscoord& aResult)
}
else if (NS_STYLE_DISPLAY_TABLE_ROW_GROUP == rowDisplay->mDisplay)
{
((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aResult);
((nsTableRowGroupFrame*)rowFrame)->GetHeightOfRows(aPresContext, aResult);
}
GetNextFrame(rowFrame, &rowFrame);
}

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