diff --git a/mozilla/content/shared/public/nsLayoutAtomList.h b/mozilla/content/shared/public/nsLayoutAtomList.h index def0bba7eff..c584e5b8552 100644 --- a/mozilla/content/shared/public/nsLayoutAtomList.h +++ b/mozilla/content/shared/public/nsLayoutAtomList.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 diff --git a/mozilla/content/xul/content/src/nsXULTreeElement.cpp b/mozilla/content/xul/content/src/nsXULTreeElement.cpp index b483e6e8955..4e505b260b5 100644 --- a/mozilla/content/xul/content/src/nsXULTreeElement.cpp +++ b/mozilla/content/xul/content/src/nsXULTreeElement.cpp @@ -510,10 +510,12 @@ nsXULTreeElement::EnsureElementIsVisible(nsIDOMXULElement *aElement) shell->GetPrimaryFrameFor(content, &outerFrame); if (outerFrame) { + nsCOMPtr 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) { diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 3c95bef8b35..cc312b73d2a 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -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::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 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 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 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 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 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 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); } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.h b/mozilla/layout/base/nsCSSFrameConstructor.h index cde4e83e93c..fb6af723d5d 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.h +++ b/mozilla/layout/base/nsCSSFrameConstructor.h @@ -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, diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 634d320d084..a802afc3179 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -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 diff --git a/mozilla/layout/base/nsFrameTraversal.cpp b/mozilla/layout/base/nsFrameTraversal.cpp index 024232f78d1..36f5091c6d7 100644 --- a/mozilla/layout/base/nsFrameTraversal.cpp +++ b/mozilla/layout/base/nsFrameTraversal.cpp @@ -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; diff --git a/mozilla/layout/base/nsFrameTraversal.h b/mozilla/layout/base/nsFrameTraversal.h index ed81a60b115..085451969ba 100644 --- a/mozilla/layout/base/nsFrameTraversal.h +++ b/mozilla/layout/base/nsFrameTraversal.h @@ -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 diff --git a/mozilla/layout/base/nsLayoutAtomList.h b/mozilla/layout/base/nsLayoutAtomList.h index def0bba7eff..c584e5b8552 100644 --- a/mozilla/layout/base/nsLayoutAtomList.h +++ b/mozilla/layout/base/nsLayoutAtomList.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 diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index f4276986534..196683791ea 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -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) { diff --git a/mozilla/layout/base/public/nsFrameTraversal.h b/mozilla/layout/base/public/nsFrameTraversal.h index ed81a60b115..085451969ba 100644 --- a/mozilla/layout/base/public/nsFrameTraversal.h +++ b/mozilla/layout/base/public/nsFrameTraversal.h @@ -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 diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index a47d4dc33e5..ab9c378d3d5 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.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 diff --git a/mozilla/layout/base/public/nsIFrameManager.h b/mozilla/layout/base/public/nsIFrameManager.h index 4132c93a332..5f56d32d5f2 100644 --- a/mozilla/layout/base/public/nsIFrameManager.h +++ b/mozilla/layout/base/public/nsIFrameManager.h @@ -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 }; diff --git a/mozilla/layout/base/public/nsLayoutAtomList.h b/mozilla/layout/base/public/nsLayoutAtomList.h index def0bba7eff..c584e5b8552 100644 --- a/mozilla/layout/base/public/nsLayoutAtomList.h +++ b/mozilla/layout/base/public/nsLayoutAtomList.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 diff --git a/mozilla/layout/base/src/nsFrameTraversal.cpp b/mozilla/layout/base/src/nsFrameTraversal.cpp index 024232f78d1..36f5091c6d7 100644 --- a/mozilla/layout/base/src/nsFrameTraversal.cpp +++ b/mozilla/layout/base/src/nsFrameTraversal.cpp @@ -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; diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index f5b184c118c..465a7945feb 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -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; } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 7a355a93939..3024439a87a 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -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); diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 1fe085d2ae3..68af3067500 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsFileControlFrame.h b/mozilla/layout/forms/nsFileControlFrame.h index 1ef79b52230..1d1a984eaa9 100644 --- a/mozilla/layout/forms/nsFileControlFrame.h +++ b/mozilla/layout/forms/nsFileControlFrame.h @@ -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; } diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp index b93821a5a02..1d0b051f6ca 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp @@ -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); diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp index 942e131d64f..560b4406af7 100644 --- a/mozilla/layout/generic/nsAreaFrame.cpp +++ b/mozilla/layout/generic/nsAreaFrame.cpp @@ -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 diff --git a/mozilla/layout/generic/nsAreaFrame.h b/mozilla/layout/generic/nsAreaFrame.h index b291dfab938..32f8c405ea4 100644 --- a/mozilla/layout/generic/nsAreaFrame.h +++ b/mozilla/layout/generic/nsAreaFrame.h @@ -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, diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 86e451e617d..a62c7281423 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -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 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 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 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; diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index 75a763d885b..bea79299ec2 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -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); diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 86e451e617d..a62c7281423 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -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 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 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 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; diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 86e451e617d..a62c7281423 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -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 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 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 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; diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 1520cfd7ae9..be1a6f32837 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -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 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); } diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index 8af9b04893e..954436d10ed 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -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 diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index 14f730ce132..daf1cf4e7e8 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -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); diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index 27bd2c55f52..4e1664a46b1 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -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 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 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 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; diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index d9612542472..6a7c6e6266a 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -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); diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index b08ed2b39ce..ec8a36efb56 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -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& 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 ibox ( do_QueryInterface(mInner->mScrollAreaFrame) ); if (ibox) ibox->GetBoxInfo(aPresContext, aReflowState, scrollAreaInfo); diff --git a/mozilla/layout/generic/nsGfxScrollFrame.h b/mozilla/layout/generic/nsGfxScrollFrame.h index 62a805f078d..94793cd408b 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.h +++ b/mozilla/layout/generic/nsGfxScrollFrame.h @@ -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); diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index bb94bb9ed74..1485ab9b3e0 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -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; } diff --git a/mozilla/layout/generic/nsIAnonymousContentCreator.h b/mozilla/layout/generic/nsIAnonymousContentCreator.h index 407440fb21b..c2294dd9a7b 100644 --- a/mozilla/layout/generic/nsIAnonymousContentCreator.h +++ b/mozilla/layout/generic/nsIAnonymousContentCreator.h @@ -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& aNewNode); diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index a47d4dc33e5..ab9c378d3d5 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.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 diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 261b28679b7..47d6bf0dd45 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -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 diff --git a/mozilla/layout/generic/nsInlineFrame.h b/mozilla/layout/generic/nsInlineFrame.h index 6ed5c0874e0..a6bb9504e8a 100644 --- a/mozilla/layout/generic/nsInlineFrame.h +++ b/mozilla/layout/generic/nsInlineFrame.h @@ -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, diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 089acc84710..8e618529ba3 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -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))) diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index 83ac155d6ff..6380be9faa2 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsAreaFrame.cpp b/mozilla/layout/html/base/src/nsAreaFrame.cpp index 942e131d64f..560b4406af7 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsAreaFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsAreaFrame.h b/mozilla/layout/html/base/src/nsAreaFrame.h index b291dfab938..32f8c405ea4 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.h +++ b/mozilla/layout/html/base/src/nsAreaFrame.h @@ -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, diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 86e451e617d..a62c7281423 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -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 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 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 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; diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index 75a763d885b..bea79299ec2 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -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); diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 86e451e617d..a62c7281423 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -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 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 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 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; diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 86e451e617d..a62c7281423 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -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 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 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 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; diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 1520cfd7ae9..be1a6f32837 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -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 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); } diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index 8af9b04893e..954436d10ed 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -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 diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index 14f730ce132..daf1cf4e7e8 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -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); diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index 27bd2c55f52..4e1664a46b1 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -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 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 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 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; diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index d9612542472..6a7c6e6266a 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -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); diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 634d320d084..a802afc3179 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index b08ed2b39ce..ec8a36efb56 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -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& 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 ibox ( do_QueryInterface(mInner->mScrollAreaFrame) ); if (ibox) ibox->GetBoxInfo(aPresContext, aReflowState, scrollAreaInfo); diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.h b/mozilla/layout/html/base/src/nsGfxScrollFrame.h index 62a805f078d..94793cd408b 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.h +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.h @@ -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); diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index bb94bb9ed74..1485ab9b3e0 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -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; } diff --git a/mozilla/layout/html/base/src/nsIAnonymousContentCreator.h b/mozilla/layout/html/base/src/nsIAnonymousContentCreator.h index 407440fb21b..c2294dd9a7b 100644 --- a/mozilla/layout/html/base/src/nsIAnonymousContentCreator.h +++ b/mozilla/layout/html/base/src/nsIAnonymousContentCreator.h @@ -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& aNewNode); diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 261b28679b7..47d6bf0dd45 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsInlineFrame.h b/mozilla/layout/html/base/src/nsInlineFrame.h index 6ed5c0874e0..a6bb9504e8a 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.h +++ b/mozilla/layout/html/base/src/nsInlineFrame.h @@ -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, diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index f4276986534..196683791ea 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -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) { diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 089acc84710..8e618529ba3 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -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))) diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index 83ac155d6ff..6380be9faa2 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -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 diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index f5b184c118c..465a7945feb 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -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; } diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index 7a355a93939..3024439a87a 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -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); diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 1fe085d2ae3..68af3067500 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.h b/mozilla/layout/html/forms/src/nsFileControlFrame.h index 1ef79b52230..1d1a984eaa9 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.h @@ -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; } diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp index b93821a5a02..1d0b051f6ca 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -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); diff --git a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp index c198042a5e0..73dcd114ad1 100644 --- a/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -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 diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp index 1dc69d57901..732197b2aa4 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -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 diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h index 7cbd032b5e2..695dbb9d383 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h @@ -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; diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index 0a09fd3bb2f..1022a516a42 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -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); } } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 3c95bef8b35..cc312b73d2a 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -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::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 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 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 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 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 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 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); } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.h b/mozilla/layout/html/style/src/nsCSSFrameConstructor.h index cde4e83e93c..fb6af723d5d 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.h +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.h @@ -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, diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 2a71a40547f..4a60af0f7d8 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -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; } diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h index 34186cc4d7d..cb8cdce832e 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h @@ -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 diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp index 81efb526425..ef1849559f3 100644 --- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp @@ -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; diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h index 4fd51314014..9a6d706c9dd 100644 --- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.h @@ -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); }; diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index 61424b2a21e..87483135528 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -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); diff --git a/mozilla/layout/html/table/src/nsCellMap.h b/mozilla/layout/html/table/src/nsCellMap.h index d8ea423335d..d1465ad75cd 100644 --- a/mozilla/layout/html/table/src/nsCellMap.h +++ b/mozilla/layout/html/table/src/nsCellMap.h @@ -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, diff --git a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h index e0720d881f8..f95abc1f051 100644 --- a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h +++ b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 015096e766c..7e2f10224bf 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -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); diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.h b/mozilla/layout/html/table/src/nsTableColGroupFrame.h index f94678c772c..56e7a01e0b9 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.h @@ -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(); diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 500aed7e660..1f4673f4238 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -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); } diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index 9e4138929d7..e2ccbfa0766 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -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); diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 9ef301e659c..ff571516520 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -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); diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.h b/mozilla/layout/html/table/src/nsTableRowFrame.h index 81427f74a47..051c022fdba 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.h +++ b/mozilla/layout/html/table/src/nsTableRowFrame.h @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index c1176427037..5596ba99de9 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -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, ©CellFrame); + originalRowFrame->FirstChild(aPresContext, nsnull, &originalCellFrame); + copyRowFrame->FirstChild(aPresContext, nsnull, ©CellFrame); 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); } diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h index 90aaea9bde1..55e7e63da3d 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h @@ -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; } diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 2a71a40547f..4a60af0f7d8 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -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; } diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.h b/mozilla/layout/tables/BasicTableLayoutStrategy.h index 34186cc4d7d..cb8cdce832e 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.h +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.h @@ -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 diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp index 81efb526425..ef1849559f3 100644 --- a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp @@ -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; diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.h b/mozilla/layout/tables/FixedTableLayoutStrategy.h index 4fd51314014..9a6d706c9dd 100644 --- a/mozilla/layout/tables/FixedTableLayoutStrategy.h +++ b/mozilla/layout/tables/FixedTableLayoutStrategy.h @@ -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); }; diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index 61424b2a21e..87483135528 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -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); diff --git a/mozilla/layout/tables/nsCellMap.h b/mozilla/layout/tables/nsCellMap.h index d8ea423335d..d1465ad75cd 100644 --- a/mozilla/layout/tables/nsCellMap.h +++ b/mozilla/layout/tables/nsCellMap.h @@ -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, diff --git a/mozilla/layout/tables/nsITableLayoutStrategy.h b/mozilla/layout/tables/nsITableLayoutStrategy.h index e0720d881f8..f95abc1f051 100644 --- a/mozilla/layout/tables/nsITableLayoutStrategy.h +++ b/mozilla/layout/tables/nsITableLayoutStrategy.h @@ -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; diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 015096e766c..7e2f10224bf 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -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); diff --git a/mozilla/layout/tables/nsTableColGroupFrame.h b/mozilla/layout/tables/nsTableColGroupFrame.h index f94678c772c..56e7a01e0b9 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.h +++ b/mozilla/layout/tables/nsTableColGroupFrame.h @@ -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(); diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 500aed7e660..1f4673f4238 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -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); } diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h index 9e4138929d7..e2ccbfa0766 100644 --- a/mozilla/layout/tables/nsTableFrame.h +++ b/mozilla/layout/tables/nsTableFrame.h @@ -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); diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 9ef301e659c..ff571516520 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -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); diff --git a/mozilla/layout/tables/nsTableRowFrame.h b/mozilla/layout/tables/nsTableRowFrame.h index 81427f74a47..051c022fdba 100644 --- a/mozilla/layout/tables/nsTableRowFrame.h +++ b/mozilla/layout/tables/nsTableRowFrame.h @@ -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; diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index c1176427037..5596ba99de9 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -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, ©CellFrame); + originalRowFrame->FirstChild(aPresContext, nsnull, &originalCellFrame); + copyRowFrame->FirstChild(aPresContext, nsnull, ©CellFrame); 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); } diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h index 90aaea9bde1..55e7e63da3d 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.h +++ b/mozilla/layout/tables/nsTableRowGroupFrame.h @@ -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; } diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp index 1b0eea53ab9..66652fafff0 100644 --- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp @@ -895,7 +895,7 @@ nsBoxFrame::CollapseChild(nsIPresContext* aPresContext, nsIFrame* frame, PRBool // collapse the child nsIFrame* child = nsnull; - frame->FirstChild(nsnull, &child); + frame->FirstChild(aPresContext, nsnull, &child); while (nsnull != child) { diff --git a/mozilla/layout/xul/base/src/nsFrameNavigator.cpp b/mozilla/layout/xul/base/src/nsFrameNavigator.cpp index 943f8930228..3ec48e74196 100644 --- a/mozilla/layout/xul/base/src/nsFrameNavigator.cpp +++ b/mozilla/layout/xul/base/src/nsFrameNavigator.cpp @@ -46,12 +46,12 @@ nsFrameNavigator::GetTag(nsIFrame* frame) } nsIFrame* -nsFrameNavigator::GetChildBeforeAfter(nsIFrame* start, PRBool before) +nsFrameNavigator::GetChildBeforeAfter(nsIPresContext* aPresContext, nsIFrame* start, PRBool before) { nsIFrame* parent = nsnull; start->GetParent(&parent); - PRInt32 index = IndexOf(parent,start); - PRInt32 count = CountFrames(parent); + PRInt32 index = IndexOf(aPresContext, parent,start); + PRInt32 count = CountFrames(aPresContext, parent); if (index == -1) return nsnull; @@ -61,23 +61,23 @@ nsFrameNavigator::GetChildBeforeAfter(nsIFrame* start, PRBool before) return nsnull; } - return GetChildAt(parent, index-1); + return GetChildAt(aPresContext, parent, index-1); } if (index == count-1) return nsnull; - return GetChildAt(parent, index+1); + return GetChildAt(aPresContext, parent, index+1); } PRInt32 -nsFrameNavigator::IndexOf(nsIFrame* parent, nsIFrame* child) +nsFrameNavigator::IndexOf(nsIPresContext* aPresContext, nsIFrame* parent, nsIFrame* child) { PRInt32 count = 0; nsIFrame* childFrame; - parent->FirstChild(nsnull, &childFrame); + parent->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { if (childFrame == child) @@ -92,12 +92,12 @@ nsFrameNavigator::IndexOf(nsIFrame* parent, nsIFrame* child) } PRInt32 -nsFrameNavigator::CountFrames(nsIFrame* aFrame) +nsFrameNavigator::CountFrames(nsIPresContext* aPresContext, nsIFrame* aFrame) { PRInt32 count = 0; nsIFrame* childFrame; - aFrame->FirstChild(nsnull, &childFrame); + aFrame->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { nsresult rv = childFrame->GetNextSibling(&childFrame); @@ -109,12 +109,12 @@ nsFrameNavigator::CountFrames(nsIFrame* aFrame) } nsIFrame* -nsFrameNavigator::GetChildAt(nsIFrame* parent, PRInt32 index) +nsFrameNavigator::GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt32 index) { PRInt32 count = 0; nsIFrame* childFrame; - parent->FirstChild(nsnull, &childFrame); + parent->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { if (count == index) diff --git a/mozilla/layout/xul/base/src/nsFrameNavigator.h b/mozilla/layout/xul/base/src/nsFrameNavigator.h index 58d253970b5..1a2cfcfed89 100644 --- a/mozilla/layout/xul/base/src/nsFrameNavigator.h +++ b/mozilla/layout/xul/base/src/nsFrameNavigator.h @@ -36,10 +36,10 @@ class nsFrameNavigator { public: - static nsIFrame* GetChildBeforeAfter(nsIFrame* start, PRBool before); - static nsIFrame* GetChildAt(nsIFrame* parent, PRInt32 index); - static PRInt32 IndexOf(nsIFrame* parent, nsIFrame* child); - static PRInt32 CountFrames(nsIFrame* aFrame); + static nsIFrame* GetChildBeforeAfter(nsIPresContext* aPresContext, nsIFrame* start, PRBool before); + static nsIFrame* GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt32 index); + static PRInt32 IndexOf(nsIPresContext* aPresContext, nsIFrame* parent, nsIFrame* child); + static PRInt32 CountFrames(nsIPresContext* aPresContext, nsIFrame* aFrame); static nsIAtom* GetTag(nsIFrame* frame); }; diff --git a/mozilla/layout/xul/base/src/nsGrippyFrame.cpp b/mozilla/layout/xul/base/src/nsGrippyFrame.cpp index 4b7859dc5cf..7c6138be844 100644 --- a/mozilla/layout/xul/base/src/nsGrippyFrame.cpp +++ b/mozilla/layout/xul/base/src/nsGrippyFrame.cpp @@ -152,12 +152,12 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext) nsIFrame* -nsGrippyFrame::GetChildBeforeAfter(nsIFrame* start, PRBool before) +nsGrippyFrame::GetChildBeforeAfter(nsIPresContext* aPresContext, nsIFrame* start, PRBool before) { nsIFrame* parent = nsnull; start->GetParent(&parent); - PRInt32 index = IndexOf(parent,start); - PRInt32 count = CountFrames(parent); + PRInt32 index = IndexOf(aPresContext, parent,start); + PRInt32 count = CountFrames(aPresContext, parent); if (index == -1) return nsnull; @@ -167,24 +167,24 @@ nsGrippyFrame::GetChildBeforeAfter(nsIFrame* start, PRBool before) return nsnull; } - return GetChildAt(parent, index-1); + return GetChildAt(aPresContext, parent, index-1); } if (index == count-1) return nsnull; - return GetChildAt(parent, index+1); + return GetChildAt(aPresContext, parent, index+1); } PRInt32 -nsGrippyFrame::IndexOf(nsIFrame* parent, nsIFrame* child) +nsGrippyFrame::IndexOf(nsIPresContext* aPresContext, nsIFrame* parent, nsIFrame* child) { PRInt32 count = 0; nsIFrame* childFrame; - parent->FirstChild(nsnull, &childFrame); + parent->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { if (childFrame == child) @@ -199,12 +199,12 @@ nsGrippyFrame::IndexOf(nsIFrame* parent, nsIFrame* child) } PRInt32 -nsGrippyFrame::CountFrames(nsIFrame* aFrame) +nsGrippyFrame::CountFrames(nsIPresContext* aPresContext, nsIFrame* aFrame) { PRInt32 count = 0; nsIFrame* childFrame; - aFrame->FirstChild(nsnull, &childFrame); + aFrame->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { nsresult rv = childFrame->GetNextSibling(&childFrame); @@ -216,12 +216,12 @@ nsGrippyFrame::CountFrames(nsIFrame* aFrame) } nsIFrame* -nsGrippyFrame::GetChildAt(nsIFrame* parent, PRInt32 index) +nsGrippyFrame::GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt32 index) { PRInt32 count = 0; nsIFrame* childFrame; - parent->FirstChild(nsnull, &childFrame); + parent->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { if (count == index) diff --git a/mozilla/layout/xul/base/src/nsGrippyFrame.h b/mozilla/layout/xul/base/src/nsGrippyFrame.h index 758d7b6adb0..e2b3690f99d 100644 --- a/mozilla/layout/xul/base/src/nsGrippyFrame.h +++ b/mozilla/layout/xul/base/src/nsGrippyFrame.h @@ -43,10 +43,10 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; - static nsIFrame* GetChildBeforeAfter(nsIFrame* start, PRBool before); - static nsIFrame* GetChildAt(nsIFrame* parent, PRInt32 index); - static PRInt32 IndexOf(nsIFrame* parent, nsIFrame* child); - static PRInt32 CountFrames(nsIFrame* aFrame); + static nsIFrame* GetChildBeforeAfter(nsIPresContext* aPresContext, nsIFrame* start, PRBool before); + static nsIFrame* GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt32 index); + static PRInt32 IndexOf(nsIPresContext* aPresContext, nsIFrame* parent, nsIFrame* child); + static PRInt32 CountFrames(nsIPresContext* aPresContext, nsIFrame* aFrame); nsGrippyFrame(); protected: diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 135aadf23b1..c68c223bd70 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -156,13 +156,14 @@ nsMenuFrame::Init(nsIPresContext* aPresContext, // The following methods are all overridden to ensure that the menupopup frame // is placed in the appropriate list. NS_IMETHODIMP -nsMenuFrame::FirstChild(nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsMenuFrame::FirstChild(nsIPresContext* aPresContext, + nsIAtom* aListName, + nsIFrame** aFirstChild) const { if (nsLayoutAtoms::popupList == aListName) { *aFirstChild = mPopupFrames.FirstChild(); } else { - nsBoxFrame::FirstChild(aListName, aFirstChild); + nsBoxFrame::FirstChild(aPresContext, aListName, aFirstChild); } return NS_OK; } @@ -451,9 +452,9 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext, OpenMenuInternal(PR_FALSE); } else if (aAttribute == nsHTMLAtoms::checked) { if (mType != eMenuType_Normal) - UpdateMenuSpecialState(); + UpdateMenuSpecialState(aPresContext); } else if (aAttribute == nsHTMLAtoms::type) { - UpdateMenuType(); + UpdateMenuType(aPresContext); } if (mHasAnonymousContent) { @@ -872,7 +873,7 @@ nsMenuFrame::IsDisabled() } void -nsMenuFrame::UpdateMenuType() +nsMenuFrame::UpdateMenuType(nsIPresContext* aPresContext) { nsAutoString value; mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, value); @@ -886,12 +887,12 @@ nsMenuFrame::UpdateMenuType() PR_TRUE); mType = eMenuType_Normal; } - UpdateMenuSpecialState(); + UpdateMenuSpecialState(aPresContext); } /* update checked-ness for type="checkbox" and type="radio" */ void -nsMenuFrame::UpdateMenuSpecialState() { +nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) { nsAutoString value; PRBool newChecked; @@ -955,7 +956,7 @@ nsMenuFrame::UpdateMenuSpecialState() { NS_ASSERTION(NS_SUCCEEDED(rv), "couldn't get parent of radio menu frame\n"); if (NS_FAILED(rv)) return; - rv = parent->FirstChild(NULL, &sib); + rv = parent->FirstChild(aPresContext, NULL, &sib); NS_ASSERTION((NS_SUCCEEDED(rv) && sib), "couldn't get first sib of radio menu frame\n"); if (NS_FAILED(rv) || !sib) return; @@ -987,7 +988,7 @@ nsMenuFrame::UpdateMenuSpecialState() { } NS_IMETHODIMP -nsMenuFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren) +nsMenuFrame::CreateAnonymousContent(nsIPresContext* aPresContext, nsISupportsArray& aAnonymousChildren) { // Create anonymous children only if the menu has no children or // only has a menuchildren as its child. @@ -1068,7 +1069,7 @@ nsMenuFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren) aAnonymousChildren.AppendElement(content); // Do the type="checkbox" magic - UpdateMenuType(); + UpdateMenuType(aPresContext); // Create a spring that serves as padding between the text and the // accelerator. diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.h b/mozilla/layout/xul/base/src/nsMenuFrame.h index 5e9539ee66c..f6dcd820e6a 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.h +++ b/mozilla/layout/xul/base/src/nsMenuFrame.h @@ -59,7 +59,7 @@ public: NS_DECL_ISUPPORTS // The nsIAnonymousContentCreator interface - NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems); + NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext, nsISupportsArray& aAnonymousItems); // The nsITimerCallback interface NS_IMETHOD_(void) Notify(nsITimer *timer); @@ -75,8 +75,9 @@ public: // The following four methods are all overridden so that the menu children // can be stored in a separate list (so that they don't impact reflow of the // actual menu item at all). - 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); @@ -154,8 +155,8 @@ public: protected: static void UpdateDismissalListener(nsIMenuParent* aMenuParent); - void UpdateMenuType(); - void UpdateMenuSpecialState(); + void UpdateMenuType(nsIPresContext* aPresContext); + void UpdateMenuSpecialState(nsIPresContext* aPresContext); void OpenMenuInternal(PRBool aActivateFlag); void GetMenuChildrenElement(nsIContent** aResult); diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp index 0d1f88facc3..8e644c01e07 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp @@ -135,13 +135,14 @@ nsPopupSetFrame::Init(nsIPresContext* aPresContext, // The following methods are all overridden to ensure that the menupopup frames // are placed in the appropriate list. NS_IMETHODIMP -nsPopupSetFrame::FirstChild(nsIAtom* aListName, - nsIFrame** aFirstChild) const +nsPopupSetFrame::FirstChild(nsIPresContext* aPresContext, + nsIAtom* aListName, + nsIFrame** aFirstChild) const { if (nsLayoutAtoms::popupList == aListName) { *aFirstChild = mPopupFrames.FirstChild(); } else { - nsBoxFrame::FirstChild(aListName, aFirstChild); + nsBoxFrame::FirstChild(aPresContext, aListName, aFirstChild); } return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.h b/mozilla/layout/xul/base/src/nsPopupSetFrame.h index 968c42802b3..d8ac563a5e3 100644 --- a/mozilla/layout/xul/base/src/nsPopupSetFrame.h +++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.h @@ -54,8 +54,9 @@ public: // The following four methods are all overridden so that the menu children // can be stored in a separate list (so that they don't impact reflow of the // actual menu item at all). - 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); diff --git a/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp b/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp index 5d6bfbaeed6..965ac077731 100644 --- a/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp +++ b/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.cpp @@ -177,11 +177,12 @@ nsScrollbarButtonFrame::MouseClicked() } nsresult -nsScrollbarButtonFrame::GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result) +nsScrollbarButtonFrame::GetChildWithTag(nsIPresContext* aPresContext, + nsIAtom* atom, nsIFrame* start, nsIFrame*& result) { // recursively search our children nsIFrame* childFrame; - start->FirstChild(nsnull, &childFrame); + start->FirstChild(aPresContext, nsnull, &childFrame); while (nsnull != childFrame) { // get the content node @@ -200,7 +201,7 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame } // recursive search the child - GetChildWithTag(atom, childFrame, result); + GetChildWithTag(aPresContext, atom, childFrame, result); if (result != nsnull) return NS_OK; diff --git a/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.h b/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.h index 7584c295091..639beb3aa2a 100644 --- a/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.h +++ b/mozilla/layout/xul/base/src/nsScrollbarButtonFrame.h @@ -50,7 +50,8 @@ public: nsEventStatus* aEventStatus); - static nsresult GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result); + static nsresult GetChildWithTag(nsIPresContext* aPresContext, + nsIAtom* atom, nsIFrame* start, nsIFrame*& result); static nsresult GetParentWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame*& result); NS_IMETHOD HandlePress(nsIPresContext* aPresContext, diff --git a/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp b/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp index e12efa06472..675d4ed318d 100644 --- a/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp @@ -272,7 +272,8 @@ NS_NewScrollbarFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame ) * Anonymous interface */ NS_IMETHODIMP -nsScrollbarFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren) +nsScrollbarFrame::CreateAnonymousContent(nsIPresContext* aPresContext, + nsISupportsArray& aAnonymousChildren) { // if not content the create some anonymous content PRInt32 count = 0; @@ -357,7 +358,7 @@ nsScrollbarFrame::AttributeChanged(nsIPresContext* aPresContext, // tell the slider its attribute changed so it can // update itself nsIFrame* slider; - nsScrollbarButtonFrame::GetChildWithTag(nsXULAtoms::slider, this, slider); + nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::slider, this, slider); if (slider) slider->AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aHint); } diff --git a/mozilla/layout/xul/base/src/nsScrollbarFrame.h b/mozilla/layout/xul/base/src/nsScrollbarFrame.h index f8962a8fb9b..2a0cd66dc7b 100644 --- a/mozilla/layout/xul/base/src/nsScrollbarFrame.h +++ b/mozilla/layout/xul/base/src/nsScrollbarFrame.h @@ -55,7 +55,8 @@ public: PRInt32 aHint); // nsIAnonymousConentCreator - NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems); + NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext, + nsISupportsArray& aAnonymousItems); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.cpp b/mozilla/layout/xul/base/src/nsSliderFrame.cpp index ec0939731f3..4f735515474 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSliderFrame.cpp @@ -96,7 +96,8 @@ nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNam * Anonymous interface */ NS_IMETHODIMP -nsSliderFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren) +nsSliderFrame::CreateAnonymousContent(nsIPresContext* aPresContext, + nsISupportsArray& aAnonymousChildren) { // supply anonymous content if there is no content PRInt32 count = 0; diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.h b/mozilla/layout/xul/base/src/nsSliderFrame.h index 8263025f823..089cb27f257 100644 --- a/mozilla/layout/xul/base/src/nsSliderFrame.h +++ b/mozilla/layout/xul/base/src/nsSliderFrame.h @@ -84,7 +84,8 @@ public: nsIStyleContext* aContext, nsIFrame* asPrevInFlow); - NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems); + NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext, + nsISupportsArray& aAnonymousItems); NS_IMETHOD Reflow(nsIPresContext* aPresContext, nsHTMLReflowMetrics& aDesiredSize, diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp index 1ce42a3e5d8..481628a7fe5 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp @@ -112,7 +112,7 @@ public: void UpdateState(); - void AddListener(); + void AddListener(nsIPresContext* aPresContext); void RemoveListener(); enum ResizeType { Closest, Farthest, Grow }; @@ -263,7 +263,8 @@ nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNam * Anonymous interface */ NS_IMETHODIMP -nsSplitterFrame::CreateAnonymousContent(nsISupportsArray& aAnonymousChildren) +nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext, + nsISupportsArray& aAnonymousChildren) { // if not content the create some anonymous content PRInt32 count = 0; @@ -326,7 +327,7 @@ nsSplitterFrame::AttributeChanged(nsIPresContext* aPresContext, // tell the slider its attribute changed so it can // update itself nsIFrame* grippy = nsnull; - nsScrollbarButtonFrame::GetChildWithTag(nsXULAtoms::grippy, this, grippy); + nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::grippy, this, grippy); if (grippy) grippy->AttributeChanged(aPresContext, aChild, aNameSpaceID, aAttribute, aHint); } else if (aAttribute == nsXULAtoms::state) { @@ -366,7 +367,7 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext, nsnull); */ - mImpl->AddListener(); + mImpl->AddListener(aPresContext); return rv; } @@ -465,7 +466,7 @@ nsSplitterFrameImpl::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent) { if (IsMouseCaptured(aPresContext)) { AdjustChildren(aPresContext); - AddListener(); + AddListener(aPresContext); CaptureMouse(aPresContext, PR_FALSE); mSplitter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "", PR_TRUE); mPressed = PR_FALSE; @@ -592,10 +593,10 @@ nsSplitterFrameImpl::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent) } void -nsSplitterFrameImpl::AddListener() +nsSplitterFrameImpl::AddListener(nsIPresContext* aPresContext) { nsIFrame* thumbFrame = nsnull; - mSplitter->FirstChild(nsnull,&thumbFrame); + mSplitter->FirstChild(aPresContext, nsnull,&thumbFrame); nsCOMPtr content; mSplitter->GetContent(getter_AddRefs(content)); @@ -689,8 +690,8 @@ nsSplitterFrameImpl::MouseDown(nsIDOMEvent* aMouseEvent) mParentBox = (nsBoxFrame*)parent; // get our index - nscoord childIndex = nsFrameNavigator::IndexOf(mParentBox, mSplitter); - PRInt32 childCount = nsFrameNavigator::CountFrames(mParentBox); + nscoord childIndex = nsFrameNavigator::IndexOf(mSplitter->mPresContext, mParentBox, mSplitter); + PRInt32 childCount = nsFrameNavigator::CountFrames(mSplitter->mPresContext, mParentBox); // if its 0 or the last index then stop right here. if (childIndex == 0 || childIndex == childCount-1) { @@ -715,7 +716,7 @@ nsSplitterFrameImpl::MouseDown(nsIDOMEvent* aMouseEvent) mChildInfosAfterCount = 0; nsIFrame* childFrame = nsnull; - mParentBox->FirstChild(nsnull, &childFrame); + mParentBox->FirstChild(mSplitter->mPresContext, nsnull, &childFrame); while (nsnull != childFrame) { @@ -900,7 +901,7 @@ nsSplitterFrameImpl::UpdateState() // find the child just in the box just before the splitter. If we are not currently collapsed then // then get the childs style attribute and store it. Then set the child style attribute to be display none. // if we are already collapsed then set the child's style back to our stored value. - nsIFrame* child = nsFrameNavigator::GetChildBeforeAfter(splitter,(d == Before)); + nsIFrame* child = nsFrameNavigator::GetChildBeforeAfter(mSplitter->mPresContext, splitter,(d == Before)); if (child == nsnull) return; diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.h b/mozilla/layout/xul/base/src/nsSplitterFrame.h index 6fe99930ae4..5e2b91e2128 100644 --- a/mozilla/layout/xul/base/src/nsSplitterFrame.h +++ b/mozilla/layout/xul/base/src/nsSplitterFrame.h @@ -67,7 +67,8 @@ public: // nsIAnonymousContentCreator - NS_IMETHOD CreateAnonymousContent(nsISupportsArray& aAnonymousItems); + NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext, + nsISupportsArray& aAnonymousItems); NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); NS_IMETHOD_(nsrefcnt) AddRef(void) { return NS_OK; } NS_IMETHOD_(nsrefcnt) Release(void) { return NS_OK; } diff --git a/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp b/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp index fcdfba45b9a..4e3f8594264 100644 --- a/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp +++ b/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp @@ -172,7 +172,7 @@ nsToolbarDragListener :: ItemMouseIsOver ( nsIDOMEvent* aDragEvent, nscoord* out // Now loop through the child and see if the mouse is over a child // - dropAreaFrame->FirstChild(nsnull, &childFrame); + dropAreaFrame->FirstChild(mPresContext, nsnull, &childFrame); while ( childFrame ) { // The mouse coords are in the toolbar's domain diff --git a/mozilla/layout/xul/base/src/nsTreeItemDragCapturer.cpp b/mozilla/layout/xul/base/src/nsTreeItemDragCapturer.cpp index 3ab2af3a1ad..fae0ed1dfda 100644 --- a/mozilla/layout/xul/base/src/nsTreeItemDragCapturer.cpp +++ b/mozilla/layout/xul/base/src/nsTreeItemDragCapturer.cpp @@ -134,7 +134,7 @@ nsTreeItemDragCapturer :: ComputeDropPosition ( nsIDOMEvent* aDragEvent, nscoord // where we need to start computing things from. nsRect rowRect; nsIFrame* rowFrame; - mTreeItem->FirstChild(nsnull, &rowFrame); + mTreeItem->FirstChild(mPresContext, nsnull, &rowFrame); NS_ASSERTION ( rowFrame, "couldn't get rowGroup's row frame" ); rowFrame->GetRect(rowRect); diff --git a/mozilla/layout/xul/base/src/nsTreeOuterFrame.cpp b/mozilla/layout/xul/base/src/nsTreeOuterFrame.cpp index 912c75ef57d..baf7d9aa7cf 100644 --- a/mozilla/layout/xul/base/src/nsTreeOuterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeOuterFrame.cpp @@ -124,7 +124,7 @@ nsTreeOuterFrame::Reflow(nsIPresContext* aPresContext, nsresult rv = nsTableOuterFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); - nsITreeFrame* tree = FindTreeFrame(); + nsITreeFrame* tree = FindTreeFrame(aPresContext); nsTreeFrame* treeFrame = (nsTreeFrame*)tree; if (treeFrame->GetFixedRowSize() != -1) { // The tree had a rows attribute that altered its dimensions. We @@ -224,11 +224,11 @@ nsTreeOuterFrame::FixBadReflowState(const nsHTMLReflowState& aParentReflowState, } nsITreeFrame* -nsTreeOuterFrame::FindTreeFrame() +nsTreeOuterFrame::FindTreeFrame(nsIPresContext* aPresContext) { nsITreeFrame* treeframe; nsIFrame* child; - FirstChild(nsnull, &child); + FirstChild(aPresContext, nsnull, &child); while (child != nsnull) { if (NS_OK == child->QueryInterface(NS_GET_IID(nsITreeFrame), @@ -249,7 +249,7 @@ nsTreeOuterFrame::ScrollByLines(nsIPresContext* aPresContext, PRInt32 lines) // In most cases the TreeFrame will be the only child, but just to make // sure we'll check for the right interface - nsITreeFrame* treeframe = FindTreeFrame(); + nsITreeFrame* treeframe = FindTreeFrame(aPresContext); nsISelfScrollingFrame* ssf; if (treeframe) { @@ -269,7 +269,7 @@ nsTreeOuterFrame::ScrollByPages(nsIPresContext* aPresContext, PRInt32 pages) // In most cases the TreeFrame will be the only child, but just to make // sure we'll check for the right interface - nsITreeFrame* treeframe = FindTreeFrame(); + nsITreeFrame* treeframe = FindTreeFrame(aPresContext); nsISelfScrollingFrame* ssf; if (treeframe) { @@ -289,7 +289,7 @@ nsTreeOuterFrame::CollapseScrollbar(nsIPresContext* aPresContext, PRBool aHide) // In most cases the TreeFrame will be the only child, but just to make // sure we'll check for the right interface - nsITreeFrame* treeframe = FindTreeFrame(); + nsITreeFrame* treeframe = FindTreeFrame(aPresContext); nsISelfScrollingFrame* ssf; if (treeframe) { diff --git a/mozilla/layout/xul/base/src/nsTreeOuterFrame.h b/mozilla/layout/xul/base/src/nsTreeOuterFrame.h index 875f5045a8e..3ca93ec88b4 100644 --- a/mozilla/layout/xul/base/src/nsTreeOuterFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeOuterFrame.h @@ -61,7 +61,7 @@ protected: nsTreeOuterFrame(); virtual ~nsTreeOuterFrame(); - nsITreeFrame* FindTreeFrame(); + nsITreeFrame* FindTreeFrame(nsIPresContext* aPresContext); protected: // Data Members diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp index 6054e1cf2d8..e078137049e 100644 --- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -808,7 +808,7 @@ nsTreeRowGroupFrame::PagedUpDown() } void -nsTreeRowGroupFrame::SetScrollbarFrame(nsIFrame* aFrame) +nsTreeRowGroupFrame::SetScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) { mScrollbar = aFrame; nsFrameList frameList(mScrollbar); @@ -825,7 +825,7 @@ nsTreeRowGroupFrame::SetScrollbarFrame(nsIFrame* aFrame) scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::maxpos, "5000", PR_FALSE); nsIFrame* result; - nsScrollbarButtonFrame::GetChildWithTag(nsXULAtoms::slider, aFrame, result); + nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::slider, aFrame, result); ((nsSliderFrame*)result)->SetScrollbarListener(this); } @@ -864,15 +864,16 @@ nsTreeRowGroupFrame::GetFrameForPoint(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsTreeRowGroupFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const +nsTreeRowGroupFrame::FirstChild(nsIPresContext* aPresContext, + nsIAtom* aListName, + nsIFrame** aFirstChild) const { if (nsXULAtoms::scrollbarlist == aListName) { *aFirstChild = mScrollbarList.FirstChild(); return NS_OK; } - nsTableRowGroupFrame::FirstChild(aListName, aFirstChild); - return NS_OK; + return nsTableRowGroupFrame::FirstChild(aPresContext, aListName, aFirstChild); } NS_IMETHODIMP @@ -1059,7 +1060,7 @@ nsTreeRowGroupFrame::ReflowAfterRowLayout(nsIPresContext* aPresContext, // event manager doesn't send events to the destroyed scrollbar frames nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - ClearFrameRefs(shell, mScrollbar); + ClearFrameRefs(aPresContext, shell, mScrollbar); // Nuke the scrollbar. mFrameConstructor->RemoveMappingsForFrameSubtree(aPresContext, mScrollbar, nsnull); @@ -1701,7 +1702,7 @@ nsTreeRowGroupFrame::CollapseScrollbar(PRBool hide, nsIPresContext* aPresContext // collapse the child nsIFrame* child = nsnull; - frame->FirstChild(nsnull, &child); + frame->FirstChild(aPresContext, nsnull, &child); while (nsnull != child) { @@ -2098,10 +2099,12 @@ nsTreeRowGroupFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIConte void -nsTreeRowGroupFrame::ClearFrameRefs(nsIPresShell *aShell, nsIFrame *aParent) +nsTreeRowGroupFrame::ClearFrameRefs(nsIPresContext* aPresContext, + nsIPresShell *aShell, + nsIFrame *aParent) { nsIFrame* child; - aParent->FirstChild(nsnull,&child); + aParent->FirstChild(aPresContext, nsnull,&child); while (child) { @@ -2114,7 +2117,7 @@ nsTreeRowGroupFrame::ClearFrameRefs(nsIPresShell *aShell, nsIFrame *aParent) child->GetContent(getter_AddRefs(content)); content->SetParent(nsnull); - ClearFrameRefs(aShell, child); + ClearFrameRefs(aPresContext, aShell, child); child->GetNextSibling(&child); } aShell->ClearFrameRefs(aParent); diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h index 708ac59be2f..a0dbbfa831d 100644 --- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h @@ -44,9 +44,11 @@ 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; - void SetScrollbarFrame(nsIFrame* aFrame); + void SetScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* aFrame); void SetFrameConstructor(nsCSSFrameConstructor* aFrameConstructor) { mFrameConstructor = aFrameConstructor; }; void CreateScrollbar(nsIPresContext* aPresContext); @@ -148,7 +150,7 @@ protected: void ComputeTotalRowCount(PRInt32& rowCount, nsIContent* aParent); - static void ClearFrameRefs(nsIPresShell* aPresShell, nsIFrame *aParent); + static void ClearFrameRefs(nsIPresContext* aPresContext, nsIPresShell* aPresShell, nsIFrame *aParent); public: // Helpers that allow access to info. The tree is the primary consumer of this diff --git a/mozilla/rdf/content/src/nsXULTreeElement.cpp b/mozilla/rdf/content/src/nsXULTreeElement.cpp index b483e6e8955..4e505b260b5 100644 --- a/mozilla/rdf/content/src/nsXULTreeElement.cpp +++ b/mozilla/rdf/content/src/nsXULTreeElement.cpp @@ -510,10 +510,12 @@ nsXULTreeElement::EnsureElementIsVisible(nsIDOMXULElement *aElement) shell->GetPrimaryFrameFor(content, &outerFrame); if (outerFrame) { + nsCOMPtr 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) { diff --git a/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp b/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp index 14a04f4053c..3b3aefbd461 100644 --- a/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp +++ b/mozilla/rdf/tests/domds/nsRDFDOMDataSource.cpp @@ -562,9 +562,10 @@ nsRDFDOMDataSource::createFrameArcs(nsIFrame* frame, nsresult rv; nsIFrame *child; nsCOMPtr resource; + nsCOMPtr presContext; // primary child list - frame->FirstChild(nsnull, &child); + frame->FirstChild(nsnull, nsnull, &child); while (child) { rv = getResourceForObject(child, getter_AddRefs(resource)); arcs->AppendElement(resource); @@ -577,7 +578,7 @@ nsRDFDOMDataSource::createFrameArcs(nsIFrame* frame, nsCOMPtr childList; frame->GetAdditionalChildListName(listIndex++, getter_AddRefs(childList)); while (childList) { - rv = frame->FirstChild(childList, &child); + rv = frame->FirstChild(nsnull, childList, &child); while (NS_SUCCEEDED(rv) && (child)) { rv = getResourceForObject(child, getter_AddRefs(resource)); arcs->AppendElement(resource); diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp index 230495e9253..55a82bebc0a 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp @@ -2927,7 +2927,7 @@ static void ShowReport(FILE* out, nsISizeOfHandler* aHandler) //---------------------------------------- static void -GatherFrameDataSizes(nsISizeOfHandler* aHandler, nsIFrame* aFrame) +GatherFrameDataSizes(nsIPresContext* aPresContext, nsISizeOfHandler* aHandler, nsIFrame* aFrame) { if (aFrame) { // Add in the frame @@ -2945,9 +2945,9 @@ GatherFrameDataSizes(nsISizeOfHandler* aHandler, nsIFrame* aFrame) nsIAtom* listName = nsnull; do { nsIFrame* kid; - aFrame->FirstChild(listName, &kid); + aFrame->FirstChild(aPresContext, listName, &kid); while (kid) { - GatherFrameDataSizes(aHandler, kid); + GatherFrameDataSizes(aPresContext, aHandler, kid); kid->GetNextSibling(&kid); } NS_IF_RELEASE(listName); @@ -2963,10 +2963,12 @@ GatherFrameDataSizes(nsISizeOfHandler* aHandler, nsIDocShell* aDocShell) if (nsnull != aDocShell) { nsIPresShell* shell = GetPresShellFor(aDocShell); if (nsnull != shell) { + nsCOMPtr presContext; nsIFrame* root; shell->GetRootFrame(&root); + shell->GetPresContext(getter_AddRefs(presContext)); if (nsnull != root) { - GatherFrameDataSizes(aHandler, root); + GatherFrameDataSizes(presContext, aHandler, root); } NS_RELEASE(shell); }