From bd46e7911f5015f3254ec5739bf12db4740dec0d Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Tue, 26 Oct 1999 04:44:41 +0000 Subject: [PATCH] Changed SetView/GetView to take an additional argument which is the pres context git-svn-id: svn://10.0.0.236/trunk@51822 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsDocument.cpp | 6 +- mozilla/content/base/src/nsGenericElement.cpp | 4 +- mozilla/content/base/src/nsGenericElement.h | 2 +- .../events/src/nsEventStateManager.cpp | 12 +- .../content/events/src/nsEventStateManager.h | 2 +- .../html/content/src/nsGenericHTMLElement.cpp | 23 ++++ .../html/content/src/nsGenericHTMLElement.h | 3 +- .../html/content/src/nsHTMLFormElement.cpp | 5 +- .../html/content/src/nsHTMLInputElement.cpp | 22 +++- .../html/content/src/nsHTMLSelectElement.cpp | 15 ++- .../content/src/nsHTMLTextAreaElement.cpp | 10 +- .../html/document/src/nsHTMLContentSink.cpp | 4 +- mozilla/layout/base/nsCSSFrameConstructor.cpp | 18 +-- mozilla/layout/base/nsCSSRendering.cpp | 10 +- mozilla/layout/base/nsCaret.cpp | 4 +- mozilla/layout/base/nsFrameManager.cpp | 32 ++--- mozilla/layout/base/nsIFrameSelection.h | 4 +- mozilla/layout/base/nsPresShell.cpp | 38 +++--- mozilla/layout/base/public/nsFrameList.h | 2 +- mozilla/layout/base/public/nsIFrame.h | 39 +++++-- mozilla/layout/base/public/nsIFrameManager.h | 8 +- .../layout/base/public/nsIFrameSelection.h | 4 +- mozilla/layout/base/public/nsIStatefulFrame.h | 8 +- mozilla/layout/base/src/nsCaret.cpp | 4 +- mozilla/layout/base/src/nsDocument.cpp | 6 +- .../layout/base/src/nsFrameImageLoader.cpp | 6 +- mozilla/layout/base/src/nsFrameList.cpp | 4 +- mozilla/layout/base/src/nsGenericElement.cpp | 4 +- mozilla/layout/base/src/nsGenericElement.h | 2 +- mozilla/layout/base/src/nsRangeList.cpp | 110 ++++++++++++------ .../layout/events/src/nsEventStateManager.cpp | 12 +- .../layout/events/src/nsEventStateManager.h | 2 +- .../layout/forms/nsButtonFrameRenderer.cpp | 4 +- mozilla/layout/forms/nsButtonFrameRenderer.h | 2 +- .../layout/forms/nsComboboxControlFrame.cpp | 69 +++++------ mozilla/layout/forms/nsComboboxControlFrame.h | 20 ++-- mozilla/layout/forms/nsFieldSetFrame.cpp | 6 +- mozilla/layout/forms/nsFileControlFrame.cpp | 26 +++-- mozilla/layout/forms/nsFileControlFrame.h | 24 +++- mozilla/layout/forms/nsFormControlFrame.cpp | 6 +- mozilla/layout/forms/nsFormControlFrame.h | 4 +- mozilla/layout/forms/nsFormControlHelper.cpp | 4 +- mozilla/layout/forms/nsFormControlHelper.h | 2 +- .../forms/nsGfxCheckboxControlFrame.cpp | 5 +- .../layout/forms/nsGfxCheckboxControlFrame.h | 2 +- .../layout/forms/nsGfxRadioControlFrame.cpp | 4 +- mozilla/layout/forms/nsGfxRadioControlFrame.h | 2 +- .../layout/forms/nsHTMLButtonControlFrame.cpp | 17 +-- .../layout/forms/nsHTMLButtonControlFrame.h | 8 +- mozilla/layout/forms/nsIFormControlFrame.h | 4 +- mozilla/layout/forms/nsIListControlFrame.h | 4 +- mozilla/layout/forms/nsISelectControlFrame.h | 4 +- mozilla/layout/forms/nsImageControlFrame.cpp | 21 ++-- mozilla/layout/forms/nsListControlFrame.cpp | 63 +++++----- mozilla/layout/forms/nsListControlFrame.h | 26 +++-- mozilla/layout/forms/nsSelectsAreaFrame.cpp | 6 +- mozilla/layout/forms/nsSelectsAreaFrame.h | 2 +- mozilla/layout/forms/nsTextControlFrame.cpp | 8 +- mozilla/layout/forms/nsTextControlFrame.h | 8 +- .../generic/nsAbsoluteContainingBlock.cpp | 2 +- mozilla/layout/generic/nsAreaFrame.cpp | 4 +- mozilla/layout/generic/nsBlockFrame.cpp | 69 +++++------ mozilla/layout/generic/nsBlockFrame.h | 6 +- .../layout/generic/nsBlockReflowContext.cpp | 4 +- mozilla/layout/generic/nsBlockReflowState.cpp | 69 +++++------ mozilla/layout/generic/nsBlockReflowState.h | 69 +++++------ mozilla/layout/generic/nsContainerFrame.cpp | 26 +++-- mozilla/layout/generic/nsContainerFrame.h | 10 +- mozilla/layout/generic/nsFirstLetterFrame.cpp | 6 +- mozilla/layout/generic/nsFrame.cpp | 104 +++++++++-------- mozilla/layout/generic/nsFrame.h | 37 +++--- mozilla/layout/generic/nsFrameFrame.cpp | 23 +--- mozilla/layout/generic/nsFrameList.cpp | 4 +- mozilla/layout/generic/nsFrameList.h | 2 +- mozilla/layout/generic/nsFrameSetFrame.cpp | 34 +++--- mozilla/layout/generic/nsFrameSetFrame.h | 5 +- mozilla/layout/generic/nsGfxScrollFrame.cpp | 53 +++++---- mozilla/layout/generic/nsGfxScrollFrame.h | 1 + .../layout/generic/nsHTMLContainerFrame.cpp | 42 +++---- mozilla/layout/generic/nsHTMLContainerFrame.h | 7 +- mozilla/layout/generic/nsHTMLFrame.cpp | 14 +-- mozilla/layout/generic/nsIFrame.h | 39 +++++-- mozilla/layout/generic/nsIStatefulFrame.h | 8 +- mozilla/layout/generic/nsImageFrame.cpp | 6 +- mozilla/layout/generic/nsInlineFrame.cpp | 6 +- mozilla/layout/generic/nsLineBox.cpp | 4 +- mozilla/layout/generic/nsLineBox.h | 2 +- mozilla/layout/generic/nsLineLayout.cpp | 18 +-- mozilla/layout/generic/nsObjectFrame.cpp | 39 ++++--- mozilla/layout/generic/nsPageFrame.cpp | 4 +- mozilla/layout/generic/nsPlaceholderFrame.cpp | 4 +- mozilla/layout/generic/nsPlaceholderFrame.h | 2 +- .../layout/generic/nsSimplePageSequence.cpp | 8 +- mozilla/layout/generic/nsTextFrame.cpp | 87 +++++++++----- mozilla/layout/generic/nsViewportFrame.cpp | 8 +- .../base/src/nsAbsoluteContainingBlock.cpp | 2 +- mozilla/layout/html/base/src/nsAreaFrame.cpp | 4 +- mozilla/layout/html/base/src/nsBlockFrame.cpp | 69 +++++------ mozilla/layout/html/base/src/nsBlockFrame.h | 6 +- .../html/base/src/nsBlockReflowContext.cpp | 4 +- .../html/base/src/nsBlockReflowState.cpp | 69 +++++------ .../layout/html/base/src/nsBlockReflowState.h | 69 +++++------ .../layout/html/base/src/nsContainerFrame.cpp | 26 +++-- .../layout/html/base/src/nsContainerFrame.h | 10 +- .../html/base/src/nsFirstLetterFrame.cpp | 6 +- mozilla/layout/html/base/src/nsFrame.cpp | 104 +++++++++-------- mozilla/layout/html/base/src/nsFrame.h | 37 +++--- .../layout/html/base/src/nsFrameManager.cpp | 32 ++--- .../layout/html/base/src/nsGfxScrollFrame.cpp | 53 +++++---- .../layout/html/base/src/nsGfxScrollFrame.h | 1 + .../html/base/src/nsHTMLContainerFrame.cpp | 42 +++---- .../html/base/src/nsHTMLContainerFrame.h | 7 +- mozilla/layout/html/base/src/nsHTMLFrame.cpp | 14 +-- mozilla/layout/html/base/src/nsImageFrame.cpp | 6 +- .../layout/html/base/src/nsInlineFrame.cpp | 6 +- mozilla/layout/html/base/src/nsLineBox.cpp | 4 +- mozilla/layout/html/base/src/nsLineBox.h | 2 +- mozilla/layout/html/base/src/nsLineLayout.cpp | 18 +-- .../layout/html/base/src/nsObjectFrame.cpp | 39 ++++--- mozilla/layout/html/base/src/nsPageFrame.cpp | 4 +- .../html/base/src/nsPlaceholderFrame.cpp | 4 +- .../layout/html/base/src/nsPlaceholderFrame.h | 2 +- mozilla/layout/html/base/src/nsPresShell.cpp | 38 +++--- .../layout/html/base/src/nsScrollFrame.cpp | 24 ++-- mozilla/layout/html/base/src/nsScrollFrame.h | 4 +- .../html/base/src/nsScrollPortFrame.cpp | 20 ++-- .../layout/html/base/src/nsScrollPortFrame.h | 4 +- .../html/base/src/nsSelectsAreaFrame.cpp | 6 +- .../layout/html/base/src/nsSelectsAreaFrame.h | 2 +- .../html/base/src/nsSimplePageSequence.cpp | 8 +- mozilla/layout/html/base/src/nsTextFrame.cpp | 87 +++++++++----- .../layout/html/base/src/nsViewportFrame.cpp | 8 +- .../html/content/src/nsGenericHTMLElement.cpp | 23 ++++ .../html/content/src/nsGenericHTMLElement.h | 3 +- .../html/content/src/nsHTMLFormElement.cpp | 5 +- .../html/content/src/nsHTMLInputElement.cpp | 22 +++- .../html/content/src/nsHTMLSelectElement.cpp | 15 ++- .../content/src/nsHTMLTextAreaElement.cpp | 10 +- .../layout/html/document/src/nsFrameFrame.cpp | 23 +--- .../html/document/src/nsFrameSetFrame.cpp | 34 +++--- .../html/document/src/nsFrameSetFrame.h | 5 +- .../html/document/src/nsHTMLContentSink.cpp | 4 +- .../html/forms/public/nsIFormControlFrame.h | 4 +- .../layout/html/forms/public/nsIFormManager.h | 2 +- .../html/forms/public/nsIListControlFrame.h | 4 +- .../html/forms/public/nsISelectControlFrame.h | 4 +- .../html/forms/src/nsButtonControlFrame.cpp | 6 +- .../html/forms/src/nsButtonControlFrame.h | 2 +- .../html/forms/src/nsButtonFrameRenderer.cpp | 4 +- .../html/forms/src/nsButtonFrameRenderer.h | 2 +- .../html/forms/src/nsCheckboxControlFrame.cpp | 43 ++++--- .../html/forms/src/nsCheckboxControlFrame.h | 18 +-- .../html/forms/src/nsComboboxControlFrame.cpp | 69 +++++------ .../html/forms/src/nsComboboxControlFrame.h | 20 ++-- .../layout/html/forms/src/nsFieldSetFrame.cpp | 6 +- .../html/forms/src/nsFileControlFrame.cpp | 26 +++-- .../html/forms/src/nsFileControlFrame.h | 24 +++- .../html/forms/src/nsFormControlFrame.cpp | 6 +- .../html/forms/src/nsFormControlFrame.h | 4 +- .../html/forms/src/nsFormControlHelper.cpp | 4 +- .../html/forms/src/nsFormControlHelper.h | 2 +- mozilla/layout/html/forms/src/nsFormFrame.cpp | 16 +-- mozilla/layout/html/forms/src/nsFormFrame.h | 6 +- .../forms/src/nsGfxAutoTextControlFrame.cpp | 6 +- .../forms/src/nsGfxAutoTextControlFrame.h | 2 +- .../forms/src/nsGfxCheckboxControlFrame.cpp | 5 +- .../forms/src/nsGfxCheckboxControlFrame.h | 2 +- .../html/forms/src/nsGfxRadioControlFrame.cpp | 4 +- .../html/forms/src/nsGfxRadioControlFrame.h | 2 +- .../html/forms/src/nsGfxTextControlFrame.cpp | 14 +-- .../html/forms/src/nsGfxTextControlFrame.h | 4 +- .../forms/src/nsHTMLButtonControlFrame.cpp | 17 +-- .../html/forms/src/nsHTMLButtonControlFrame.h | 8 +- .../html/forms/src/nsImageControlFrame.cpp | 21 ++-- .../layout/html/forms/src/nsLabelFrame.cpp | 24 ++-- .../html/forms/src/nsListControlFrame.cpp | 63 +++++----- .../html/forms/src/nsListControlFrame.h | 26 +++-- .../forms/src/nsNativeCheckboxControlFram.cpp | 2 +- .../forms/src/nsNativeCheckboxControlFram.h | 2 +- .../forms/src/nsNativeFormControlFrame.cpp | 10 +- .../forms/src/nsNativeRadioControlFrame.cpp | 4 +- .../forms/src/nsNativeRadioControlFrame.h | 2 +- .../forms/src/nsNativeSelectControlFrame.cpp | 30 ++--- .../forms/src/nsNativeTextControlFrame.cpp | 6 +- .../html/forms/src/nsNativeTextControlFrame.h | 2 +- .../html/forms/src/nsRadioControlFrame.cpp | 35 +++--- .../html/forms/src/nsRadioControlFrame.h | 14 +-- .../html/forms/src/nsTextControlFrame.cpp | 8 +- .../html/forms/src/nsTextControlFrame.h | 8 +- .../html/style/src/nsCSSFrameConstructor.cpp | 18 +-- .../layout/html/style/src/nsCSSRendering.cpp | 10 +- .../html/table/src/nsTableCellFrame.cpp | 13 ++- .../layout/html/table/src/nsTableCellFrame.h | 7 +- .../html/table/src/nsTableColGroupFrame.cpp | 2 +- .../layout/html/table/src/nsTableFrame.cpp | 61 +++++----- mozilla/layout/html/table/src/nsTableFrame.h | 7 +- .../html/table/src/nsTableOuterFrame.cpp | 41 ++++--- .../layout/html/table/src/nsTableOuterFrame.h | 8 +- .../layout/html/table/src/nsTableRowFrame.cpp | 12 +- .../html/table/src/nsTableRowGroupFrame.cpp | 30 ++--- .../html/table/src/nsTableRowGroupFrame.h | 2 +- mozilla/layout/tables/nsTableCellFrame.cpp | 13 ++- mozilla/layout/tables/nsTableCellFrame.h | 7 +- .../layout/tables/nsTableColGroupFrame.cpp | 2 +- mozilla/layout/tables/nsTableFrame.cpp | 61 +++++----- mozilla/layout/tables/nsTableFrame.h | 7 +- mozilla/layout/tables/nsTableOuterFrame.cpp | 41 ++++--- mozilla/layout/tables/nsTableOuterFrame.h | 8 +- mozilla/layout/tables/nsTableRowFrame.cpp | 12 +- .../layout/tables/nsTableRowGroupFrame.cpp | 30 ++--- mozilla/layout/tables/nsTableRowGroupFrame.h | 2 +- mozilla/layout/xul/base/src/nsBoxFrame.cpp | 27 ++--- mozilla/layout/xul/base/src/nsBoxFrame.h | 5 +- mozilla/layout/xul/base/src/nsDeckFrame.cpp | 9 +- mozilla/layout/xul/base/src/nsDeckFrame.h | 3 +- .../layout/xul/base/src/nsMenuBarFrame.cpp | 5 +- mozilla/layout/xul/base/src/nsMenuBarFrame.h | 3 + mozilla/layout/xul/base/src/nsMenuFrame.cpp | 7 +- mozilla/layout/xul/base/src/nsMenuFrame.h | 3 +- .../layout/xul/base/src/nsMenuPopupFrame.cpp | 35 +++--- .../layout/xul/base/src/nsMenuPopupFrame.h | 8 +- .../layout/xul/base/src/nsPopupSetFrame.cpp | 2 +- .../xul/base/src/nsProgressMeterFrame.cpp | 59 ++++++++-- .../layout/xul/base/src/nsScrollbarFrame.cpp | 2 +- mozilla/layout/xul/base/src/nsSliderFrame.cpp | 33 +++--- mozilla/layout/xul/base/src/nsSliderFrame.h | 10 +- .../layout/xul/base/src/nsSplitterFrame.cpp | 54 +++++---- mozilla/layout/xul/base/src/nsSplitterFrame.h | 4 +- .../xul/base/src/nsTitledButtonFrame.cpp | 6 +- .../layout/xul/base/src/nsToolbarFrame.cpp | 14 ++- mozilla/layout/xul/base/src/nsToolbarFrame.h | 3 +- .../layout/xul/base/src/nsToolboxFrame.cpp | 33 +++--- mozilla/layout/xul/base/src/nsToolboxFrame.h | 11 +- .../layout/xul/base/src/nsTreeCellFrame.cpp | 9 +- mozilla/layout/xul/base/src/nsTreeCellFrame.h | 3 +- .../layout/xul/base/src/nsTreeRowFrame.cpp | 13 ++- mozilla/layout/xul/base/src/nsTreeRowFrame.h | 5 +- .../xul/base/src/nsTreeRowGroupFrame.cpp | 14 ++- .../layout/xul/base/src/nsTreeRowGroupFrame.h | 2 +- .../webshell/tests/viewer/nsBrowserWindow.cpp | 6 +- 240 files changed, 2258 insertions(+), 1704 deletions(-) diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index b0767f4baaa..aaf10357958 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -1920,9 +1920,11 @@ nsDocument::GetPixelDimensions(nsIPresShell* aShell, result = aShell->GetPrimaryFrameFor(mRootContent, &frame); if (NS_SUCCEEDED(result) && frame) { - nsIView* view; + nsIView* view; + nsCOMPtr presContext; - result = frame->GetView(&view); + aShell->GetPresContext(getter_AddRefs(presContext)); + result = frame->GetView(presContext, &view); if (NS_SUCCEEDED(result)) { // If we have a view check if it's scrollable. If not, // just use the view size itself diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index 085ed61d738..cd27a3c01b2 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -901,7 +901,7 @@ nsGenericElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult, //---------------------------------------------------------------------- nsresult -nsGenericElement::RenderFrame() +nsGenericElement::RenderFrame(nsIPresContext* aPresContext) { nsPoint offset; nsRect bounds; @@ -925,7 +925,7 @@ nsGenericElement::RenderFrame() // XXX We should tell the frame the damage area and let it invalidate // itself. Add some API calls to nsIFrame to allow a caller to invalidate // parts of the frame... - frame->GetOffsetFromView(offset, &view); + frame->GetOffsetFromView(aPresContext, offset, &view); view->GetViewManager(vm); bounds.x += offset.x; bounds.y += offset.y; diff --git a/mozilla/content/base/src/nsGenericElement.h b/mozilla/content/base/src/nsGenericElement.h index 02dea28d678..1b4a029b158 100644 --- a/mozilla/content/base/src/nsGenericElement.h +++ b/mozilla/content/base/src/nsGenericElement.h @@ -184,7 +184,7 @@ public: //---------------------------------------- - nsresult RenderFrame(); + nsresult RenderFrame(nsIPresContext*); nsresult AddScriptEventListener(nsIAtom* aAttribute, const nsString& aValue, diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 8a5d6ec2db0..207b4a50d18 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -648,7 +648,7 @@ nsEventStateManager::UpdateCursor(nsIPresContext& aPresContext, nsPoint& aPoint, } nsIWidget* window; - aTargetFrame->GetWindow(&window); + aTargetFrame->GetWindow(&aPresContext, &window); window->SetCursor(c); NS_RELEASE(window); } @@ -1378,7 +1378,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState) } if ((aState & NS_EVENT_STATE_FOCUS) && (aContent != mCurrentFocus)) { - SendFocusBlur(aContent); + SendFocusBlur(mPresContext, aContent); //transferring ref to notifyContent from mCurrentFocus notifyContent[3] = mCurrentFocus; @@ -1468,7 +1468,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState) } NS_IMETHODIMP -nsEventStateManager::SendFocusBlur(nsIContent *aContent) +nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent) { if (mCurrentFocus == aContent) { return NS_OK; @@ -1543,7 +1543,7 @@ nsEventStateManager::SendFocusBlur(nsIContent *aContent) PRBool shouldSetFocusOnWindow = PR_TRUE; if (nsnull != currentFocusFrame) { nsIView * view = nsnull; - currentFocusFrame->GetView(&view); + currentFocusFrame->GetView(aPresContext, &view); if (view != nsnull) { nsIWidget *window = nsnull; view->GetWidget(window); @@ -1563,10 +1563,10 @@ nsEventStateManager::SendFocusBlur(nsIContent *aContent) // then click on a gfx control (generates another focus event) if (shouldSetFocusOnWindow && nsnull != currentFocusFrame) { nsIFrame * parentFrame; - currentFocusFrame->GetParentWithView(&parentFrame); + currentFocusFrame->GetParentWithView(aPresContext, &parentFrame); if (nsnull != parentFrame) { nsIView * pView; - parentFrame->GetView(&pView); + parentFrame->GetView(aPresContext, &pView); if (nsnull != pView) { nsIWidget *window = nsnull; diff --git a/mozilla/content/events/src/nsEventStateManager.h b/mozilla/content/events/src/nsEventStateManager.h index 057e5d95f5f..899a9f64634 100644 --- a/mozilla/content/events/src/nsEventStateManager.h +++ b/mozilla/content/events/src/nsEventStateManager.h @@ -72,7 +72,7 @@ protected: void ShiftFocus(PRBool foward); nsIContent* GetNextTabbableContent(nsIContent* aParent, nsIContent* aChild, nsIContent* aTop, PRBool foward); PRInt32 GetNextTabIndex(nsIContent* aParent, PRBool foward); - NS_IMETHOD SendFocusBlur(nsIContent *aContent); + NS_IMETHOD SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent); nsIScrollableView* GetNearestScrollingView(nsIView* aView); // routines for the d&d gesture tracking state machine diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index a56bdc117fb..b0dccec25e3 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -1608,6 +1608,29 @@ nsGenericHTMLElement::GetPrimaryFrame(nsIHTMLContent* aContent, return res; } + +// XXX This creates a dependency between content and frames +nsresult +nsGenericHTMLElement::GetPresContext(nsIHTMLContent* aContent, + nsIPresContext** aPresContext) +{ + nsIDocument* doc = nsnull; + nsresult res = NS_NOINTERFACE; + // Get the document + if (NS_OK == aContent->GetDocument(doc)) { + if (nsnull != doc) { + // Get presentation shell 0 + nsIPresShell* presShell = doc->GetShellAt(0); + if (nsnull != presShell) { + res = presShell->GetPresContext(aPresContext); + NS_RELEASE(presShell); + } + NS_RELEASE(doc); + } + } + + return res; +} // XXX check all mappings against ebina's usage static nsGenericHTMLElement::EnumTable kAlignTable[] = { diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index c8eb19e7962..0bbd6b2954c 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -277,9 +277,10 @@ public: static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute, PRInt32& aHint); - //XXX This creates a dependency between content and frames + //XXX These two creates a dependency between content and frames static nsresult GetPrimaryFrame(nsIHTMLContent* aContent, nsIFormControlFrame *&aFormControlFrame); + static nsresult GetPresContext(nsIHTMLContent* aContent, nsIPresContext** aPresContext); static nsresult GetBaseURL(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp index ab27e876903..f5b52c4d181 100644 --- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp @@ -341,7 +341,10 @@ nsHTMLFormElement::Reset() nsIFormManager* formMan = nsnull; res = frame->QueryInterface(kIFormManagerIID, (void**)&formMan); if (NS_SUCCEEDED(res) && formMan) { - res = formMan->OnReset(); + nsCOMPtr presContext; + shell->GetPresContext(getter_AddRefs(presContext)); + + res = formMan->OnReset(presContext); } } NS_RELEASE(shell); diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index a077b96975c..c96706d4b79 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -358,7 +358,10 @@ nsHTMLInputElement::SetValue(const nsString& aValue) nsIFormControlFrame* formControlFrame = nsnull; if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::value, aValue); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue); + NS_IF_RELEASE(presContext); } return NS_OK; } @@ -396,7 +399,10 @@ nsHTMLInputElement::SetAutocomplete(const nsString& aAutocomplete) nsIFormControlFrame* formControlFrame = nsnull; if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::autocomplete, aAutocomplete); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::autocomplete, aAutocomplete); + NS_IF_RELEASE(presContext); } } } @@ -426,12 +432,15 @@ nsHTMLInputElement::SetChecked(PRBool aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); if (PR_TRUE == aValue) { - formControlFrame->SetProperty(nsHTMLAtoms::checked, "1"); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, "1"); } else { - formControlFrame->SetProperty(nsHTMLAtoms::checked, "0"); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, "0"); } + NS_IF_RELEASE(presContext); } return NS_OK; } @@ -518,7 +527,10 @@ nsHTMLInputElement::Select() nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame); if (NS_SUCCEEDED(rv)) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::select, ""); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); + NS_IF_RELEASE(presContext); return NS_OK; } } diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp index 478f5747255..cc2fd21caa8 100644 --- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp @@ -485,7 +485,10 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aValue) if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { nsString value; value.Append(aValue, 10); - formControlFrame->SetProperty(nsHTMLAtoms::selectedindex, value); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value); + NS_IF_RELEASE(presContext); } return NS_OK; } @@ -654,7 +657,10 @@ nsHTMLSelectElement::AddOption(nsIContent* aContent) nsISelectControlFrame* selectFrame = nsnull; result = fcFrame->QueryInterface(nsISelectControlFrame::GetIID(),(void **) &selectFrame); if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) { - result = selectFrame->AddOption(mOptions->IndexOf(aContent)); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + result = selectFrame->AddOption(presContext, mOptions->IndexOf(aContent)); + NS_IF_RELEASE(presContext); } } @@ -683,7 +689,10 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent) // We can't get our index if we've already been replaced in the OptionList. // If we couldn't get our index, pass -1, remove all options and recreate // Coincidentally, IndexOf returns -1 if the option isn't found in the list - result = selectFrame->RemoveOption(oldIndex); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + result = selectFrame->RemoveOption(presContext, oldIndex); + NS_IF_RELEASE(presContext); } } diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index 446b58e700c..783fb2b552e 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -291,7 +291,10 @@ nsHTMLTextAreaElement::Select() nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame); if (NS_SUCCEEDED(rv)) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::select, ""); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); + NS_IF_RELEASE(presContext); return NS_OK; } } @@ -332,7 +335,10 @@ nsHTMLTextAreaElement::SetValue(const nsString& aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { - formControlFrame->SetProperty(nsHTMLAtoms::value, aValue); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue); + NS_IF_RELEASE(presContext); } return NS_OK; } diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index ab7f05a93d2..5cc16154139 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -2552,7 +2552,9 @@ HTMLContentSink::ScrollToRef() // coordinates that are relative to that. nsPoint offset; nsIView* view; - frame->GetOffsetFromView(offset, &view); + nsCOMPtr presContext; + shell->GetPresContext(getter_AddRefs(presContext)); + frame->GetOffsetFromView(presContext, offset, &view); nscoord x = 0; nscoord y = offset.y; sview->SetScrollPreference(mOriginalScrollPreference); diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index d5d37868731..69bd7ce9bc9 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -2258,12 +2258,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresContext* aPresCo nsIView* view; if (IsScrollable(aPresContext, display)) { - contentFrame->GetView(&view); + contentFrame->GetView(aPresContext, &view); } else { nsIFrame* parentFrame; contentFrame->GetParent(&parentFrame); - parentFrame->GetView(&view); + parentFrame->GetView(aPresContext, &view); } NS_ASSERTION(view, "expected a view"); @@ -2635,7 +2635,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext, nsIView* rootView; viewManager->GetRootView(rootView); - viewportFrame->SetView(rootView); + viewportFrame->SetView(aPresContext, rootView); // The viewport is the containing block for 'fixed' elements mFixedContainingBlock = viewportFrame; @@ -2751,7 +2751,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext, // Inform the view manager about the root scrollable view // get the scrolling view nsIView* view = nsnull; - newScrollableFrame->GetView(&view); + newScrollableFrame->GetView(aPresContext, &view); nsIScrollableView* scrollableView; view->QueryInterface(kScrollViewIID, (void**)&scrollableView); viewManager->SetRootScrollableView(scrollableView); @@ -3410,7 +3410,7 @@ nsresult rv = NS_OK; // XXX: We should replace this with a real widget manager similar // to how the nsFormControlFrame works. Re-directing events is a temporary Kludge. nsIView *listView; - listFrame->GetView(&listView); + listFrame->GetView(aPresContext, &listView); NS_ASSERTION(nsnull != listView,"ListFrame's view is nsnull"); //listView->SetViewFlags(NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN); @@ -3458,7 +3458,7 @@ nsresult rv = NS_OK; // to how the nsFormControlFrame works. // Re-directing events is a temporary Kludge. nsIView *listView; - listFrame->GetView(&listView); + listFrame->GetView(aPresContext, &listView); NS_ASSERTION(nsnull != listView,"ListFrame's view is nsnull"); //listView->SetViewFlags(NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN); aFrameHasBeenInitialized = PR_TRUE; @@ -7197,7 +7197,7 @@ UpdateViewsForTree(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIViewManager* aViewManager, nsRect& aBoundsRect) { nsIView* view; - aFrame->GetView(&view); + aFrame->GetView(&aPresContext, &view); if (view) { SyncAndInvalidateView(view, aFrame, aViewManager); @@ -7273,10 +7273,10 @@ ApplyRenderingChangeToTree(nsIPresContext& aPresContext, // (adjusting r's coordinate system to reflect the nesting) and // update there. nsIView* view = nsnull; - aFrame->GetView(&view); + aFrame->GetView(&aPresContext, &view); nsIView* parentView; if (! view) { // XXX can view have children outside it? - aFrame->GetOffsetFromView(viewOffset, &parentView); + aFrame->GetOffsetFromView(&aPresContext, viewOffset, &parentView); NS_ASSERTION(nsnull != parentView, "no view"); if (! viewManager) { parentView->GetViewManager(viewManager); diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 4d28aa8488f..8c46101f35d 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -1816,14 +1816,14 @@ ComputeBackgroundAnchorPoint(const nsStyleColor& aColor, // Returns the clip view associated with the scroll frame's scrolling // view static const nsIView* -GetClipView(nsIFrame* aScrollFrame) +GetClipView(nsIPresContext* aPresContext, nsIFrame* aScrollFrame) { nsIView* view; nsIScrollableView* scrollingView; const nsIView* clipView; // Get the scrolling view - aScrollFrame->GetView(&view); + aScrollFrame->GetView(aPresContext, &view); view->QueryInterface(kScrollViewIID, (void**)&scrollingView); // Get the clip view @@ -1968,7 +1968,7 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, scrollFrame = GetNearestScrollFrame(aForFrame); // Get the viewport size - clipView = GetClipView(scrollFrame); + clipView = GetClipView(&aPresContext, scrollFrame); clipView->GetDimensions(&viewportArea.width, &viewportArea.height); } @@ -1987,10 +1987,10 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, if (NS_STYLE_BG_ATTACHMENT_FIXED == aColor.mBackgroundAttachment) { nsIView* view; - aForFrame->GetView(&view); + aForFrame->GetView(&aPresContext, &view); if (!view) { nsPoint offset; - aForFrame->GetOffsetFromView(offset, &view); + aForFrame->GetOffsetFromView(&aPresContext, offset, &view); anchor -= offset; } NS_ASSERTION(view, "expected a view"); diff --git a/mozilla/layout/base/nsCaret.cpp b/mozilla/layout/base/nsCaret.cpp index 2a56277eb85..e9bf1ffb623 100644 --- a/mozilla/layout/base/nsCaret.cpp +++ b/mozilla/layout/base/nsCaret.cpp @@ -459,7 +459,9 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy nsIView* theView = nsnull; NS_ASSERTION(caretFrame, "Should have frame here"); - caretFrame->GetOffsetFromView(viewOffset, &theView); + nsCOMPtr presContext; + mPresShell->GetPresContext(getter_AddRefs(presContext)); + caretFrame->GetOffsetFromView(presContext, viewOffset, &theView); if (theView == nsnull) return; nsIView* returnView = nsnull; diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 9df2b73cc88..4fd2442ba7c 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -222,8 +222,12 @@ public: PRInt32 aMinChange, PRInt32& aTopLevelChange); - NS_IMETHOD CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState); - NS_IMETHOD RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState); + NS_IMETHOD CaptureFrameState(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsILayoutHistoryState* aState); + NS_IMETHOD RestoreFrameState(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsILayoutHistoryState* aState); // Gets and sets properties on a given frame NS_IMETHOD GetFrameProperty(nsIFrame* aFrame, @@ -1350,7 +1354,7 @@ FrameManager::ComputeStyleChangeFor(nsIPresContext& aPresContext, static nsresult -CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) +CaptureFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); @@ -1370,10 +1374,10 @@ CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) rv = content->GetContentID(&ID); if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content) nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType; - rv = statefulFrame->GetStateType(&type); + rv = statefulFrame->GetStateType(aPresContext, &type); if (NS_SUCCEEDED(rv)) { nsISupports* frameState; - rv = statefulFrame->SaveState(&frameState); + rv = statefulFrame->SaveState(aPresContext, &frameState); if (NS_SUCCEEDED(rv)) { rv = aState->AddState(ID, frameState, type); } @@ -1386,12 +1390,12 @@ CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) } NS_IMETHODIMP -FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) +FrameManager::CaptureFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); - rv = CaptureFrameStateFor(aFrame, aState); + rv = CaptureFrameStateFor(aPresContext, aFrame, aState); // Now capture state recursively for the frame hierarchy rooted at aFrame nsIAtom* childListName = nsnull; @@ -1400,7 +1404,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) nsIFrame* childFrame; aFrame->FirstChild(childListName, &childFrame); while (childFrame) { - rv = CaptureFrameState(childFrame, aState); + rv = CaptureFrameState(aPresContext, childFrame, aState); // Get the next sibling child frame childFrame->GetNextSibling(&childFrame); } @@ -1412,7 +1416,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) } static nsresult -RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) +RestoreFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); @@ -1431,12 +1435,12 @@ RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) rv = content->GetContentID(&ID); if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content) nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType; - rv = statefulFrame->GetStateType(&type); + rv = statefulFrame->GetStateType(aPresContext, &type); if (NS_SUCCEEDED(rv)) { nsISupports* frameState = nsnull; rv = aState->GetState(ID, &frameState, type); if (NS_SUCCEEDED(rv) && nsnull != frameState) { - rv = statefulFrame->RestoreState(frameState); + rv = statefulFrame->RestoreState(aPresContext, frameState); } } } @@ -1447,12 +1451,12 @@ RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) } NS_IMETHODIMP -FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) +FrameManager::RestoreFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); - rv = RestoreFrameStateFor(aFrame, aState); + rv = RestoreFrameStateFor(aPresContext, aFrame, aState); // Now restore state recursively for the frame hierarchy rooted at aFrame nsIAtom* childListName = nsnull; @@ -1461,7 +1465,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) nsIFrame* childFrame; aFrame->FirstChild(childListName, &childFrame); while (childFrame) { - rv = RestoreFrameState(childFrame, aState); + rv = RestoreFrameState(aPresContext, childFrame, aState); // Get the next sibling child frame childFrame->GetNextSibling(&childFrame); } diff --git a/mozilla/layout/base/nsIFrameSelection.h b/mozilla/layout/base/nsIFrameSelection.h index 615a56805ea..a504fa2cfbd 100644 --- a/mozilla/layout/base/nsIFrameSelection.h +++ b/mozilla/layout/base/nsIFrameSelection.h @@ -124,7 +124,7 @@ public: * @param aGuiEvent is the event that should be dealt with by aFocusFrame * @param aFrame is the frame that MAY handle the event */ - NS_IMETHOD HandleKeyEvent(nsGUIEvent *aGuiEvent) = 0; + NS_IMETHOD HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) = 0; /** HandleClick will take the focus to the new frame at the new offset and * will either extend the selection from the old anchor, or replace the old anchor. @@ -210,7 +210,7 @@ public: * specified by aSelectionType. * @param aSelectionType enum value defined in nsIDOMSelection for the domseleciton you want. */ - NS_IMETHOD RepaintSelection(SelectionType aSelectionType)=0; + NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aSelectionType)=0; /** GetFrameForNodeOffset given a node and its child offset, return the nsIFrame and * the offset into that frame. diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index a85f1fa5a52..7d8f825ded5 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -830,7 +830,7 @@ PresShell::RepaintSelection(SelectionType aType) if (!mSelection) return NS_ERROR_NULL_POINTER; - return mSelection->RepaintSelection(aType); + return mSelection->RepaintSelection(mPresContext, aType); } NS_IMETHODIMP @@ -949,7 +949,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) if (NS_OK == rootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(desiredSize.width, desiredSize.height); + rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height)); #ifdef NS_DEBUG @@ -1029,7 +1029,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) if (NS_OK == rootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(desiredSize.width, desiredSize.height); + rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG if (nsIFrame::GetVerifyTreeEnable()) { rootFrame->VerifyTree(); @@ -1209,7 +1209,7 @@ PresShell::StyleChangeReflow() if (NS_OK == rootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(desiredSize.width, desiredSize.height); + rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG if (nsIFrame::GetVerifyTreeEnable()) { rootFrame->VerifyTree(); @@ -1505,10 +1505,10 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame, nsPoint pt; nsresult rv; - aFrame->GetView(&view); + aFrame->GetView(mPresContext, &view); if (nsnull == view) - aFrame->GetOffsetFromView(pt, &view); + aFrame->GetOffsetFromView(mPresContext, pt, &view); while (nsnull != view) { @@ -1614,7 +1614,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, // Determine the offset from aFrame to the scrolled view. We do that by // getting the offset from its closest view and then walking up scrollingView->GetScrolledView(scrolledView); - aFrame->GetOffsetFromView(offset, &closestView); + aFrame->GetOffsetFromView(mPresContext, offset, &closestView); // XXX Deal with the case where there is a scrolled element, e.g., a // DIV in the middle... @@ -1784,7 +1784,7 @@ PresShell::GetHistoryState(nsILayoutHistoryState** aState) rv = GetRootFrame(&rootFrame); if (NS_FAILED(rv) || nsnull == rootFrame) return rv; - rv = mFrameManager->CaptureFrameState(rootFrame, *aState); + rv = mFrameManager->CaptureFrameState(mPresContext, rootFrame, *aState); return rv; } @@ -1855,7 +1855,7 @@ PresShell::ContentAppended(nsIDocument *aDocument, nsIFrame* frame; rv = GetPrimaryFrameFor(aContainer, &frame); if (NS_SUCCEEDED(rv) && nsnull != frame) - mFrameManager->RestoreFrameState(frame, mHistoryState); + mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState); } RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this)); @@ -2149,7 +2149,7 @@ PresShell::HandleEvent(nsIView *aView, if (mSelection && aEvent->eventStructType == NS_KEY_EVENT) {//KEY HANDLERS WILL GET RID OF THIS - if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(aEvent))) + if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent))) { return NS_OK; } @@ -2176,10 +2176,10 @@ PresShell::HandleEvent(nsIView *aView, manager->GetFocusedContent(&focusContent); if (focusContent) GetPrimaryFrameFor(focusContent, &mCurrentEventFrame); - else frame->GetFrameForPoint(aEvent->point, &mCurrentEventFrame); + else frame->GetFrameForPoint(mPresContext, aEvent->point, &mCurrentEventFrame); } else { - frame->GetFrameForPoint(aEvent->point, &mCurrentEventFrame); + frame->GetFrameForPoint(mPresContext, aEvent->point, &mCurrentEventFrame); } NS_IF_RELEASE(mCurrentEventContent); if (GetCurrentEventFrame() || focusContent) { @@ -2316,7 +2316,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, } static PRBool -CompareTrees(nsIFrame* aA, nsIFrame* aB) +CompareTrees(nsIPresContext* aPresContext, nsIFrame* aA, nsIFrame* aB) { PRBool ok = PR_TRUE; nsIAtom* listName = nsnull; @@ -2359,8 +2359,8 @@ CompareTrees(nsIFrame* aA, nsIFrame* aB) // do have views, make sure the views are the same size. If the // views have widgets, make sure they both do or neither does. If // they do, make sure the widgets are the same size. - k1->GetView(&v1); - k2->GetView(&v2); + k1->GetView(aPresContext, &v1); + k2->GetView(aPresContext, &v2); if (((nsnull == v1) && (nsnull != v2)) || ((nsnull != v1) && (nsnull == v2))) { ok = PR_FALSE; @@ -2393,7 +2393,7 @@ CompareTrees(nsIFrame* aA, nsIFrame* aB) } // Compare the sub-trees too - if (!CompareTrees(k1, k2)) { + if (!CompareTrees(aPresContext, k1, k2)) { ok = PR_FALSE; if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) { break; @@ -2640,12 +2640,12 @@ PresShell::VerifyIncrementalReflow() root1 = FindTopFrame(root1); root2 = FindTopFrame(root2); #endif - PRBool ok = CompareTrees(root1, root2); + PRBool ok = CompareTrees(mPresContext, root1, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { printf("Verify reflow failed, primary tree:\n"); - root1->List(stdout, 0); + root1->List(mPresContext, stdout, 0); printf("Verification tree:\n"); - root2->List(stdout, 0); + root2->List(mPresContext, stdout, 0); } // printf("Incremental reflow doomed view tree:\n"); diff --git a/mozilla/layout/base/public/nsFrameList.h b/mozilla/layout/base/public/nsFrameList.h index 1dd0a8aa07a..cac6933c36b 100644 --- a/mozilla/layout/base/public/nsFrameList.h +++ b/mozilla/layout/base/public/nsFrameList.h @@ -121,7 +121,7 @@ public: void VerifyParent(nsIFrame* aParent) const; - void List(FILE* out) const; + void List(nsIPresContext* aPresContext, FILE* out) const; protected: nsIFrame* mFirstChild; diff --git a/mozilla/layout/base/public/nsIFrame.h b/mozilla/layout/base/public/nsIFrame.h index 9197fd64c90..7e92977db80 100644 --- a/mozilla/layout/base/public/nsIFrame.h +++ b/mozilla/layout/base/public/nsIFrame.h @@ -389,9 +389,14 @@ public: NS_IMETHOD GetRect(nsRect& aRect) const = 0; NS_IMETHOD GetOrigin(nsPoint& aPoint) const = 0; NS_IMETHOD GetSize(nsSize& aSize) const = 0; - NS_IMETHOD SetRect(const nsRect& aRect) = 0; - NS_IMETHOD MoveTo(nscoord aX, nscoord aY) = 0; - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight) = 0; + NS_IMETHOD SetRect(nsIPresContext* aPresContext, + const nsRect& aRect) = 0; + NS_IMETHOD MoveTo(nsIPresContext* aPresContext, + nscoord aX, + nscoord aY) = 0; + NS_IMETHOD SizeTo(nsIPresContext* aPresContext, + nscoord aWidth, + nscoord aHeight) = 0; /** * Used to iterate the list of additional child list names. Returns the atom @@ -466,7 +471,8 @@ public: nsPoint& aPoint, PRInt32& aCursor) = 0; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) = 0; @@ -563,19 +569,24 @@ public: /** * Accessor functions to get/set the associated view object */ - NS_IMETHOD GetView(nsIView** aView) const = 0; // may be null - NS_IMETHOD SetView(nsIView* aView) = 0; + NS_IMETHOD GetView(nsIPresContext* aPresContext, + nsIView** aView) const = 0; // may be null + NS_IMETHOD SetView(nsIPresContext* aPresContext, + nsIView* aView) = 0; /** * Find the first geometric parent that has a view */ - NS_IMETHOD GetParentWithView(nsIFrame** aParent) const = 0; + NS_IMETHOD GetParentWithView(nsIPresContext* aPresContext, + nsIFrame** aParent) const = 0; /** * Returns the offset from this frame to the closest geometric parent that * has a view. Also returns the containing view or null in case of error */ - NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const = 0; + NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, + nsPoint& aOffset, + nsIView** aView) const = 0; /** * Returns the window that contains this frame. If this frame has a @@ -583,7 +594,8 @@ public: * returned, otherwise this frame's geometric parent is checked * recursively upwards. */ - NS_IMETHOD GetWindow(nsIWidget**) const = 0; + NS_IMETHOD GetWindow(nsIPresContext* aPresContext, + nsIWidget** aWidget) const = 0; /** * Get the "type" of the frame. May return a NULL atom pointer @@ -604,7 +616,7 @@ public: NS_IMETHOD Scrolled(nsIView *aView) = 0; // Debugging - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0; /** * Get a printable from of the name of the frame type. @@ -650,7 +662,10 @@ public: * @param aSelected is it selected * @param aSpread should is spread selection to flow elements around it? or go down to its children? */ - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) = 0; + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, + nsIDOMRange* aRange, + PRBool aSelected, + nsSpread aSpread) = 0; NS_IMETHOD GetSelected(PRBool *aSelected) const = 0; @@ -664,7 +679,7 @@ public: * return NS_ERROR_FAILURE * @param aPOS is defined in nsIFrameSelection */ - NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos) = 0; + NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) = 0; /** * See if tree verification is enabled. To enable tree verification add diff --git a/mozilla/layout/base/public/nsIFrameManager.h b/mozilla/layout/base/public/nsIFrameManager.h index 9d1b501908e..f6896f0c5c9 100644 --- a/mozilla/layout/base/public/nsIFrameManager.h +++ b/mozilla/layout/base/public/nsIFrameManager.h @@ -147,8 +147,12 @@ public: * aState is the document state storage object onto which each frame * stores its state. */ - NS_IMETHOD CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) = 0; - NS_IMETHOD RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) = 0; + NS_IMETHOD CaptureFrameState(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsILayoutHistoryState* aState) = 0; + NS_IMETHOD RestoreFrameState(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsILayoutHistoryState* aState) = 0; /** * Gets a property value for a given frame. diff --git a/mozilla/layout/base/public/nsIFrameSelection.h b/mozilla/layout/base/public/nsIFrameSelection.h index 615a56805ea..a504fa2cfbd 100644 --- a/mozilla/layout/base/public/nsIFrameSelection.h +++ b/mozilla/layout/base/public/nsIFrameSelection.h @@ -124,7 +124,7 @@ public: * @param aGuiEvent is the event that should be dealt with by aFocusFrame * @param aFrame is the frame that MAY handle the event */ - NS_IMETHOD HandleKeyEvent(nsGUIEvent *aGuiEvent) = 0; + NS_IMETHOD HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) = 0; /** HandleClick will take the focus to the new frame at the new offset and * will either extend the selection from the old anchor, or replace the old anchor. @@ -210,7 +210,7 @@ public: * specified by aSelectionType. * @param aSelectionType enum value defined in nsIDOMSelection for the domseleciton you want. */ - NS_IMETHOD RepaintSelection(SelectionType aSelectionType)=0; + NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aSelectionType)=0; /** GetFrameForNodeOffset given a node and its child offset, return the nsIFrame and * the offset into that frame. diff --git a/mozilla/layout/base/public/nsIStatefulFrame.h b/mozilla/layout/base/public/nsIStatefulFrame.h index 912a4112ff6..1bc14d30a5e 100644 --- a/mozilla/layout/base/public/nsIStatefulFrame.h +++ b/mozilla/layout/base/public/nsIStatefulFrame.h @@ -3,6 +3,8 @@ #include "nsISupports.h" +class nsIPresContext; + #define NS_ISTATEFULFRAME_IID_STR "306c8ca0-5f0c-11d3-a9fb-000064657374" #define NS_ISTATEFULFRAME_IID \ @@ -18,9 +20,9 @@ class nsIStatefulFrame : public nsISupports { enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType, eTextType, eNumStateTypes}; - NS_IMETHOD GetStateType(nsIStatefulFrame::StateType* aStateType) = 0; - NS_IMETHOD SaveState(nsISupports** aState) = 0; - NS_IMETHOD RestoreState(nsISupports* aState) = 0; + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) = 0; + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState) = 0; + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState) = 0; }; diff --git a/mozilla/layout/base/src/nsCaret.cpp b/mozilla/layout/base/src/nsCaret.cpp index 2a56277eb85..e9bf1ffb623 100644 --- a/mozilla/layout/base/src/nsCaret.cpp +++ b/mozilla/layout/base/src/nsCaret.cpp @@ -459,7 +459,9 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame, EViewCoordinates coordTy nsIView* theView = nsnull; NS_ASSERTION(caretFrame, "Should have frame here"); - caretFrame->GetOffsetFromView(viewOffset, &theView); + nsCOMPtr presContext; + mPresShell->GetPresContext(getter_AddRefs(presContext)); + caretFrame->GetOffsetFromView(presContext, viewOffset, &theView); if (theView == nsnull) return; nsIView* returnView = nsnull; diff --git a/mozilla/layout/base/src/nsDocument.cpp b/mozilla/layout/base/src/nsDocument.cpp index b0767f4baaa..aaf10357958 100644 --- a/mozilla/layout/base/src/nsDocument.cpp +++ b/mozilla/layout/base/src/nsDocument.cpp @@ -1920,9 +1920,11 @@ nsDocument::GetPixelDimensions(nsIPresShell* aShell, result = aShell->GetPrimaryFrameFor(mRootContent, &frame); if (NS_SUCCEEDED(result) && frame) { - nsIView* view; + nsIView* view; + nsCOMPtr presContext; - result = frame->GetView(&view); + aShell->GetPresContext(getter_AddRefs(presContext)); + result = frame->GetView(presContext, &view); if (NS_SUCCEEDED(result)) { // If we have a view check if it's scrollable. If not, // just use the view size itself diff --git a/mozilla/layout/base/src/nsFrameImageLoader.cpp b/mozilla/layout/base/src/nsFrameImageLoader.cpp index 5c1e41039d0..f8e9c323f0b 100644 --- a/mozilla/layout/base/src/nsFrameImageLoader.cpp +++ b/mozilla/layout/base/src/nsFrameImageLoader.cpp @@ -439,7 +439,7 @@ nsFrameImageLoader::Notify(nsIImageRequest *aImageRequest, // XXX this is pretty vile; change this so that we set another frame status bit and then pass on a notification *or* lets just start passing on the notifications directly to the frames and eliminate all of this code. pfd = mFrames; while (pfd) { - pfd->mFrame->GetView(&view); + pfd->mFrame->GetView(mPresContext, &view); if (view) { view->SetContentTransparency(PR_TRUE); } @@ -541,9 +541,9 @@ nsFrameImageLoader::DamageRepairFrames(const nsRect* aDamageRect) // XXX We should tell the frame the damage area and let it invalidate // itself. Add some API calls to nsIFrame to allow a caller to invalidate // parts of the frame... - frame->GetView(&view); + frame->GetView(mPresContext, &view); if (nsnull == view) { - frame->GetOffsetFromView(offset, &view); + frame->GetOffsetFromView(mPresContext, offset, &view); bounds.x += offset.x; bounds.y += offset.y; } diff --git a/mozilla/layout/base/src/nsFrameList.cpp b/mozilla/layout/base/src/nsFrameList.cpp index 37221bd5282..9edde9256d6 100644 --- a/mozilla/layout/base/src/nsFrameList.cpp +++ b/mozilla/layout/base/src/nsFrameList.cpp @@ -346,12 +346,12 @@ nsFrameList::VerifyParent(nsIFrame* aParent) const } void -nsFrameList::List(FILE* out) const +nsFrameList::List(nsIPresContext* aPresContext, FILE* out) const { fputs("<\n", out); nsIFrame* frame = mFirstChild; while (nsnull != frame) { - frame->List(out, 1); + frame->List(aPresContext, out, 1); frame->GetNextSibling(&frame); } fputs(">\n", out); diff --git a/mozilla/layout/base/src/nsGenericElement.cpp b/mozilla/layout/base/src/nsGenericElement.cpp index 085ed61d738..cd27a3c01b2 100644 --- a/mozilla/layout/base/src/nsGenericElement.cpp +++ b/mozilla/layout/base/src/nsGenericElement.cpp @@ -901,7 +901,7 @@ nsGenericElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult, //---------------------------------------------------------------------- nsresult -nsGenericElement::RenderFrame() +nsGenericElement::RenderFrame(nsIPresContext* aPresContext) { nsPoint offset; nsRect bounds; @@ -925,7 +925,7 @@ nsGenericElement::RenderFrame() // XXX We should tell the frame the damage area and let it invalidate // itself. Add some API calls to nsIFrame to allow a caller to invalidate // parts of the frame... - frame->GetOffsetFromView(offset, &view); + frame->GetOffsetFromView(aPresContext, offset, &view); view->GetViewManager(vm); bounds.x += offset.x; bounds.y += offset.y; diff --git a/mozilla/layout/base/src/nsGenericElement.h b/mozilla/layout/base/src/nsGenericElement.h index 02dea28d678..1b4a029b158 100644 --- a/mozilla/layout/base/src/nsGenericElement.h +++ b/mozilla/layout/base/src/nsGenericElement.h @@ -184,7 +184,7 @@ public: //---------------------------------------- - nsresult RenderFrame(); + nsresult RenderFrame(nsIPresContext*); nsresult AddScriptEventListener(nsIAtom* aAttribute, const nsString& aValue, diff --git a/mozilla/layout/base/src/nsRangeList.cpp b/mozilla/layout/base/src/nsRangeList.cpp index 535625a301e..908d633f7dd 100644 --- a/mozilla/layout/base/src/nsRangeList.cpp +++ b/mozilla/layout/base/src/nsRangeList.cpp @@ -123,6 +123,7 @@ public: /*END nsIScriptObjectOwner interface implementations*/ // utility methods for scrolling the selection into view + nsresult GetPresContext(nsIPresContext **aPresContext); nsresult GetPresShell(nsIPresShell **aPresShell); nsresult GetRootScrollableView(nsIScrollableView **aScrollableView); nsresult GetFrameToRootViewOffset(nsIFrame *aFrame, nscoord *aXOffset, nscoord *aYOffset); @@ -134,7 +135,7 @@ public: nsresult AddItem(nsIDOMRange *aRange); nsresult RemoveItem(nsIDOMRange *aRange); - nsresult Clear(); + nsresult Clear(nsIPresContext* aPresContext); // methods for convenience. Note, these don't addref nsIDOMNode* FetchAnchorNode(); //where did the selection begin PRInt32 FetchAnchorOffset(); @@ -159,7 +160,7 @@ public: NS_IMETHOD GetOriginalAnchorPoint(nsIDOMNode **aNode, PRInt32 *aOffset); NS_IMETHOD LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength, SelectionDetails **aReturnDetails, SelectionType aType); - NS_IMETHOD Repaint(); + NS_IMETHOD Repaint(nsIPresContext* aPresContext); nsresult StartAutoScrollTimer(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint, PRUint32 aDelay); nsresult StopAutoScrollTimer(); @@ -171,8 +172,8 @@ private: void setAnchorFocusRange(PRInt32 aIndex); //pass in index into rangelist - NS_IMETHOD selectFrames(nsIContentIterator *aInnerIter, nsIContent *aContent, nsIDOMRange *aRange, PRBool aFlags); - NS_IMETHOD selectFrames(nsIDOMRange *aRange, PRBool aSelect); + NS_IMETHOD selectFrames(nsIPresContext* aPresContext, nsIContentIterator *aInnerIter, nsIContent *aContent, nsIDOMRange *aRange, PRBool aFlags); + NS_IMETHOD selectFrames(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool aSelect); #if OLD_SELECTION NS_IMETHOD FixupSelectionPoints(nsIDOMRange *aRange, nsDirection *aDir, PRBool *aFixupState); @@ -206,7 +207,7 @@ public: NS_IMETHOD Init(nsIFocusTracker *aTracker); NS_IMETHOD ShutDown(); NS_IMETHOD HandleTextEvent(nsGUIEvent *aGUIEvent); - NS_IMETHOD HandleKeyEvent(nsGUIEvent *aGuiEvent); + NS_IMETHOD HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent); NS_IMETHOD HandleClick(nsIContent *aNewFocus, PRUint32 aContentOffset, PRUint32 aContentEndOffset, PRBool aContinueSelection, PRBool aMultipleSelection,PRBool aHint); NS_IMETHOD HandleDrag(nsIPresContext *aPresContext, nsIFrame *aFrame, nsPoint& aPoint); @@ -219,7 +220,7 @@ public: NS_IMETHOD GetMouseDownState(PRBool *aState); NS_IMETHOD GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection); NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion); - NS_IMETHOD RepaintSelection(SelectionType aType); + NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType); NS_IMETHOD GetFrameForNodeOffset(nsIContent *aNode, PRInt32 aOffset, nsIFrame **aReturnFrame); /*END nsIFrameSelection interfacse*/ @@ -845,7 +846,7 @@ nsRangeList::HandleTextEvent(nsGUIEvent *aGUIEvent) * focus DomNode, it is invalid? The answer now is yes. */ NS_IMETHODIMP -nsRangeList::HandleKeyEvent(nsGUIEvent *aGuiEvent) +nsRangeList::HandleKeyEvent(nsIPresContext* aPresContext, nsGUIEvent *aGuiEvent) { if (!aGuiEvent) return NS_ERROR_NULL_POINTER; @@ -959,7 +960,7 @@ nsRangeList::HandleKeyEvent(nsGUIEvent *aGuiEvent) default :return NS_ERROR_FAILURE; } pos.mPreferLeft = mHint; - if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(&pos)) && pos.mResultContent) + if (NS_SUCCEEDED(result) && NS_SUCCEEDED(frame->PeekOffset(aPresContext, &pos)) && pos.mResultContent) { mHint = (HINT)pos.mPreferLeft; result = TakeFocus(pos.mResultContent, pos.mContentOffset, pos.mContentOffset, keyEvent->isShift, PR_FALSE); @@ -1202,7 +1203,7 @@ nsRangeList::ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegio } NS_IMETHODIMP -nsRangeList::RepaintSelection(SelectionType aType) +nsRangeList::RepaintSelection(nsIPresContext* aPresContext, SelectionType aType) { if (aType < SELECTION_NORMAL || aType >= NUM_SELECTIONTYPES) return NS_ERROR_FAILURE; @@ -1210,7 +1211,7 @@ nsRangeList::RepaintSelection(SelectionType aType) if (!mDomSelections[aType]) return NS_ERROR_NULL_POINTER; - return mDomSelections[aType]->Repaint(); + return mDomSelections[aType]->Repaint(aPresContext); } NS_IMETHODIMP @@ -1734,7 +1735,7 @@ nsDOMSelection::RemoveItem(nsIDOMRange *aItem) nsresult -nsDOMSelection::Clear() +nsDOMSelection::Clear(nsIPresContext* aPresContext) { setAnchorFocusRange(-1); if (!mRangeArray) @@ -1750,7 +1751,7 @@ nsDOMSelection::Clear() nsCOMPtr isupportsindex = dont_AddRef(mRangeArray->ElementAt(0)); nsCOMPtr range = do_QueryInterface(isupportsindex); mRangeArray->RemoveElementAt(0); - selectFrames(range, 0); + selectFrames(aPresContext, range, 0); // Does RemoveElementAt also delete the elements? } @@ -1843,7 +1844,11 @@ nsDOMSelection::GetPrimaryFrameForFocusNode(nsIFrame **aReturnFrame) //select all content children of aContent NS_IMETHODIMP -nsDOMSelection::selectFrames(nsIContentIterator *aInnerIter, nsIContent *aContent, nsIDOMRange *aRange, PRBool aFlags) +nsDOMSelection::selectFrames(nsIPresContext* aPresContext, + nsIContentIterator *aInnerIter, + nsIContent *aContent, + nsIDOMRange *aRange, + PRBool aFlags) { nsresult result = aInnerIter->Init(aContent); nsIFrame *frame; @@ -1857,7 +1862,7 @@ nsDOMSelection::selectFrames(nsIContentIterator *aInnerIter, nsIContent *aConten continue; result = mRangeList->GetTracker()->GetPrimaryFrameFor(innercontent, &frame); if (NS_SUCCEEDED(result) && frame) - frame->SetSelected(aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow result = aInnerIter->Next(); if (NS_FAILED(result)) return result; @@ -1876,7 +1881,7 @@ nsDOMSelection::selectFrames(nsIContentIterator *aInnerIter, nsIContent *aConten //the idea of this helper method is to select, deselect "top to bottom" traversing through the frames NS_IMETHODIMP -nsDOMSelection::selectFrames(nsIDOMRange *aRange, PRBool aFlags) +nsDOMSelection::selectFrames(nsIPresContext* aPresContext, nsIDOMRange *aRange, PRBool aFlags) { if (!aRange) return NS_ERROR_NULL_POINTER; @@ -1909,7 +1914,7 @@ nsDOMSelection::selectFrames(nsIDOMRange *aRange, PRBool aFlags) { result = mRangeList->GetTracker()->GetPrimaryFrameFor(content, &frame); if (NS_SUCCEEDED(result) && frame) - frame->SetSelected(aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow } //end start content result = iter->First(); @@ -1918,7 +1923,7 @@ nsDOMSelection::selectFrames(nsIDOMRange *aRange, PRBool aFlags) result = iter->CurrentNode(getter_AddRefs(content)); if (NS_FAILED(result) || !content) return result; - selectFrames(inneriter, content, aRange, aFlags); + selectFrames(aPresContext, inneriter, content, aRange, aFlags); result = iter->Next(); } //we must now do the last one if it is not the same as the first @@ -1933,7 +1938,7 @@ nsDOMSelection::selectFrames(nsIDOMRange *aRange, PRBool aFlags) { result = mRangeList->GetTracker()->GetPrimaryFrameFor(content, &frame); if (NS_SUCCEEDED(result) && frame) - frame->SetSelected(aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow + frame->SetSelected(aPresContext, aRange,aFlags,eSpreadDown);//spread from here to hit all frames in flow } } //end end parent @@ -2068,7 +2073,7 @@ nsDOMSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PR } NS_IMETHODIMP -nsDOMSelection::Repaint() +nsDOMSelection::Repaint(nsIPresContext* aPresContext) { PRUint32 arrCount = 0; @@ -2103,7 +2108,7 @@ nsDOMSelection::Repaint() if (!range) return NS_ERROR_NULL_POINTER; - result = selectFrames(range, PR_TRUE); + result = selectFrames(aPresContext, range, PR_TRUE); if (NS_FAILED(result)) return result; @@ -2211,7 +2216,7 @@ nsDOMSelection::DoAutoScroll(nsIPresContext *aPresContext, nsIFrame *aFrame, nsP while (NS_SUCCEEDED(result) && parentFrame && !frameView) { - result = parentFrame->GetView(&frameView); + result = parentFrame->GetView(aPresContext, &frameView); if (NS_SUCCEEDED(result) && !frameView) result = parentFrame->GetParent(&parentFrame); } @@ -2369,7 +2374,10 @@ nsDOMSelection::GetEnumerator(nsIEnumerator **aIterator) NS_IMETHODIMP nsDOMSelection::ClearSelection() { - nsresult result = Clear(); + nsCOMPtr presContext; + GetPresContext(getter_AddRefs(presContext)); + + nsresult result = Clear(presContext); if (NS_FAILED(result)) return result; @@ -2398,7 +2406,9 @@ nsDOMSelection::AddRange(nsIDOMRange* aRange) return NS_ERROR_FAILURE; } setAnchorFocusRange(count -1); - selectFrames(aRange, PR_TRUE); + nsCOMPtr presContext; + GetPresContext(getter_AddRefs(presContext)); + selectFrames(presContext, aRange, PR_TRUE); ScrollIntoView(); return mRangeList->NotifySelectionListeners(); @@ -2418,7 +2428,9 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) // Delete all of the current ranges if (NS_FAILED(SetOriginalAnchorPoint(aParentNode,aOffset))) return NS_ERROR_FAILURE; //??? - Clear(); + nsCOMPtr presContext; + GetPresContext(getter_AddRefs(presContext)); + Clear(presContext); nsCOMPtr range; result = nsComponentManager::CreateInstance(kRangeCID, nsnull, @@ -2464,7 +2476,7 @@ nsDOMSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) result = AddItem(range); setAnchorFocusRange(0); - selectFrames(range,PR_TRUE); + selectFrames(presContext, range,PR_TRUE); if (NS_FAILED(result)) return result; @@ -2996,6 +3008,8 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) if (result2 == 0) //not selecting anywhere return NS_OK; + nsCOMPtr presContext; + GetPresContext(getter_AddRefs(presContext)); if ((result1 == 0 && result3 < 0) || (result1 <= 0 && result2 < 0)){//a1,2 a,1,2 //select from 1 to 2 unless they are collapsed res = range->SetEnd(aParentNode,aOffset); @@ -3019,7 +3033,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) #endif } else{ - selectFrames(difRange , PR_TRUE); + selectFrames(presContext, difRange , PR_TRUE); } } else if (result1 == 0 && result3 > 0){//2, a1 @@ -3039,7 +3053,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) } else #endif - selectFrames(range, PR_TRUE); + selectFrames(presContext, range, PR_TRUE); } else if (result3 <= 0 && result2 >= 0) {//a,2,1 or a2,1 or a,21 or a21 //deselect from 2 to 1 @@ -3066,9 +3080,9 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) } else { - selectFrames(difRange, 0);//deselect now if fixup succeeded + selectFrames(presContext, difRange, 0);//deselect now if fixup succeeded difRange->SetEnd(FetchEndParent(range),FetchEndOffset(range)); - selectFrames(difRange, PR_TRUE);//must reselect last node maybe more if fixup did something + selectFrames(presContext, difRange, PR_TRUE);//must reselect last node maybe more if fixup did something } } else if (result1 >= 0 && result3 <= 0) {//1,a,2 or 1a,2 or 1,a2 or 1a2 @@ -3100,10 +3114,10 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) if (NS_FAILED(res)) return res; //deselect from 1 to a - selectFrames(difRange , PR_FALSE); + selectFrames(presContext, difRange , PR_FALSE); } //select from a to 2 - selectFrames(range , PR_TRUE); + selectFrames(presContext, range , PR_TRUE); } } else if (result2 <= 0 && result3 >= 0) {//1,2,a or 12,a or 1,2a or 12a @@ -3131,9 +3145,9 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) } else { - selectFrames(difRange , PR_FALSE); + selectFrames(presContext, difRange , PR_FALSE); difRange->SetStart(FetchStartParent(range),FetchStartOffset(range)); - selectFrames(difRange, PR_TRUE);//must reselect last node + selectFrames(presContext, difRange, PR_TRUE);//must reselect last node } } else if (result3 >= 0 && result1 <= 0) {//2,a,1 or 2a,1 or 2,a1 or 2a1 @@ -3160,10 +3174,10 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) if (FetchFocusNode() != FetchAnchorNode() || FetchFocusOffset() != FetchAnchorOffset() ){//if collapsed diff dont do anything res = difRange->SetStart(FetchAnchorNode(), FetchAnchorOffset()); res |= difRange->SetEnd(FetchFocusNode(), FetchFocusOffset()); - selectFrames(difRange, 0); + selectFrames(presContext, difRange, 0); } //select from 2 to a - selectFrames(range , PR_TRUE); + selectFrames(presContext, range , PR_TRUE); } } else if (result2 >= 0 && result1 >= 0) {//2,1,a or 21,a or 2,1a or 21a @@ -3190,7 +3204,7 @@ nsDOMSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset) #endif } else { - selectFrames(difRange, PR_TRUE); + selectFrames(presContext, difRange, PR_TRUE); } } @@ -3303,6 +3317,19 @@ nsDOMSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYes) return NS_OK; } +nsresult +nsDOMSelection::GetPresContext(nsIPresContext **aPresContext) +{ + nsresult rv = NS_OK; + + nsIFocusTracker *tracker = mRangeList->GetTracker(); + + if (!tracker) + return NS_ERROR_NULL_POINTER; + + return tracker->GetPresContext(aPresContext); +} + nsresult nsDOMSelection::GetPresShell(nsIPresShell **aPresShell) { @@ -3396,7 +3423,14 @@ nsDOMSelection::GetFrameToRootViewOffset(nsIFrame *aFrame, nscoord *aX, nscoord // Determine the offset from aFrame to the scrolled view. We do that by // getting the offset from its closest view and then walking up scrollingView->GetScrolledView(scrolledView); - aFrame->GetOffsetFromView(offset, &closestView); + nsIFocusTracker *tracker = mRangeList->GetTracker(); + + if (!tracker) + return NS_ERROR_NULL_POINTER; + + nsCOMPtr presContext; + tracker->GetPresContext(getter_AddRefs(presContext)); + aFrame->GetOffsetFromView(presContext, offset, &closestView); // XXX Deal with the case where there is a scrolled element, e.g., a // DIV in the middle... @@ -3466,7 +3500,7 @@ nsDOMSelection::GetPointFromOffset(nsIFrame *aFrame, PRInt32 aContentOffset, nsP nsIView *closestView = 0; nsPoint offset(0, 0); - rv = aFrame->GetOffsetFromView(offset, &closestView); + rv = aFrame->GetOffsetFromView(presContext, offset, &closestView); while (!widget && closestView) { diff --git a/mozilla/layout/events/src/nsEventStateManager.cpp b/mozilla/layout/events/src/nsEventStateManager.cpp index 8a5d6ec2db0..207b4a50d18 100644 --- a/mozilla/layout/events/src/nsEventStateManager.cpp +++ b/mozilla/layout/events/src/nsEventStateManager.cpp @@ -648,7 +648,7 @@ nsEventStateManager::UpdateCursor(nsIPresContext& aPresContext, nsPoint& aPoint, } nsIWidget* window; - aTargetFrame->GetWindow(&window); + aTargetFrame->GetWindow(&aPresContext, &window); window->SetCursor(c); NS_RELEASE(window); } @@ -1378,7 +1378,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState) } if ((aState & NS_EVENT_STATE_FOCUS) && (aContent != mCurrentFocus)) { - SendFocusBlur(aContent); + SendFocusBlur(mPresContext, aContent); //transferring ref to notifyContent from mCurrentFocus notifyContent[3] = mCurrentFocus; @@ -1468,7 +1468,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState) } NS_IMETHODIMP -nsEventStateManager::SendFocusBlur(nsIContent *aContent) +nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent) { if (mCurrentFocus == aContent) { return NS_OK; @@ -1543,7 +1543,7 @@ nsEventStateManager::SendFocusBlur(nsIContent *aContent) PRBool shouldSetFocusOnWindow = PR_TRUE; if (nsnull != currentFocusFrame) { nsIView * view = nsnull; - currentFocusFrame->GetView(&view); + currentFocusFrame->GetView(aPresContext, &view); if (view != nsnull) { nsIWidget *window = nsnull; view->GetWidget(window); @@ -1563,10 +1563,10 @@ nsEventStateManager::SendFocusBlur(nsIContent *aContent) // then click on a gfx control (generates another focus event) if (shouldSetFocusOnWindow && nsnull != currentFocusFrame) { nsIFrame * parentFrame; - currentFocusFrame->GetParentWithView(&parentFrame); + currentFocusFrame->GetParentWithView(aPresContext, &parentFrame); if (nsnull != parentFrame) { nsIView * pView; - parentFrame->GetView(&pView); + parentFrame->GetView(aPresContext, &pView); if (nsnull != pView) { nsIWidget *window = nsnull; diff --git a/mozilla/layout/events/src/nsEventStateManager.h b/mozilla/layout/events/src/nsEventStateManager.h index 057e5d95f5f..899a9f64634 100644 --- a/mozilla/layout/events/src/nsEventStateManager.h +++ b/mozilla/layout/events/src/nsEventStateManager.h @@ -72,7 +72,7 @@ protected: void ShiftFocus(PRBool foward); nsIContent* GetNextTabbableContent(nsIContent* aParent, nsIContent* aChild, nsIContent* aTop, PRBool foward); PRInt32 GetNextTabIndex(nsIContent* aParent, PRBool foward); - NS_IMETHOD SendFocusBlur(nsIContent *aContent); + NS_IMETHOD SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent); nsIScrollableView* GetNearestScrollingView(nsIView* aView); // routines for the d&d gesture tracking state machine diff --git a/mozilla/layout/forms/nsButtonFrameRenderer.cpp b/mozilla/layout/forms/nsButtonFrameRenderer.cpp index 85f6af666d1..7cc4d3497f7 100644 --- a/mozilla/layout/forms/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/forms/nsButtonFrameRenderer.cpp @@ -95,13 +95,13 @@ nsButtonFrameRenderer::isDisabled() } void -nsButtonFrameRenderer::Redraw() +nsButtonFrameRenderer::Redraw(nsIPresContext* aPresContext) { nsRect rect; mFrame->GetRect(rect); rect.x = 0; rect.y = 0; - mFrame->Invalidate(rect, PR_FALSE); + mFrame->Invalidate(aPresContext, rect, PR_FALSE); } void diff --git a/mozilla/layout/forms/nsButtonFrameRenderer.h b/mozilla/layout/forms/nsButtonFrameRenderer.h index 401cf0944cf..2aaddbaa9f3 100644 --- a/mozilla/layout/forms/nsButtonFrameRenderer.h +++ b/mozilla/layout/forms/nsButtonFrameRenderer.h @@ -87,7 +87,7 @@ public: virtual nsresult SetStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); virtual void ReResolveStyles(nsIPresContext& aPresContext); - virtual void Redraw(); + virtual void Redraw(nsIPresContext* aPresContext); virtual nsIFrame* GetFrame(); virtual PRInt32 GetNameSpace(); diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index d63cbbfff70..cd6264f4361 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -189,7 +189,7 @@ nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter) // This is a UI decision that goes against the HTML 4 spec. // See bugzilla bug 15841 for justification of this deviation. nsresult -nsComboboxControlFrame::MakeSureSomethingIsSelected() +nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); @@ -203,7 +203,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected() mListControlFrame->GetNumberOfOptions(&length); if (length > 0) { // Set listbox selection to first item in the list box - rv = fcFrame->SetProperty(nsHTMLAtoms::selectedindex, "0"); + rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0"); mSelectedIndex = 0; } UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option @@ -217,9 +217,9 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected() // Initialize the text string in the combobox using either the current // selection in the list box or the first item item in the list box. void -nsComboboxControlFrame::InitTextStr(PRBool aUpdate) +nsComboboxControlFrame::InitTextStr(nsIPresContext* aPresContext, PRBool aUpdate) { - MakeSureSomethingIsSelected(); + MakeSureSomethingIsSelected(aPresContext); // Update the selected text string mListControlFrame->GetSelectedItem(mTextStr); @@ -235,18 +235,18 @@ nsComboboxControlFrame::InitTextStr(PRBool aUpdate) // Reset the combo box back to it original state. void -nsComboboxControlFrame::Reset() +nsComboboxControlFrame::Reset(nsIPresContext* aPresContext) { // Reset the dropdown list to its original state nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame); if ((NS_OK == result) && (nsnull != fcFrame)) { - fcFrame->Reset(); + fcFrame->Reset(aPresContext); } // Update the combobox using the text string returned from the dropdown list - InitTextStr(PR_TRUE); + InitTextStr(aPresContext, PR_TRUE); } void @@ -254,7 +254,7 @@ nsComboboxControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nscoord& aWidth, nscoord& aHeight) { - Reset(); + Reset(aPresContext); } //-------------------------------------------------------------- @@ -370,7 +370,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) nsIFrame * listFrame; if (NS_OK == mListControlFrame->QueryInterface(kIFrameIID, (void **)&listFrame)) { nsIView * view = nsnull; - listFrame->GetView(&view); + listFrame->GetView(aPresContext, &view); NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null"); view->GetWidget(widget); if (nsnull != widget) { @@ -385,7 +385,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) // The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected // which will stop the capture. mListControlFrame->AboutToDropDown(); - mListControlFrame->CaptureMouseEvents(PR_TRUE); + mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE); } else { ShowPopup(PR_FALSE); mDroppedDown = PR_FALSE; @@ -427,7 +427,7 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame, aFrame->GetRect(rect); rect.width = aDesiredSize.width; rect.height = aDesiredSize.height; - aFrame->SetRect(rect); + aFrame->SetRect(&aPresContext, rect); return rv; } @@ -557,7 +557,7 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext& aPresContext, dropdownFrame->GetRect(currentRect); //if (currentRect != dropdownRect) { - dropdownFrame->SetRect(dropdownRect); + dropdownFrame->SetRect(&aPresContext, dropdownRect); #ifdef DEBUG_rodsXXX printf("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height); #endif @@ -593,7 +593,7 @@ nsComboboxControlFrame::GetAbsoluteFramePosition(nsIPresContext& aPresContext, // Add in frame's offset from it it's containing view nsIView *containingView = nsnull; nsPoint offset; - rv = aFrame->GetOffsetFromView(offset, &containingView); + rv = aFrame->GetOffsetFromView(&aPresContext, offset, &containingView); if (NS_SUCCEEDED(rv) && (nsnull != containingView)) { aAbsoluteTwipsRect.x += offset.x; aAbsoluteTwipsRect.y += offset.y; @@ -760,7 +760,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext& aPresContext, buttonFrame->GetRect(buttonRect); buttonRect.y = displayRect.y; buttonRect.height = displayRect.height; - buttonFrame->SetRect(buttonRect); + buttonFrame->SetRect(&aPresContext, buttonRect); // Reflow the dropdown list to match the width of the display + button ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, aDesiredSize.width, NS_UNCONSTRAINEDSIZE); @@ -871,13 +871,15 @@ nsComboboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue } NS_IMETHODIMP -nsComboboxControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsComboboxControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { if (nsFormFrame::GetDisabled(this)) { *aFrame = this; return NS_OK; } else { - return nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame); + return nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); } return NS_OK; } @@ -921,7 +923,7 @@ nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown) if (!mDroppedDown && aDoDropDown) { if (mListControlFrame) { - mListControlFrame->SyncViewWithFrame(); + mListControlFrame->SyncViewWithFrame(mPresContext); } ToggleList(mPresContext); return NS_OK; @@ -964,7 +966,7 @@ nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext) aPresContext = mPresContext; } ShowList(aPresContext, PR_FALSE); - mListControlFrame->CaptureMouseEvents(PR_FALSE); + mListControlFrame->CaptureMouseEvents(aPresContext, PR_FALSE); PRInt32 indx; mListControlFrame->GetSelectedIndex(&indx); @@ -1059,36 +1061,36 @@ nsComboboxControlFrame::SelectionChanged() //---------------------------------------------------------------------- NS_IMETHODIMP -nsComboboxControlFrame::AddOption(PRInt32 aIndex) +nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { nsISelectControlFrame* listFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame), (void**)&listFrame); if (NS_SUCCEEDED(rv) && listFrame) { - rv = listFrame->AddOption(aIndex); + rv = listFrame->AddOption(aPresContext, aIndex); NS_RELEASE(listFrame); } // If we added the first option, we might need to select it. - MakeSureSomethingIsSelected(); + MakeSureSomethingIsSelected(aPresContext); return rv; } NS_IMETHODIMP -nsComboboxControlFrame::RemoveOption(PRInt32 aIndex) +nsComboboxControlFrame::RemoveOption(nsIPresContext* aPresContext, PRInt32 aIndex) { nsISelectControlFrame* listFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame), (void**)&listFrame); if (NS_SUCCEEDED(rv) && listFrame) { - rv = listFrame->RemoveOption(aIndex); + rv = listFrame->RemoveOption(aPresContext, aIndex); NS_RELEASE(listFrame); } // If we removed the selected option, nothing is selected any more. // Restore selection to option 0 if there are options left. - MakeSureSomethingIsSelected(); + MakeSureSomethingIsSelected(aPresContext); return rv; } @@ -1145,13 +1147,13 @@ nsComboboxControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP -nsComboboxControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame); if ((NS_SUCCEEDED(result)) && (nsnull != fcFrame)) { - return fcFrame->SetProperty(aName, aValue); + return fcFrame->SetProperty(aPresContext, aName, aValue); } return result; } @@ -1269,7 +1271,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext& aPresContext, mPopupFrames.SetFrames(aChildList); } else { rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList); - InitTextStr(PR_FALSE); + InitTextStr(&aPresContext, PR_FALSE); } return rv; } @@ -1319,7 +1321,7 @@ nsComboboxControlFrame::Rollup() if (mDroppedDown) { mListControlFrame->AboutToRollup(); ShowDropDown(PR_FALSE); - mListControlFrame->CaptureMouseEvents(PR_FALSE); + mListControlFrame->CaptureMouseEvents(mPresContext, PR_FALSE); } return NS_OK; } @@ -1330,35 +1332,36 @@ nsComboboxControlFrame::Rollup() // the ListControlFrame, our child... //---------------------------------------------------------------------- NS_IMETHODIMP -nsComboboxControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsComboboxControlFrame::GetStateType(nsIPresContext* aPresContext, + nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eSelectType; return NS_OK; } NS_IMETHODIMP -nsComboboxControlFrame::SaveState(nsISupports** aState) +nsComboboxControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { if (!mListControlFrame) return NS_ERROR_UNEXPECTED; nsIStatefulFrame* sFrame = nsnull; nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame), (void**)&sFrame); if (NS_SUCCEEDED(res) && sFrame) { - res = sFrame->SaveState(aState); + res = sFrame->SaveState(aPresContext, aState); NS_RELEASE(sFrame); } return res; } NS_IMETHODIMP -nsComboboxControlFrame::RestoreState(nsISupports* aState) +nsComboboxControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { if (!mListControlFrame) return NS_ERROR_UNEXPECTED; nsIStatefulFrame* sFrame = nsnull; nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame), (void**)&sFrame); if (NS_SUCCEEDED(res) && sFrame) { - res = sFrame->RestoreState(aState); + res = sFrame->RestoreState(aPresContext, aState); NS_RELEASE(sFrame); } return res; diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 0b3b83f7dc0..177f7da526d 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -88,13 +88,13 @@ public: NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); // nsIFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetName(nsString* aName); NS_IMETHOD GetType(PRInt32* aType) const; - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); @@ -103,7 +103,7 @@ public: nscoord& aHeight); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); @@ -139,8 +139,8 @@ public: NS_IMETHOD GetAbsoluteRect(nsRect* aRect); // nsISelectControlFrame - NS_IMETHOD AddOption(PRInt32 index); - NS_IMETHOD RemoveOption(PRInt32 index); + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 index); + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 index); NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue); NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue); @@ -154,9 +154,9 @@ public: virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); //nsIRollupListener NS_IMETHOD Rollup(); @@ -191,12 +191,12 @@ protected: void ShowPopup(PRBool aShowPopup); void ShowList(nsIPresContext* aPresContext, PRBool aShowList); void SetChildFrameSize(nsIFrame* aFrame, nscoord aWidth, nscoord aHeight); - void InitTextStr(PRBool aUpdate); + void InitTextStr(nsIPresContext* aPresContext, PRBool aUpdate); nsresult GetPrimaryComboFrame(nsIPresContext& aPresContext, nsIContent* aContent, nsIFrame** aFrame); nsIFrame* GetButtonFrame(nsIPresContext& aPresContext); nsIFrame* GetDropdownFrame(); NS_IMETHOD ToggleList(nsIPresContext* aPresContext); - nsresult MakeSureSomethingIsSelected(); // Default to option 0 + nsresult MakeSureSomethingIsSelected(nsIPresContext* aPresContext); // Default to option 0 nsFrameList mPopupFrames; // additional named child list nsIPresContext* mPresContext; // XXX: Remove the need to cache the pres context. diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index faf511e30d7..6cffb3ba1cc 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -271,7 +271,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext, if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull != view) { aRenderingContext.SetColor(NS_RGB(0,0,255)); } @@ -359,7 +359,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nsRect contentRect(borderPadding.left,borderPadding.top + mLegendSpace,aDesiredSize.width ,aDesiredSize.height); // Place the content area frame. - mContentFrame->SetRect(contentRect); + mContentFrame->SetRect(&aPresContext, contentRect); if (mLegendFrame) { @@ -376,7 +376,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, // place the legend nsRect actualLegendRect(mLegendRect); actualLegendRect.Deflate(legendMargin); - mLegendFrame->SetRect(actualLegendRect); + mLegendFrame->SetRect(&aPresContext, actualLegendRect); } // Return our size and our result diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index fb8a0850a11..75d7afc6970 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -161,7 +161,7 @@ nsFileControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter) } void -nsFileControlFrame::Reset() +nsFileControlFrame::Reset(nsIPresContext* aPresContext) { if (mTextFrame) { mTextFrame->Reset(); @@ -221,7 +221,7 @@ nsresult nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) { nsIView* textView; - mTextFrame->GetView(&textView); + mTextFrame->GetView(mPresContext, &textView); if (nsnull == textView) { return NS_OK; } @@ -249,7 +249,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) fileWidget->GetFile(fileSpec); char* leafName = fileSpec.GetLeafName(); if (leafName) { - mTextFrame->SetProperty(nsHTMLAtoms::value,leafName); + mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value,leafName); nsCRT::free(leafName); } } @@ -272,7 +272,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext, mTextFrame = GetTextControlFrame(this); if (!mTextFrame) return NS_ERROR_UNEXPECTED; if (mCachedState) { - mTextFrame->SetProperty(nsHTMLAtoms::value, *mCachedState); + mTextFrame->SetProperty(&aPresContext, nsHTMLAtoms::value, *mCachedState); delete mCachedState; mCachedState = nsnull; } @@ -414,13 +414,15 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsFileControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { if (nsFormFrame::GetDisabled(this)) { *aFrame = this; return NS_OK; } else { - return nsAreaFrame::GetFrameForPoint(aPoint, aFrame); + return nsAreaFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); } return NS_OK; } @@ -473,7 +475,9 @@ nsresult nsFileControlFrame::RequiresWidget(PRBool& aRequiresWidget) } -NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, + const nsString& aValue) { nsresult rv = NS_OK; if (nsHTMLAtoms::value == aName) { @@ -516,14 +520,14 @@ nsFileControlFrame::Paint(nsIPresContext& aPresContext, // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsFileControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsFileControlFrame::GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eFileType; return NS_OK; } NS_IMETHODIMP -nsFileControlFrame::SaveState(nsISupports** aState) +nsFileControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { nsISupportsString* value = nsnull; nsAutoString string; @@ -546,13 +550,13 @@ nsFileControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsFileControlFrame::RestoreState(nsISupports* aState) +nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { char* chars = nsnull; nsresult res = ((nsISupportsString*)aState)->GetData(&chars); if (NS_SUCCEEDED(res) && chars) { nsAutoString value(chars); - SetProperty(nsHTMLAtoms::value, value); + SetProperty(aPresContext, nsHTMLAtoms::value, value); nsCRT::free(chars); } return res; diff --git a/mozilla/layout/forms/nsFileControlFrame.h b/mozilla/layout/forms/nsFileControlFrame.h index 6d4945fc382..4f9cb9cb06f 100644 --- a/mozilla/layout/forms/nsFileControlFrame.h +++ b/mozilla/layout/forms/nsFileControlFrame.h @@ -42,6 +42,16 @@ public: nsFileControlFrame(); virtual ~nsFileControlFrame(); + // XXX Hack so we can squirrel away the pres context pointer + NS_IMETHOD Init(nsIPresContext& aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) { + mPresContext = &aPresContext; + return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); + } + virtual void MouseClicked(nsIPresContext* aPresContext) {} virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } virtual nsFormFrame* GetFromFrame() { return mFormFrame; } @@ -52,7 +62,7 @@ public: nsFramePaintLayer aWhichLayer); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); @@ -63,7 +73,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight) { return NS_OK; }; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, @@ -77,7 +87,7 @@ public: NS_IMETHOD GetName(nsString* aName); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); NS_IMETHOD GetType(PRInt32* aType) const; void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); @@ -149,9 +159,9 @@ public: virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); protected: nsIWidget* GetWindowTemp(nsIView *aView); // XXX temporary @@ -162,6 +172,8 @@ protected: nsFormFrame* mFormFrame; nsIHTMLContent* mTextContent; nsString* mCachedState; + // XXX Hack: pres context needed by function MouseClick() + nsIPresContext* mPresContext; // weak reference private: nsTextControlFrame* GetTextControlFrame(nsIFrame* aStart); diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index 52fe6a81128..04a57fe6d3b 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -199,7 +199,7 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext, // positioned then we show it. if (NS_FRAME_REFLOW_FINISHED == aStatus) { nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (view) { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); @@ -462,7 +462,7 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext, } void -nsFormControlFrame::Reset() +nsFormControlFrame::Reset(nsIPresContext* aPresContext) { } @@ -533,7 +533,7 @@ nsFormControlFrame::SetCurrentCheckState(PRBool aState) } NS_IMETHODIMP -nsFormControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsFormControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { return NS_OK; } diff --git a/mozilla/layout/forms/nsFormControlFrame.h b/mozilla/layout/forms/nsFormControlFrame.h index 1ddd228ed48..d06ddee3f3f 100644 --- a/mozilla/layout/forms/nsFormControlFrame.h +++ b/mozilla/layout/forms/nsFormControlFrame.h @@ -156,7 +156,7 @@ public: virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); virtual void ScrollIntoView(nsIPresContext* aPresContext); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); /** @@ -203,7 +203,7 @@ public: nsSize& aSize); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); protected: diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp index 2c77d467436..ecd76fdfb4a 100644 --- a/mozilla/layout/forms/nsFormControlHelper.cpp +++ b/mozilla/layout/forms/nsFormControlHelper.cpp @@ -78,7 +78,7 @@ nsFormControlHelper::~nsFormControlHelper() MOZ_COUNT_DTOR(nsFormControlHelper); } -void nsFormControlHelper::ForceDrawFrame(nsIFrame * aFrame) +void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame) { if (aFrame == nsnull) { return; @@ -86,7 +86,7 @@ void nsFormControlHelper::ForceDrawFrame(nsIFrame * aFrame) nsRect rect; nsIView * view; nsPoint pnt; - aFrame->GetOffsetFromView(pnt, &view); + aFrame->GetOffsetFromView(aPresContext, pnt, &view); aFrame->GetRect(rect); rect.x = pnt.x; rect.y = pnt.y; diff --git a/mozilla/layout/forms/nsFormControlHelper.h b/mozilla/layout/forms/nsFormControlHelper.h index 56a8537964d..dbce3b26107 100644 --- a/mozilla/layout/forms/nsFormControlHelper.h +++ b/mozilla/layout/forms/nsFormControlHelper.h @@ -126,7 +126,7 @@ public: nsInputDimensionSpec& aSpec, nsSize& aSize); - static void ForceDrawFrame(nsIFrame * aFrame); + static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame); static nsresult GetValue(nsIContent* aContent, nsString* aResult); static nsresult GetName(nsIContent* aContent, nsString* aResult); diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp index 33dc6c6ff0b..6b83c2d7391 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -179,10 +179,11 @@ nsGfxCheckboxControlFrame :: GetCheckboxState ( ) } void -nsGfxCheckboxControlFrame :: SetCheckboxState ( nsCheckboxControlFrame::CheckState aValue ) +nsGfxCheckboxControlFrame :: SetCheckboxState (nsIPresContext* aPresContext, + nsCheckboxControlFrame::CheckState aValue ) { mChecked = aValue; - nsFormControlHelper::ForceDrawFrame(this); + nsFormControlHelper::ForceDrawFrame(aPresContext, this); } #ifdef DEBUG_rods diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.h b/mozilla/layout/forms/nsGfxCheckboxControlFrame.h index 81f728258a0..7f648c096c9 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.h +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.h @@ -45,7 +45,7 @@ public: protected: virtual CheckState GetCheckboxState(); - virtual void SetCheckboxState(CheckState aValue); + virtual void SetCheckboxState(nsIPresContext* aPresContext, CheckState aValue); virtual void PaintCheckBox(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp index 85b31e3ccdc..34ed5f5ddce 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp @@ -163,10 +163,10 @@ PRBool nsGfxRadioControlFrame::GetRadioState() return mChecked; } -void nsGfxRadioControlFrame::SetRadioState(PRBool aValue) +void nsGfxRadioControlFrame::SetRadioState(nsIPresContext* aPresContext, PRBool aValue) { mChecked = aValue; - nsFormControlHelper::ForceDrawFrame(this); + nsFormControlHelper::ForceDrawFrame(aPresContext, this); } #ifdef DEBUG_rods diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.h b/mozilla/layout/forms/nsGfxRadioControlFrame.h index e2b9f73e7ae..e1dcefd60b1 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.h +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.h @@ -70,7 +70,7 @@ public: protected: virtual PRBool GetRadioState(); - virtual void SetRadioState(PRBool aValue); + virtual void SetRadioState(nsIPresContext* aPresContext, PRBool aValue); //GFX-rendered state variables PRBool mChecked; diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index e121fe2c4d3..4488d15939f 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -278,7 +278,7 @@ nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) formContent->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); } if (nsEventStatus_eConsumeNoDefault != status) { - mFormFrame->OnReset(); + mFormFrame->OnReset(aPresContext); } } else if (IsSubmit(type) == PR_TRUE) { @@ -314,11 +314,11 @@ nsHTMLButtonControlFrame::ScrollIntoView(nsIPresContext* aPresContext) } void -nsHTMLButtonControlFrame::GetTranslatedRect(nsRect& aRect) +nsHTMLButtonControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect) { nsIView* view; nsPoint viewOffset(0,0); - GetOffsetFromView(viewOffset, &view); + GetOffsetFromView(aPresContext, viewOffset, &view); while (nsnull != view) { nsPoint tempOffset; view->GetPosition(&tempOffset.x, &tempOffset.y); @@ -353,7 +353,9 @@ nsHTMLButtonControlFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsHTMLButtonControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsHTMLButtonControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { *aFrame = this; return NS_OK; @@ -530,7 +532,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, // See if it's targeted at us aReflowState.reflowCommand->GetTarget(targetFrame); if (this == targetFrame) { - Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE); + Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE); nsIReflowCommand::ReflowType reflowType; aReflowState.reflowCommand->GetType(reflowType); @@ -552,7 +554,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, // Place the child nsRect rect = nsRect(focusPadding.left + aReflowState.mComputedBorderPadding.left, focusPadding.top + aReflowState.mComputedBorderPadding.top, aDesiredSize.width, aDesiredSize.height); - firstKid->SetRect(rect); + firstKid->SetRect(&aPresContext, rect); // if computed use the computed values. if (aReflowState.mComputedWidth != NS_INTRINSICSIZE && (aDesiredSize.width < aReflowState.mComputedWidth)) @@ -631,7 +633,8 @@ nsresult nsHTMLButtonControlFrame::RequiresWidget(PRBool& aRequiresWidget) } -NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, const nsString& aValue) { return NS_OK; } diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.h b/mozilla/layout/forms/nsHTMLButtonControlFrame.h index ea6f1560037..0a654aca52d 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.h @@ -75,7 +75,7 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, @@ -108,7 +108,7 @@ public: virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); virtual void MouseClicked(nsIPresContext* aPresContext); - virtual void Reset() {}; + virtual void Reset(nsIPresContext*) {}; virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } void SetFocus(PRBool aOn, PRBool aRepaint); @@ -129,7 +129,7 @@ public: void GetDefaultLabel(nsString& aLabel); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); @@ -140,7 +140,7 @@ protected: const nsHTMLReflowState& aSuggestedReflowState); NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); - void GetTranslatedRect(nsRect& aRect); + void GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect); PRIntn GetSkipSides() const; PRBool mInline; diff --git a/mozilla/layout/forms/nsIFormControlFrame.h b/mozilla/layout/forms/nsIFormControlFrame.h index 30f1ddde829..41f799bc974 100644 --- a/mozilla/layout/forms/nsIFormControlFrame.h +++ b/mozilla/layout/forms/nsIFormControlFrame.h @@ -52,7 +52,7 @@ public: virtual void MouseClicked(nsIPresContext* aPresContext) = 0; - virtual void Reset() = 0; + virtual void Reset(nsIPresContext* aPresContext) = 0; virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter) = 0; @@ -118,7 +118,7 @@ public: * @returns NS_OK if the property name is valid, otherwise an error code */ - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue) = 0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) = 0; /** * Get a property from the form control frame diff --git a/mozilla/layout/forms/nsIListControlFrame.h b/mozilla/layout/forms/nsIListControlFrame.h index e9c877d6cd9..a373c539fa6 100644 --- a/mozilla/layout/forms/nsIListControlFrame.h +++ b/mozilla/layout/forms/nsIListControlFrame.h @@ -62,7 +62,7 @@ public: * Initiates mouse capture for the listbox * */ - NS_IMETHOD CaptureMouseEvents(PRBool aGrabMouseEvents) = 0; + NS_IMETHOD CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) = 0; /** * Returns the maximum width and height of an item in the listbox @@ -79,7 +79,7 @@ public: /** * */ - NS_IMETHOD SyncViewWithFrame() = 0; + NS_IMETHOD SyncViewWithFrame(nsIPresContext* aPresContext) = 0; /** * diff --git a/mozilla/layout/forms/nsISelectControlFrame.h b/mozilla/layout/forms/nsISelectControlFrame.h index 8027a679e95..e9606a1a258 100644 --- a/mozilla/layout/forms/nsISelectControlFrame.h +++ b/mozilla/layout/forms/nsISelectControlFrame.h @@ -39,13 +39,13 @@ public: * Adds an option to the list at index */ - NS_IMETHOD AddOption(PRInt32 index) = 0; + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 index) = 0; /** * Removes the option at index */ - NS_IMETHOD RemoveOption(PRInt32 index) = 0; + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 index) = 0; /** * Sets the select state of the option at index diff --git a/mozilla/layout/forms/nsImageControlFrame.cpp b/mozilla/layout/forms/nsImageControlFrame.cpp index 9b191955e05..0fe4925a731 100644 --- a/mozilla/layout/forms/nsImageControlFrame.cpp +++ b/mozilla/layout/forms/nsImageControlFrame.cpp @@ -97,7 +97,7 @@ public: NS_IMETHOD GetName(nsString* aName); - virtual void Reset() {}; + virtual void Reset(nsIPresContext*) {}; void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); @@ -117,12 +117,12 @@ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); protected: - void GetTranslatedRect(nsRect& aRect); // XXX this implementation is a copy of nsHTMLButtonControlFrame + void GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect); // XXX this implementation is a copy of nsHTMLButtonControlFrame NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); @@ -198,7 +198,7 @@ nsImageControlFrame::Reflow(nsIPresContext& aPresContext, // create our view, we need a view to grab the mouse nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (!view) { nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view); nsCOMPtr presShell; @@ -208,14 +208,14 @@ nsImageControlFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(&aPresContext, &parWithView); + parWithView->GetView(&aPresContext, &parView); // the view's size is not know yet, but its size will be kept in synch with our frame. nsRect boundBox(0, 0, 500, 500); result = view->Init(viewMan, boundBox, parView, nsnull); view->SetContentTransparency(PR_TRUE); viewMan->InsertChild(parView, view, 0); - SetView(view); + SetView(&aPresContext, view); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); // set the opacity @@ -291,11 +291,11 @@ nsImageControlFrame::ScrollIntoView(nsIPresContext* aPresContext) } void -nsImageControlFrame::GetTranslatedRect(nsRect& aRect) +nsImageControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect) { nsIView* view; nsPoint viewOffset(0,0); - GetOffsetFromView(viewOffset, &view); + GetOffsetFromView(aPresContext, viewOffset, &view); while (nsnull != view) { nsPoint tempOffset; view->GetPosition(&tempOffset.x, &tempOffset.y); @@ -460,7 +460,8 @@ nsresult nsImageControlFrame::RequiresWidget(PRBool& aRequiresWidget) } -NS_IMETHODIMP nsImageControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsImageControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, const nsString& aValue) { return NS_OK; } diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 51f2edf8b20..5b7e79d75a1 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -508,14 +508,14 @@ nsListControlFrame::GetSelectableFrame(nsIFrame *aFrame) //--------------------------------------------------------- void -nsListControlFrame::ForceRedraw() +nsListControlFrame::ForceRedraw(nsIPresContext* aPresContext) { //XXX: Hack. This should not be needed. The problem is DisplaySelected //and DisplayDeselected set and unset an attribute on generic HTML content //which does not know that it should repaint as the result of the attribute //being set. This should not be needed once the event state manager handles //selection. - nsFormControlHelper::ForceDrawFrame(this); + nsFormControlHelper::ForceDrawFrame(aPresContext, this); } @@ -803,12 +803,12 @@ nsListControlFrame::HasSameContent(nsIFrame* aFrame1, nsIFrame* aFrame2) //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::CaptureMouseEvents(PRBool aGrabMouseEvents) +nsListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) { // get its view nsIView* view = nsnull; - GetView(&view); + GetView(aPresContext, &view); nsCOMPtr viewMan; PRBool result; @@ -974,7 +974,7 @@ nsListControlFrame::Init(nsIPresContext& aPresContext, // get the proper style based on attribute selectors which refer to the // selected attribute. if (!mIsInitializedFromContent) { - Reset(); + Reset(&aPresContext); } else { InitSelectionCache(-1); } @@ -1320,7 +1320,7 @@ nsListControlFrame::GetMaxNumValues() // those values as determined by the original HTML //--------------------------------------------------------- void -nsListControlFrame::Reset() +nsListControlFrame::Reset(nsIPresContext* aPresContext) { nsIDOMHTMLCollection* options = GetOptions(mContent); if (!options) { @@ -1604,7 +1604,7 @@ nsListControlFrame::ToggleSelected(PRInt32 aIndex) // nsISelectControlFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::AddOption(PRInt32 aIndex) +nsListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { PRInt32 numOptions; GetNumberOfOptions(&numOptions); @@ -1623,7 +1623,7 @@ nsListControlFrame::AddOption(PRInt32 aIndex) } NS_IMETHODIMP -nsListControlFrame::RemoveOption(PRInt32 aIndex) +nsListControlFrame::RemoveOption(nsIPresContext* aPresContext, PRInt32 aIndex) { PRInt32 numOptions; GetNumberOfOptions(&numOptions); @@ -1815,7 +1815,7 @@ nsListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue) //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. @@ -1919,7 +1919,7 @@ nsListControlFrame::GetViewOffset(nsIViewManager* aManager, nsIView* aView, //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::SyncViewWithFrame() +nsListControlFrame::SyncViewWithFrame(nsIPresContext* aPresContext) { // Resync the view's position with the frame. // The problem is the dropdown's view is attached directly under @@ -1932,21 +1932,21 @@ nsListControlFrame::SyncViewWithFrame() //Get parent frame nsIFrame* parent; - GetParentWithView(&parent); + GetParentWithView(aPresContext, &parent); NS_ASSERTION(parent, "GetParentWithView failed"); // Get parent view nsIView* parentView = nsnull; - parent->GetView(&parentView); + parent->GetView(aPresContext, &parentView); parentView->GetViewManager(*getter_AddRefs(viewManager)); GetViewOffset(viewManager, parentView, parentPos); nsIView* view = nsnull; - GetView(&view); + GetView(aPresContext, &view); nsIView* containingView = nsnull; nsPoint offset; - GetOffsetFromView(offset, &containingView); + GetOffsetFromView(aPresContext, offset, &containingView); //nsSize size; //GetSize(size); @@ -2001,12 +2001,14 @@ nsListControlFrame::AboutToRollup() //--------------------------------------------------------- nsresult -nsListControlFrame::GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView) +nsListControlFrame::GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView) { if (IsInDropDownMode() == PR_TRUE) { // Use the parent frame to get the view manager nsIView* parentView = nsnull; - nsresult rv = aParent->GetView(&parentView); + nsresult rv = aParent->GetView(aPresContext, &parentView); NS_ASSERTION(parentView, "GetView failed"); nsCOMPtr viewManager; parentView->GetViewManager(*getter_AddRefs(viewManager)); @@ -2022,7 +2024,7 @@ nsListControlFrame::GetScrollingParentView(nsIFrame* aParent, nsIView** aParentV NS_ASSERTION(aParentView, "GetRootView failed"); return rv; } else { - return nsScrollFrame::GetScrollingParentView(aParent, aParentView); + return nsScrollFrame::GetScrollingParentView(aPresContext, aParent, aParentView); } } @@ -2037,25 +2039,25 @@ nsListControlFrame::DidReflow(nsIPresContext& aPresContext, mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus); mState |= NS_FRAME_SYNC_FRAME_AND_VIEW; - SyncViewWithFrame(); + SyncViewWithFrame(&aPresContext); return rv; } else { return nsScrollFrame::DidReflow(aPresContext, aStatus); } } -NS_IMETHODIMP nsListControlFrame::MoveTo(nscoord aX, nscoord aY) +NS_IMETHODIMP nsListControlFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY) { if (PR_TRUE == IsInDropDownMode()) { //SyncViewWithFrame(); mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; - nsresult rv = nsScrollFrame::MoveTo(aX, aY); + nsresult rv = nsScrollFrame::MoveTo(aPresContext, aX, aY); mState |= NS_FRAME_SYNC_FRAME_AND_VIEW; //SyncViewWithFrame(); return rv; } else { - return nsScrollFrame::MoveTo(aX, aY); + return nsScrollFrame::MoveTo(aPresContext, aX, aY); } } @@ -2150,7 +2152,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent) } } else { mButtonDown = PR_FALSE; - CaptureMouseEvents(PR_FALSE); + CaptureMouseEvents(mPresContext, PR_FALSE); UpdateSelection(PR_TRUE, PR_FALSE, mContent); } @@ -2227,10 +2229,10 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) // the pop up stole focus away from the webshell // now I am giving it back nsIFrame * parentFrame; - GetParentWithView(&parentFrame); + GetParentWithView(mPresContext, &parentFrame); if (nsnull != parentFrame) { nsIView * pView; - parentFrame->GetView(&pView); + parentFrame->GetView(mPresContext, &pView); if (nsnull != pView) { nsIWidget *window = nsnull; @@ -2257,7 +2259,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) mOldSelectedIndex = oldIndex; // Handle Like List mButtonDown = PR_TRUE; - CaptureMouseEvents(PR_TRUE); + CaptureMouseEvents(mPresContext, PR_TRUE); HandleListSelection(aMouseEvent); } } else { @@ -2291,7 +2293,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) //stateManager->SetContentState(mContent, NS_EVENT_STATE_FOCUS); if (isDroppedDown) { - CaptureMouseEvents(PR_FALSE); + CaptureMouseEvents(mPresContext, PR_FALSE); } NS_RELEASE(stateManager); @@ -2438,14 +2440,16 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent) // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsListControlFrame::GetStateType(nsIPresContext* aPresContext, + nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eSelectType; return NS_OK; } NS_IMETHODIMP -nsListControlFrame::SaveState(nsISupports** aState) +nsListControlFrame::SaveState(nsIPresContext* aPresContext, + nsISupports** aState) { nsISupportsArray* value = nsnull; nsresult res = NS_NewISupportsArray(&value); @@ -2480,7 +2484,8 @@ nsListControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsListControlFrame::RestoreState(nsISupports* aState) +nsListControlFrame::RestoreState(nsIPresContext* aPresContext, + nsISupports* aState) { nsISupportsArray* value = (nsISupportsArray *)aState; nsresult res = NS_ERROR_NULL_POINTER; diff --git a/mozilla/layout/forms/nsListControlFrame.h b/mozilla/layout/forms/nsListControlFrame.h index 781d8736ff0..4d75808dc51 100644 --- a/mozilla/layout/forms/nsListControlFrame.h +++ b/mozilla/layout/forms/nsListControlFrame.h @@ -75,12 +75,12 @@ public: nsIFrame* aPrevInFlow); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); + NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY); // nsIFormControlFrame NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetName(nsString* aName); - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, @@ -90,7 +90,7 @@ public: virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); virtual void ScrollIntoView(nsIPresContext* aPresContext); virtual void MouseClicked(nsIPresContext* aPresContext); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, @@ -112,25 +112,25 @@ public: NS_IMETHOD SetComboboxFrame(nsIFrame* aComboboxFrame); NS_IMETHOD GetSelectedIndex(PRInt32* aIndex); NS_IMETHOD GetSelectedItem(nsString & aStr); - NS_IMETHOD CaptureMouseEvents(PRBool aGrabMouseEvents); + NS_IMETHOD CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents); NS_IMETHOD GetMaximumSize(nsSize &aSize); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetNumberOfOptions(PRInt32* aNumOptions); - NS_IMETHOD SyncViewWithFrame(); + NS_IMETHOD SyncViewWithFrame(nsIPresContext* aPresContext); NS_IMETHOD AboutToDropDown(); NS_IMETHOD AboutToRollup(); NS_IMETHOD UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, nsIContent* aContent); // nsISelectControlFrame - NS_IMETHOD AddOption(PRInt32 index); - NS_IMETHOD RemoveOption(PRInt32 index); + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 index); + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 index); NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue); NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue); //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); //nsIDOMEventListener virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent); @@ -168,7 +168,9 @@ protected: // Override the widget created for the list box so a Borderless top level widget is created // for drop-down lists. virtual nsresult CreateScrollingViewWidget(nsIView* aView,const nsStylePosition* aPosition); - virtual nsresult GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView); + virtual nsresult GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView); PRInt32 GetNumberOfOptions(); // Utility methods @@ -192,7 +194,7 @@ protected: nsIFrame *GetSelectableFrame(nsIFrame *aFrame); void DisplaySelected(nsIContent* aContent); void DisplayDeselected(nsIContent* aContent); - void ForceRedraw(); + void ForceRedraw(nsIPresContext* aPresContext); PRBool IsOptionGroup(nsIFrame* aFrame); void SingleSelection(); void MultipleSelection(PRBool aIsShift, PRBool aIsControl); diff --git a/mozilla/layout/forms/nsSelectsAreaFrame.cpp b/mozilla/layout/forms/nsSelectsAreaFrame.cpp index 8e17b7536f6..00f42b51a61 100644 --- a/mozilla/layout/forms/nsSelectsAreaFrame.cpp +++ b/mozilla/layout/forms/nsSelectsAreaFrame.cpp @@ -86,9 +86,11 @@ nsSelectsAreaFrame::IsOptionElementFrame(nsIFrame *aFrame) //--------------------------------------------------------- NS_IMETHODIMP -nsSelectsAreaFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsSelectsAreaFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsAreaFrame::GetFrameForPoint(aPoint, aFrame); + nsAreaFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); nsIFrame* selectedFrame = *aFrame; diff --git a/mozilla/layout/forms/nsSelectsAreaFrame.h b/mozilla/layout/forms/nsSelectsAreaFrame.h index 22547370761..311a3de06a8 100644 --- a/mozilla/layout/forms/nsSelectsAreaFrame.h +++ b/mozilla/layout/forms/nsSelectsAreaFrame.h @@ -35,7 +35,7 @@ public: // nsISupports //NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); protected: PRBool IsOptionElement(nsIContent* aContent); diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index c12abaa53f7..dc0018c008e 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -349,14 +349,14 @@ nsTextControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight) // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsTextControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsTextControlFrame::GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eTextType; return NS_OK; } NS_IMETHODIMP -nsTextControlFrame::SaveState(nsISupports** aState) +nsTextControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { nsISupportsString* value = nsnull; nsAutoString string; @@ -379,13 +379,13 @@ nsTextControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsTextControlFrame::RestoreState(nsISupports* aState) +nsTextControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { char* chars = nsnull; nsresult res = ((nsISupportsString*)aState)->GetData(&chars); if (NS_SUCCEEDED(res) && chars) { nsAutoString string(chars); - res = SetProperty(nsHTMLAtoms::value, string); + res = SetProperty(aPresContext, nsHTMLAtoms::value, string); nsCRT::free(chars); } return res; diff --git a/mozilla/layout/forms/nsTextControlFrame.h b/mozilla/layout/forms/nsTextControlFrame.h index c6b2b4afad2..83444e176a0 100644 --- a/mozilla/layout/forms/nsTextControlFrame.h +++ b/mozilla/layout/forms/nsTextControlFrame.h @@ -56,9 +56,9 @@ public: NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); protected: @@ -81,7 +81,7 @@ private: /* ---------- abstract methods derived class must implement ---------- */ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue)=0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)=0; NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue)=0; virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext& aPresContext)=0; diff --git a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp index 3c6cec3b5d2..4d02a172b09 100644 --- a/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/generic/nsAbsoluteContainingBlock.cpp @@ -365,7 +365,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat nsRect rect(border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left, border.top + kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - aKidFrame->SetRect(rect); + aKidFrame->SetRect(&aPresContext, rect); } return rv; diff --git a/mozilla/layout/generic/nsAreaFrame.cpp b/mozilla/layout/generic/nsAreaFrame.cpp index 4b0a864163a..fb3c0674d1a 100644 --- a/mozilla/layout/generic/nsAreaFrame.cpp +++ b/mozilla/layout/generic/nsAreaFrame.cpp @@ -339,7 +339,7 @@ nsAreaFrame::DidReflow(nsIPresContext& aPresContext, const nsStyleDisplay* display = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); - GetView(&view); + GetView(&aPresContext, &view); if (view && (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow)) { // Don't let our base class position the view since we're doing it mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; @@ -357,7 +357,7 @@ nsAreaFrame::DidReflow(nsIPresContext& aPresContext, // XXX We need to handle the case where child frames stick out on the // left and top edges as well... - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); vm->ResizeView(view, mCombinedArea.XMost(), mCombinedArea.YMost()); vm->MoveViewTo(view, origin.x, origin.y); NS_RELEASE(vm); diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 9fd40ccd31c..ad3f9816883 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -1016,7 +1016,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, fc->mCombinedArea.y += finalDeltaY; nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame(); floater->GetRect(r); - floater->MoveTo(r.x, r.y + finalDeltaY); + floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY); #ifdef DEBUG if (gNoisyReflow || gNoisySpaceManager) { nscoord tx, ty; @@ -1161,12 +1161,12 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) } NS_METHOD -nsBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -1211,7 +1211,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const if (nsnull != mLines) { nsLineBox* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(aPresContext, out, aIndent); line = line->mNext; } } @@ -1234,7 +1234,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1416,7 +1416,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=initial\n"); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareInitialReflow(state); mState &= ~NS_FRAME_FIRST_REFLOW; break; @@ -1467,7 +1467,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=resize (%d)\n", aReflowState.reason); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareResizeReflow(state); break; } @@ -1534,7 +1534,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, if (isStyleChange) { // Lots of things could have changed so damage our entire // bounds - Invalidate(nsRect(0, 0, mRect.width, mRect.height)); + Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height)); } else { nsMargin border = aReflowState.mComputedBorderPadding - @@ -1560,7 +1560,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.height = mRect.height; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } // See if our height changed @@ -1583,7 +1583,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = mRect.height - border.bottom; damageRect.height = border.bottom; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } } @@ -2429,7 +2429,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) RecoverStateFrom(aState, line, deltaY, incrementalReflow ? &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { - Invalidate(damageRect); + Invalidate(aState.mPresContext, damageRect); } } @@ -2482,7 +2482,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) frame->SetParent(this); // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, mNextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, mNextInFlow, this); lastFrame = frame; frame->GetNextSibling(&frame); } @@ -2602,7 +2602,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // XXX We need to improve on this... nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } else { if (oldCombinedArea.width != lineCombinedArea.width) { @@ -2618,7 +2618,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.x; dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } if (oldCombinedArea.height != lineCombinedArea.height) { nsRect dirtyRect; @@ -2633,7 +2633,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.YMost(), lineCombinedArea.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } } @@ -2649,7 +2649,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } @@ -2758,7 +2758,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState, // When pushing and pulling frames we need to check for whether any // views need to be reparented NS_ASSERTION(oldParentFrame != this, "unexpected parent frame"); - nsHTMLContainerFrame::ReparentFrameView(frame, oldParentFrame, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, oldParentFrame, this); // The frame is being pulled from a next-in-flow; therefore we // need to add it to our sibling list. @@ -2796,7 +2796,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, kid->GetRect(r); if (aDY) { r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); } // If the child has any floaters that impact the space-manager, @@ -2827,7 +2827,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, while (--n >= 0) { kid->GetRect(r); r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); kid->GetNextSibling(&kid); } } @@ -3361,7 +3361,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nscoord bulletTopMargin = applyTopMargin ? collapsedBottomMargin : 0; bbox.y = aState.BorderPadding().top + ascent - metrics.ascent + bulletTopMargin; - mBullet->SetRect(bbox); + mBullet->SetRect(aState.mPresContext, bbox); } } else { @@ -4160,7 +4160,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState) } PRBool -nsBlockFrame::DrainOverflowLines() +nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) { #ifdef DEBUG VerifyOverflowSituation(); @@ -4183,7 +4183,7 @@ nsBlockFrame::DrainOverflowLines() // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, prevBlock, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this); // Get the next frame lastFrame = frame; @@ -4721,7 +4721,7 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent(&oldParent); aFrame->SetParent(this); if (this != oldParent) { - nsHTMLContainerFrame::ReparentFrameView(aFrame, oldParent, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this); aPresContext->ReParentStyleContext(aFrame, mStyleContext); } aFrame->GetNextSibling(&aFrame); @@ -4902,7 +4902,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, // cases... nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); - Invalidate(lineCombinedArea); + Invalidate(aPresContext, lineCombinedArea); delete line; line = next; } @@ -5063,7 +5063,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, const nsHTMLReflowMetrics& metrics = brc.GetMetrics(); aCombinedRect = metrics.mCombinedArea; - floater->SizeTo(metrics.width, metrics.height); + floater->SizeTo(aState.mPresContext, metrics.width, metrics.height); // Stash away the max-element-size for later aState.StoreMaxElementSize(floater, brc.GetMaxElementSize()); @@ -5402,7 +5402,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, x += aFloaterCache->mOffsets.left; y += aFloaterCache->mOffsets.top; } - floater->MoveTo(x, y); + floater->MoveTo(mPresContext, x, y); // Update the floater combined area state nsRect combinedArea = aFloaterCache->mCombinedArea; @@ -5818,7 +5818,7 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, while(NS_SUCCEEDED(result)) { //we are starting aloop to allow us to "drill down to the one we want" - mainframe->GetOffsetFromView(origin, &parentWithView); + mainframe->GetOffsetFromView(&aPresContext, origin, &parentWithView); if (NS_FAILED(result)) return NS_OK;//do not handle @@ -5865,7 +5865,8 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - result = nsFrame::GetNextPrevLineFromeBlockFrame(&pos, + result = nsFrame::GetNextPrevLineFromeBlockFrame(&aPresContext, + &pos, mainframe, closestLine-1, 0 @@ -5893,20 +5894,22 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsresult rv = GetFrameForPointUsing(aPoint, nsnull, aFrame); + nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); if (NS_OK == rv) { return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (mFloaters.NotEmpty()) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } @@ -6339,7 +6342,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // the final vertical location. const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; - mBullet->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height)); + mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index 9d30e359ee7..b9a35c5a3ce 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -93,14 +93,14 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif NS_IMETHOD VerifyTree() const; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus); @@ -161,7 +161,7 @@ protected: void SlideLine(nsBlockReflowState& aState, nsLineBox* aLine, nscoord aDY); - PRBool DrainOverflowLines(); + PRBool DrainOverflowLines(nsIPresContext* aPresContext); virtual PRIntn GetSkipSides() const; diff --git a/mozilla/layout/generic/nsBlockReflowContext.cpp b/mozilla/layout/generic/nsBlockReflowContext.cpp index 01c9c92be88..c48c29ac937 100644 --- a/mozilla/layout/generic/nsBlockReflowContext.cpp +++ b/mozilla/layout/generic/nsBlockReflowContext.cpp @@ -419,7 +419,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, // Empty blocks do not have anything special done to them and they // always fit. Note: don't force the width to 0 nsRect r(x, y, mMetrics.width, 0); - mFrame->SetRect(r); + mFrame->SetRect(mPresContext, r); aInFlowBounds = r; // Retain combined area information in case we contain a floater @@ -547,7 +547,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, aCombinedRect.height = mMetrics.mCombinedArea.height; // Now place the frame - mFrame->SetRect(nsRect(x, y, mMetrics.width, mMetrics.height)); + mFrame->SetRect(mPresContext, nsRect(x, y, mMetrics.width, mMetrics.height)); // XXX obsolete, i believe... #if 0 diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index 9fd40ccd31c..ad3f9816883 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -1016,7 +1016,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, fc->mCombinedArea.y += finalDeltaY; nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame(); floater->GetRect(r); - floater->MoveTo(r.x, r.y + finalDeltaY); + floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY); #ifdef DEBUG if (gNoisyReflow || gNoisySpaceManager) { nscoord tx, ty; @@ -1161,12 +1161,12 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) } NS_METHOD -nsBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -1211,7 +1211,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const if (nsnull != mLines) { nsLineBox* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(aPresContext, out, aIndent); line = line->mNext; } } @@ -1234,7 +1234,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1416,7 +1416,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=initial\n"); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareInitialReflow(state); mState &= ~NS_FRAME_FIRST_REFLOW; break; @@ -1467,7 +1467,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=resize (%d)\n", aReflowState.reason); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareResizeReflow(state); break; } @@ -1534,7 +1534,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, if (isStyleChange) { // Lots of things could have changed so damage our entire // bounds - Invalidate(nsRect(0, 0, mRect.width, mRect.height)); + Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height)); } else { nsMargin border = aReflowState.mComputedBorderPadding - @@ -1560,7 +1560,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.height = mRect.height; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } // See if our height changed @@ -1583,7 +1583,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = mRect.height - border.bottom; damageRect.height = border.bottom; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } } @@ -2429,7 +2429,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) RecoverStateFrom(aState, line, deltaY, incrementalReflow ? &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { - Invalidate(damageRect); + Invalidate(aState.mPresContext, damageRect); } } @@ -2482,7 +2482,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) frame->SetParent(this); // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, mNextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, mNextInFlow, this); lastFrame = frame; frame->GetNextSibling(&frame); } @@ -2602,7 +2602,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // XXX We need to improve on this... nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } else { if (oldCombinedArea.width != lineCombinedArea.width) { @@ -2618,7 +2618,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.x; dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } if (oldCombinedArea.height != lineCombinedArea.height) { nsRect dirtyRect; @@ -2633,7 +2633,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.YMost(), lineCombinedArea.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } } @@ -2649,7 +2649,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } @@ -2758,7 +2758,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState, // When pushing and pulling frames we need to check for whether any // views need to be reparented NS_ASSERTION(oldParentFrame != this, "unexpected parent frame"); - nsHTMLContainerFrame::ReparentFrameView(frame, oldParentFrame, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, oldParentFrame, this); // The frame is being pulled from a next-in-flow; therefore we // need to add it to our sibling list. @@ -2796,7 +2796,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, kid->GetRect(r); if (aDY) { r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); } // If the child has any floaters that impact the space-manager, @@ -2827,7 +2827,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, while (--n >= 0) { kid->GetRect(r); r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); kid->GetNextSibling(&kid); } } @@ -3361,7 +3361,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nscoord bulletTopMargin = applyTopMargin ? collapsedBottomMargin : 0; bbox.y = aState.BorderPadding().top + ascent - metrics.ascent + bulletTopMargin; - mBullet->SetRect(bbox); + mBullet->SetRect(aState.mPresContext, bbox); } } else { @@ -4160,7 +4160,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState) } PRBool -nsBlockFrame::DrainOverflowLines() +nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) { #ifdef DEBUG VerifyOverflowSituation(); @@ -4183,7 +4183,7 @@ nsBlockFrame::DrainOverflowLines() // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, prevBlock, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this); // Get the next frame lastFrame = frame; @@ -4721,7 +4721,7 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent(&oldParent); aFrame->SetParent(this); if (this != oldParent) { - nsHTMLContainerFrame::ReparentFrameView(aFrame, oldParent, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this); aPresContext->ReParentStyleContext(aFrame, mStyleContext); } aFrame->GetNextSibling(&aFrame); @@ -4902,7 +4902,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, // cases... nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); - Invalidate(lineCombinedArea); + Invalidate(aPresContext, lineCombinedArea); delete line; line = next; } @@ -5063,7 +5063,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, const nsHTMLReflowMetrics& metrics = brc.GetMetrics(); aCombinedRect = metrics.mCombinedArea; - floater->SizeTo(metrics.width, metrics.height); + floater->SizeTo(aState.mPresContext, metrics.width, metrics.height); // Stash away the max-element-size for later aState.StoreMaxElementSize(floater, brc.GetMaxElementSize()); @@ -5402,7 +5402,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, x += aFloaterCache->mOffsets.left; y += aFloaterCache->mOffsets.top; } - floater->MoveTo(x, y); + floater->MoveTo(mPresContext, x, y); // Update the floater combined area state nsRect combinedArea = aFloaterCache->mCombinedArea; @@ -5818,7 +5818,7 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, while(NS_SUCCEEDED(result)) { //we are starting aloop to allow us to "drill down to the one we want" - mainframe->GetOffsetFromView(origin, &parentWithView); + mainframe->GetOffsetFromView(&aPresContext, origin, &parentWithView); if (NS_FAILED(result)) return NS_OK;//do not handle @@ -5865,7 +5865,8 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - result = nsFrame::GetNextPrevLineFromeBlockFrame(&pos, + result = nsFrame::GetNextPrevLineFromeBlockFrame(&aPresContext, + &pos, mainframe, closestLine-1, 0 @@ -5893,20 +5894,22 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsresult rv = GetFrameForPointUsing(aPoint, nsnull, aFrame); + nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); if (NS_OK == rv) { return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (mFloaters.NotEmpty()) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } @@ -6339,7 +6342,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // the final vertical location. const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; - mBullet->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height)); + mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index 9fd40ccd31c..ad3f9816883 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -1016,7 +1016,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, fc->mCombinedArea.y += finalDeltaY; nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame(); floater->GetRect(r); - floater->MoveTo(r.x, r.y + finalDeltaY); + floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY); #ifdef DEBUG if (gNoisyReflow || gNoisySpaceManager) { nscoord tx, ty; @@ -1161,12 +1161,12 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) } NS_METHOD -nsBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -1211,7 +1211,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const if (nsnull != mLines) { nsLineBox* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(aPresContext, out, aIndent); line = line->mNext; } } @@ -1234,7 +1234,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1416,7 +1416,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=initial\n"); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareInitialReflow(state); mState &= ~NS_FRAME_FIRST_REFLOW; break; @@ -1467,7 +1467,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=resize (%d)\n", aReflowState.reason); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareResizeReflow(state); break; } @@ -1534,7 +1534,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, if (isStyleChange) { // Lots of things could have changed so damage our entire // bounds - Invalidate(nsRect(0, 0, mRect.width, mRect.height)); + Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height)); } else { nsMargin border = aReflowState.mComputedBorderPadding - @@ -1560,7 +1560,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.height = mRect.height; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } // See if our height changed @@ -1583,7 +1583,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = mRect.height - border.bottom; damageRect.height = border.bottom; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } } @@ -2429,7 +2429,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) RecoverStateFrom(aState, line, deltaY, incrementalReflow ? &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { - Invalidate(damageRect); + Invalidate(aState.mPresContext, damageRect); } } @@ -2482,7 +2482,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) frame->SetParent(this); // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, mNextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, mNextInFlow, this); lastFrame = frame; frame->GetNextSibling(&frame); } @@ -2602,7 +2602,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // XXX We need to improve on this... nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } else { if (oldCombinedArea.width != lineCombinedArea.width) { @@ -2618,7 +2618,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.x; dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } if (oldCombinedArea.height != lineCombinedArea.height) { nsRect dirtyRect; @@ -2633,7 +2633,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.YMost(), lineCombinedArea.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } } @@ -2649,7 +2649,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } @@ -2758,7 +2758,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState, // When pushing and pulling frames we need to check for whether any // views need to be reparented NS_ASSERTION(oldParentFrame != this, "unexpected parent frame"); - nsHTMLContainerFrame::ReparentFrameView(frame, oldParentFrame, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, oldParentFrame, this); // The frame is being pulled from a next-in-flow; therefore we // need to add it to our sibling list. @@ -2796,7 +2796,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, kid->GetRect(r); if (aDY) { r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); } // If the child has any floaters that impact the space-manager, @@ -2827,7 +2827,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, while (--n >= 0) { kid->GetRect(r); r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); kid->GetNextSibling(&kid); } } @@ -3361,7 +3361,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nscoord bulletTopMargin = applyTopMargin ? collapsedBottomMargin : 0; bbox.y = aState.BorderPadding().top + ascent - metrics.ascent + bulletTopMargin; - mBullet->SetRect(bbox); + mBullet->SetRect(aState.mPresContext, bbox); } } else { @@ -4160,7 +4160,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState) } PRBool -nsBlockFrame::DrainOverflowLines() +nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) { #ifdef DEBUG VerifyOverflowSituation(); @@ -4183,7 +4183,7 @@ nsBlockFrame::DrainOverflowLines() // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, prevBlock, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this); // Get the next frame lastFrame = frame; @@ -4721,7 +4721,7 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent(&oldParent); aFrame->SetParent(this); if (this != oldParent) { - nsHTMLContainerFrame::ReparentFrameView(aFrame, oldParent, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this); aPresContext->ReParentStyleContext(aFrame, mStyleContext); } aFrame->GetNextSibling(&aFrame); @@ -4902,7 +4902,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, // cases... nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); - Invalidate(lineCombinedArea); + Invalidate(aPresContext, lineCombinedArea); delete line; line = next; } @@ -5063,7 +5063,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, const nsHTMLReflowMetrics& metrics = brc.GetMetrics(); aCombinedRect = metrics.mCombinedArea; - floater->SizeTo(metrics.width, metrics.height); + floater->SizeTo(aState.mPresContext, metrics.width, metrics.height); // Stash away the max-element-size for later aState.StoreMaxElementSize(floater, brc.GetMaxElementSize()); @@ -5402,7 +5402,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, x += aFloaterCache->mOffsets.left; y += aFloaterCache->mOffsets.top; } - floater->MoveTo(x, y); + floater->MoveTo(mPresContext, x, y); // Update the floater combined area state nsRect combinedArea = aFloaterCache->mCombinedArea; @@ -5818,7 +5818,7 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, while(NS_SUCCEEDED(result)) { //we are starting aloop to allow us to "drill down to the one we want" - mainframe->GetOffsetFromView(origin, &parentWithView); + mainframe->GetOffsetFromView(&aPresContext, origin, &parentWithView); if (NS_FAILED(result)) return NS_OK;//do not handle @@ -5865,7 +5865,8 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - result = nsFrame::GetNextPrevLineFromeBlockFrame(&pos, + result = nsFrame::GetNextPrevLineFromeBlockFrame(&aPresContext, + &pos, mainframe, closestLine-1, 0 @@ -5893,20 +5894,22 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsresult rv = GetFrameForPointUsing(aPoint, nsnull, aFrame); + nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); if (NS_OK == rv) { return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (mFloaters.NotEmpty()) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } @@ -6339,7 +6342,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // the final vertical location. const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; - mBullet->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height)); + mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index 9eb20819086..b7d4bfd1678 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -80,7 +80,7 @@ nsContainerFrame::Destroy(nsIPresContext& aPresContext) { // Prevent event dispatch during destruction nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull != view) { view->SetClientData(nsnull); } @@ -205,7 +205,7 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, nsFramePaintLayer aWhichLayer) { nsIView *pView; - aFrame->GetView(&pView); + aFrame->GetView(&aPresContext, &pView); if (nsnull == pView) { nsRect kidRect; aFrame->GetRect(kidRect); @@ -263,14 +263,16 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsContainerFrame::GetFrameForPoint(const nsPoint& aPoint, +nsContainerFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) { - return GetFrameForPointUsing(aPoint, nsnull, aFrame); + return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); } nsresult -nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, +nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIAtom* aList, nsIFrame** aFrame) { @@ -284,7 +286,7 @@ nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, kid->GetRect(kidRect); if (kidRect.Contains(aPoint)) { tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y); - return kid->GetFrameForPoint(tmp, aFrame); + return kid->GetFrameForPoint(aPresContext, tmp, aFrame); } kid->GetNextSibling(&kid); } @@ -296,7 +298,7 @@ nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, if (NS_FRAME_OUTSIDE_CHILDREN & state) { kid->GetRect(kidRect); tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y); - if (NS_OK == kid->GetFrameForPoint(tmp, aFrame)) { + if (NS_OK == kid->GetFrameForPoint(aPresContext, tmp, aFrame)) { return NS_OK; } else { @@ -561,7 +563,7 @@ nsContainerFrame::PushChildren(nsIPresContext* aPresContext, // When pushing and pulling frames we need to check for whether any // views need to be reparented. for (nsIFrame* f = aFromChild; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, this, mNextInFlow); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, this, mNextInFlow); } nextInFlow->mFrames.InsertFrames(mNextInFlow, nsnull, aFromChild); } @@ -594,7 +596,7 @@ nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) // When pushing and pulling frames we need to check for whether any // views need to be reparented. for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); } mFrames.InsertFrames(this, nsnull, prevOverflowFrames); result = PR_TRUE; @@ -615,12 +617,12 @@ nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) // Debugging NS_IMETHODIMP -nsContainerFrame::List(FILE* out, PRInt32 aIndent) const +nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -658,7 +660,7 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index a7a2d221455..6ec21ed5a38 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -37,14 +37,15 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame); NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif @@ -66,7 +67,8 @@ protected: nsContainerFrame(); ~nsContainerFrame(); - nsresult GetFrameForPointUsing(const nsPoint& aPoint, + nsresult GetFrameForPointUsing(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIAtom* aList, nsIFrame** aFrame); diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index d424ef07859..1e667fd6c15 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -216,8 +216,8 @@ nsFirstLetterFrame::Reflow(nsIPresContext& aPresContext, } // Place and size the child and update the output metrics - kid->MoveTo(bp.left, bp.top); - kid->SizeTo(aMetrics.width, aMetrics.height); + kid->MoveTo(&aPresContext, bp.left, bp.top); + kid->SizeTo(&aPresContext, aMetrics.width, aMetrics.height); aMetrics.width += lr; aMetrics.height += tb; if (aMetrics.maxElementSize) { @@ -278,7 +278,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext) // views need to be reparented. nsIFrame* f = overflowFrames; while (f) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); f->GetNextSibling(&f); } mFrames.InsertFrames(this, nsnull, overflowFrames); diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index aac1fdc6fd9..7c125ffdc11 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -77,7 +77,7 @@ static NS_DEFINE_IID(kCTransferableCID, NS_TRANSFERABLE_CID); #include "nsICaret.h" #include "nsILineIterator.h" // [HACK] Foward Declarations -void ForceDrawFrame(nsFrame * aFrame); +void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame); //non Hack prototypes #if 0 static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aStartContent, nsIContent * aEndContent); @@ -487,14 +487,15 @@ NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const return NS_OK; } -NS_IMETHODIMP nsFrame::SetRect(const nsRect& aRect) +NS_IMETHODIMP nsFrame::SetRect(nsIPresContext* aPresContext, + const nsRect& aRect) { - MoveTo(aRect.x, aRect.y); - SizeTo(aRect.width, aRect.height); + MoveTo(aPresContext, aRect.x, aRect.y); + SizeTo(aPresContext, aRect.width, aRect.height); return NS_OK; } -NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) +NS_IMETHODIMP nsFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY) { mRect.x = aX; mRect.y = aY; @@ -509,7 +510,7 @@ NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) // parent frame (our parent frame may not have a view). nsIView* parentWithView; nsPoint origin; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(aPresContext, origin, &parentWithView); nsIViewManager *vm; mView->GetViewManager(vm); vm->MoveViewTo(mView, origin.x, origin.y); @@ -520,7 +521,7 @@ NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) return NS_OK; } -NS_IMETHODIMP nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) +NS_IMETHODIMP nsFrame::SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight) { mRect.width = aWidth; mRect.height = aHeight; @@ -881,7 +882,7 @@ nsFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_TRUE, PR_TRUE); - rv = PeekOffset(&startpos); + rv = PeekOffset(&aPresContext, &startpos); if (NS_FAILED(rv)) return rv; nsPeekOffsetStruct endpos; @@ -893,7 +894,7 @@ nsFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_FALSE, PR_TRUE); - rv = PeekOffset(&endpos); + rv = PeekOffset(&aPresContext, &endpos); if (NS_FAILED(rv)) return rv; @@ -996,7 +997,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, nsIFrame *kid = nsnull; nsIFrame *closestFrame = nsnull; - result = GetClosestViewForFrame(this, &view); + result = GetClosestViewForFrame(&aCX, this, &view); if (NS_FAILED(result)) return result; @@ -1016,7 +1017,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, nsIView * kidView = nsnull; kid->GetRect(rect); - kid->GetOffsetFromView(offsetPoint, &kidView); + kid->GetOffsetFromView(&aCX, offsetPoint, &kidView); rect.x = offsetPoint.x; rect.y = offsetPoint.y; @@ -1063,7 +1064,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, nsPoint newPoint = aPoint; nsIView *closestView = nsnull; - result = GetClosestViewForFrame(closestFrame, &closestView); + result = GetClosestViewForFrame(&aCX, closestFrame, &closestView); if (NS_FAILED(result)) return result; @@ -1094,7 +1095,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, if (NS_FAILED(result)) return result; nsPoint offsetPoint; - GetOffsetFromView(offsetPoint, &view); + GetOffsetFromView(&aCX, offsetPoint, &view); thisRect.x = offsetPoint.x; thisRect.y = offsetPoint.y; @@ -1140,7 +1141,9 @@ nsFrame::GetCursor(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { *aFrame = this; return NS_OK; @@ -1193,7 +1196,7 @@ nsFrame::DidReflow(nsIPresContext& aPresContext, // parent frame (our parent frame may not have a view). nsIView* parentWithView; nsPoint origin; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); vm->ResizeView(mView, mRect.width, mRect.height); vm->MoveViewTo(mView, origin.x, origin.y); } @@ -1419,14 +1422,14 @@ NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*) } // Associated view object -NS_IMETHODIMP nsFrame::GetView(nsIView** aView) const +NS_IMETHODIMP nsFrame::GetView(nsIPresContext* aPresContext, nsIView** aView) const { NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer"); *aView = mView; return NS_OK; } -NS_IMETHODIMP nsFrame::SetView(nsIView* aView) +NS_IMETHODIMP nsFrame::SetView(nsIPresContext* aPresContext, nsIView* aView) { nsresult rv; @@ -1442,7 +1445,8 @@ NS_IMETHODIMP nsFrame::SetView(nsIView* aView) } // Find the first geometric parent that has a view -NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const +NS_IMETHODIMP nsFrame::GetParentWithView(nsIPresContext* aPresContext, + nsIFrame** aParent) const { NS_PRECONDITION(nsnull != aParent, "null OUT parameter pointer"); @@ -1450,7 +1454,7 @@ NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const for (parent = mParent; nsnull != parent; parent->GetParent(&parent)) { nsIView* parView; - parent->GetView(&parView); + parent->GetView(aPresContext, &parView); if (nsnull != parView) { break; } @@ -1462,7 +1466,9 @@ NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const // Returns the offset from this frame to the closest geometric parent that // has a view. Also returns the containing view or null in case of error -NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const +NS_IMETHODIMP nsFrame::GetOffsetFromView(nsIPresContext* aPresContext, + nsPoint& aOffset, + nsIView** aView) const { NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer"); nsIFrame* frame = (nsIFrame*)this; @@ -1476,22 +1482,23 @@ NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView** aView) cons aOffset += origin; frame->GetParent(&frame); if (nsnull != frame) { - frame->GetView(aView); + frame->GetView(aPresContext, aView); } } while ((nsnull != frame) && (nsnull == *aView)); return NS_OK; } -NS_IMETHODIMP nsFrame::GetWindow(nsIWidget** aWindow) const +NS_IMETHODIMP nsFrame::GetWindow(nsIPresContext* aPresContext, + nsIWidget** aWindow) const { NS_PRECONDITION(nsnull != aWindow, "null OUT parameter pointer"); nsIFrame* frame; nsIWidget* window = nsnull; - for (frame = (nsIFrame*)this; nsnull != frame; frame->GetParentWithView(&frame)) { + for (frame = (nsIFrame*)this; nsnull != frame; frame->GetParentWithView(aPresContext, &frame)) { nsIView* view; - frame->GetView(&view); + frame->GetView(aPresContext, &view); if (nsnull != view) { view->GetWidget(window); if (nsnull != window) { @@ -1513,8 +1520,9 @@ nsFrame::GetFrameType(nsIAtom** aType) const } void -nsFrame::Invalidate(const nsRect& aDamageRect, - PRBool aImmediate) const +nsFrame::Invalidate(nsIPresContext* aPresContext, + const nsRect& aDamageRect, + PRBool aImmediate) const { nsIViewManager* viewManager = nsnull; nsRect damageRect(aDamageRect); @@ -1539,7 +1547,7 @@ nsFrame::Invalidate(const nsRect& aDamageRect, nsPoint offset; nsIView* view; - GetOffsetFromView(offset, &view); + GetOffsetFromView(aPresContext, offset, &view); NS_ASSERTION(nsnull != view, "no view"); rect += offset; view->GetViewManager(viewManager); @@ -1643,7 +1651,7 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) // Debugging NS_IMETHODIMP -nsFrame::List(FILE* out, PRInt32 aIndent) const +nsFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); @@ -1836,7 +1844,7 @@ nsFrame::VerifyTree() const /*this method may.. invalidate if the state was changed or if aForceRedraw is PR_TRUE it will not update immediately.*/ NS_IMETHODIMP -nsFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) +nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) { if (aSelected && ParentDisablesSelection()) return NS_OK; @@ -1869,7 +1877,7 @@ nsFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) nsRect frameRect; GetRect(frameRect); nsRect rect(0, 0, frameRect.width, frameRect.height); - Invalidate(rect, PR_FALSE); + Invalidate(aPresContext, rect, PR_FALSE); #if 0 if (aRange) { //lets see if the range contains us, if so we must redraw! @@ -1950,7 +1958,8 @@ nsFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, P } nsresult -nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, +nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, + nsPeekOffsetStruct *aPos, nsIFrame *aBlockFrame, PRInt32 aLineStart, PRInt8 aOutSideLimit @@ -2029,7 +2038,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, } nsPoint offset; nsIView * view; //used for call of get offset from view - aBlockFrame->GetOffsetFromView(offset,&view); + aBlockFrame->GetOffsetFromView(aPresContext, offset,&view); nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates! result = it->FindFrameAt(searchingLine, newDesiredX, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); } @@ -2135,7 +2144,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, aPos->mPreferLeft = !(aPos->mDirection == eDirNext); if (aPos->mDirection == eDirPrevious) aPos->mStartOffset = -1;//start from end - return aBlockFrame->PeekOffset(aPos); + return aBlockFrame->PeekOffset(aPresContext, aPos); } } return NS_OK; @@ -2143,7 +2152,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, NS_IMETHODIMP -nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) +nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) { if (!aPos || !aPos->mTracker ) return NS_ERROR_NULL_POINTER; @@ -2177,7 +2186,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) { return result?result:NS_ERROR_FAILURE; } - return aPos->mResultFrame->PeekOffset(aPos); + return aPos->mResultFrame->PeekOffset(aPresContext, aPos); } else { @@ -2235,7 +2244,8 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) //it will "drill down" to find a viable frame or it will return an error. do { - result = GetNextPrevLineFromeBlockFrame(aPos, + result = GetNextPrevLineFromeBlockFrame(aPresContext, + aPos, blockFrame, thisLine, edgeCase //start from thisLine @@ -2313,7 +2323,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) { nsPoint offsetPoint; //used for offset of result frame nsIView * view; //used for call of get offset from view - firstFrame->GetOffsetFromView(offsetPoint, &view); + firstFrame->GetOffsetFromView(aPresContext, offsetPoint, &view); offsetPoint.x = 0;//all the way to the left result = firstFrame->GetContentAndOffsetsFromPoint(*(context.get()), @@ -2337,7 +2347,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) nsPoint offsetPoint; //used for offset of result frame nsIView * view; //used for call of get offset from view - nextFrame->GetOffsetFromView(offsetPoint, &view); + nextFrame->GetOffsetFromView(aPresContext, offsetPoint, &view); offsetPoint.x = 2* usedRect.width; //2* just to be sure we are off the edge @@ -2363,7 +2373,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) default: { if (NS_SUCCEEDED(result)) - result = aPos->mResultFrame->PeekOffset(aPos); + result = aPos->mResultFrame->PeekOffset(aPresContext, aPos); } } return result; @@ -2497,7 +2507,9 @@ nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos) return NS_OK; } -nsresult nsFrame::GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView) +nsresult nsFrame::GetClosestViewForFrame(nsIPresContext* aPresContext, + nsIFrame *aFrame, + nsIView **aView) { if (!aView) return NS_ERROR_NULL_POINTER; @@ -2510,7 +2522,7 @@ nsresult nsFrame::GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView) while (parent && !*aView) { - result = parent->GetView(aView); + result = parent->GetView(aPresContext, aView); if (NS_FAILED(result)) return result; @@ -2533,18 +2545,18 @@ nsresult nsFrame::GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView) /******************************************************** * Refreshes each content's frame *********************************************************/ -static void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent) +static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFrame, nsIContent * aContent) { nsIContent* frameContent; aFrame->GetContent(&frameContent); if (frameContent == aContent) { - ForceDrawFrame((nsFrame *)aFrame); + ForceDrawFrame(aPresContext, (nsFrame *)aFrame); } NS_IF_RELEASE(frameContent); aFrame->FirstChild(nsnull, &aFrame); while (aFrame) { - RefreshAllContentFrames(aFrame, aContent); + RefreshAllContentFrames(aPresContext, aFrame, aContent); aFrame->GetNextSibling(&aFrame); } } @@ -2556,7 +2568,7 @@ static void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent) /** * */ -void ForceDrawFrame(nsFrame * aFrame)//, PRBool) +void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool) { if (aFrame == nsnull) { return; @@ -2564,7 +2576,7 @@ void ForceDrawFrame(nsFrame * aFrame)//, PRBool) nsRect rect; nsIView * view; nsPoint pnt; - aFrame->GetOffsetFromView(pnt, &view); + aFrame->GetOffsetFromView(aPresContext, pnt, &view); aFrame->GetRect(rect); rect.x = pnt.x; rect.y = pnt.y; diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 319b86cc2cf..56ec5d9fdef 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -151,9 +151,9 @@ public: NS_IMETHOD GetRect(nsRect& aRect) const; NS_IMETHOD GetOrigin(nsPoint& aPoint) const; NS_IMETHOD GetSize(nsSize& aSize) const; - NS_IMETHOD SetRect(const nsRect& aRect); - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight); + NS_IMETHOD SetRect(nsIPresContext* aPresContext, const nsRect& aRect); + 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 Paint(nsIPresContext& aPresContext, @@ -166,8 +166,9 @@ public: NS_IMETHOD GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, PRInt32& aCursor); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame); NS_IMETHOD GetPointFromOffset(nsIPresContext* inPresContext, nsIRenderingContext* inRendContext, @@ -179,7 +180,8 @@ public: PRInt32* outFrameContentOffset, nsIFrame* *outChildFrame); - static nsresult GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, + static nsresult GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, + nsPeekOffsetStruct *aPos, nsIFrame *aBlockFrame, PRInt32 aLineStart, PRInt8 aOutSideLimit @@ -204,24 +206,24 @@ public: NS_IMETHOD SetPrevInFlow(nsIFrame*); NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const; NS_IMETHOD SetNextInFlow(nsIFrame*); - NS_IMETHOD GetView(nsIView** aView) const; - NS_IMETHOD SetView(nsIView* aView); - NS_IMETHOD GetParentWithView(nsIFrame** aParent) const; - NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const; - NS_IMETHOD GetWindow(nsIWidget**) const; + NS_IMETHOD GetView(nsIPresContext* aPresContext, nsIView** aView) const; + NS_IMETHOD SetView(nsIPresContext* aPresContext, nsIView* aView); + NS_IMETHOD GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const; + NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const; + NS_IMETHOD GetWindow(nsIPresContext* aPresContext, nsIWidget**) const; NS_IMETHOD GetFrameType(nsIAtom** aType) const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const; NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling); NS_IMETHOD Scrolled(nsIView *aView); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; NS_IMETHOD VerifyTree() const; - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); NS_IMETHOD GetSelected(PRBool *aSelected) const; - NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos) ; + NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ; NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const; @@ -272,7 +274,8 @@ public: // Invalidate part of the frame by asking the view manager to repaint. // aDamageRect is in the frame's local coordinate space - void Invalidate(const nsRect& aDamageRect, + void Invalidate(nsIPresContext* aPresContext, + const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const; // Helper function to return the index in parent of the frame's content @@ -287,7 +290,9 @@ public: PRBool IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aMetrics); - virtual nsresult GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView); + virtual nsresult GetClosestViewForFrame(nsIPresContext* aPresContext, + nsIFrame *aFrame, + nsIView **aView); #ifdef NS_DEBUG /** diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 2eadeb20c71..44d69defcdf 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -158,9 +158,6 @@ public: NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight); - NS_IMETHOD GetParentContent(nsIContent*& aContent); PRBool GetURL(nsIContent* aContent, nsString& aResult); PRBool GetName(nsIContent* aContent, nsString& aResult); @@ -361,7 +358,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext, // Place and size the child nsRect rect(offset.x, offset.y, innerSize.width, innerSize.height); - firstChild->SetRect(rect); + firstChild->SetRect(&aPresContext, rect); } // XXX what should the max-element-size of an iframe be? Shouldn't @@ -587,18 +584,6 @@ nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } -NS_METHOD -nsHTMLFrameInnerFrame::MoveTo(nscoord aX, nscoord aY) -{ - return nsLeafFrame::MoveTo(aX, aY); -} - -NS_METHOD -nsHTMLFrameInnerFrame::SizeTo(nscoord aWidth, nscoord aHeight) -{ - return nsLeafFrame::SizeTo(aWidth, aHeight); -} - NS_IMETHODIMP nsHTMLFrameInnerFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -668,7 +653,7 @@ nsHTMLFrameInnerFrame::DidReflow(nsIPresContext& aPresContext, // positioned then we show it. if (NS_FRAME_REFLOW_FINISHED == aStatus) { nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (view) { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); @@ -811,7 +796,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext, nsIView* parView; nsPoint origin; - GetOffsetFromView(origin, &parView); + GetOffsetFromView(&aPresContext, origin, &parView); nsRect viewBounds(origin.x, origin.y, aSize.width, aSize.height); nsCOMPtr viewMan; @@ -819,7 +804,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext, rv = view->Init(viewMan, viewBounds, parView); viewMan->InsertChild(parView, view, 0); rv = view->CreateWidget(kCChildCID); - SetView(view); + SetView(&aPresContext, view); // if the visibility is hidden, reflect that in the view const nsStyleDisplay* display; diff --git a/mozilla/layout/generic/nsFrameList.cpp b/mozilla/layout/generic/nsFrameList.cpp index 37221bd5282..9edde9256d6 100644 --- a/mozilla/layout/generic/nsFrameList.cpp +++ b/mozilla/layout/generic/nsFrameList.cpp @@ -346,12 +346,12 @@ nsFrameList::VerifyParent(nsIFrame* aParent) const } void -nsFrameList::List(FILE* out) const +nsFrameList::List(nsIPresContext* aPresContext, FILE* out) const { fputs("<\n", out); nsIFrame* frame = mFirstChild; while (nsnull != frame) { - frame->List(out, 1); + frame->List(aPresContext, out, 1); frame->GetNextSibling(&frame); } fputs(">\n", out); diff --git a/mozilla/layout/generic/nsFrameList.h b/mozilla/layout/generic/nsFrameList.h index 1dd0a8aa07a..cac6933c36b 100644 --- a/mozilla/layout/generic/nsFrameList.h +++ b/mozilla/layout/generic/nsFrameList.h @@ -121,7 +121,7 @@ public: void VerifyParent(nsIFrame* aParent) const; - void List(FILE* out) const; + void List(nsIPresContext* aPresContext, FILE* out) const; protected: nsIFrame* mFirstChild; diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 5931ed9bba0..85e022b83e6 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -108,7 +108,8 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD GetCursor(nsIPresContext& aPresContext, @@ -152,7 +153,7 @@ protected: class nsHTMLFramesetBlankFrame : public nsLeafFrame { public: - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out = stdout, PRInt32 aIndent = 0) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -546,7 +547,7 @@ NS_METHOD nsHTMLFramesetFrame::HandleEvent(nsIPresContext& aPresContext, MouseDrag(aPresContext, aEvent); break; case NS_MOUSE_LEFT_BUTTON_UP: - EndMouseDrag(); + EndMouseDrag(&aPresContext); break; } aEventStatus = nsEventStatus_eConsumeNoDefault; @@ -594,7 +595,8 @@ nsHTMLFramesetFrame::GetCursor(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, +nsHTMLFramesetFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) { //XXX Temporary to deal with event handling in both this and FramsetBorderFrame @@ -602,7 +604,7 @@ nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, *aFrame = this; return NS_OK; } else { - return nsContainerFrame::GetFrameForPoint(aPoint, aFrame); + return nsContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); } } @@ -782,7 +784,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, // Place and size the child nsRect rect(aOffset.x, aOffset.y, aSize.width, aSize.height); - aChild->SetRect(rect); + aChild->SetRect(&aPresContext, rect); htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); // this call is needed } } @@ -923,12 +925,12 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(&aPresContext, &parWithView); + parWithView->GetView(&aPresContext, &parView); nsRect boundBox(0, 0, aDesiredSize.width, aDesiredSize.height); result = view->Init(viewMan, boundBox, parView, nsnull); viewMan->InsertChild(parView, view, 0); - SetView(view); + SetView(&aPresContext, view); // parse the rows= cols= data ParseRowCol(nsHTMLAtoms::rows, mNumRows, &mRowSpecs); @@ -1417,7 +1419,7 @@ nsHTMLFramesetFrame::StartMouseDrag(nsIPresContext& aPresContext, NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger"); #endif nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (view) { nsIViewManager* viewMan; view->GetViewManager(viewMan); @@ -1491,10 +1493,10 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, } void -nsHTMLFramesetFrame::EndMouseDrag() +nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext) { nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (view) { nsIViewManager* viewMan; view->GetViewManager(viewMan); @@ -1693,7 +1695,8 @@ nsHTMLFramesetBorderFrame::HandleEvent(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsHTMLFramesetBorderFrame::GetFrameForPoint(const nsPoint& aPoint, +nsHTMLFramesetBorderFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) { *aFrame = this; @@ -1781,11 +1784,12 @@ nsHTMLFramesetBlankFrame::Paint(nsIPresContext& aPresContext, } -NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(FILE* out, +NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(nsIPresContext* aPresContext, + FILE* out, PRInt32 aIndent) const { for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); // Indent fprintf(out, "%p BLANK \n", this); - return nsLeafFrame::List(out, aIndent); + return nsLeafFrame::List(aPresContext, out, aIndent); } diff --git a/mozilla/layout/generic/nsFrameSetFrame.h b/mozilla/layout/generic/nsFrameSetFrame.h index d3c9715779d..41f9cad7057 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.h +++ b/mozilla/layout/generic/nsFrameSetFrame.h @@ -123,7 +123,8 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD GetCursor(nsIPresContext& aPresContext, @@ -149,7 +150,7 @@ public: void MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent); - void EndMouseDrag(); + void EndMouseDrag(nsIPresContext* aPresContext); nsFrameborder GetParentFrameborder() { return mParentFrameborder; } diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index c14f5236865..88e0f022a1a 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -136,7 +136,8 @@ public: nsresult GetFrameSize( nsIFrame* aFrame, nsSize& aSize); - nsresult SetFrameSize( nsIFrame* aFrame, + nsresult SetFrameSize( nsIPresContext* aPresContext, + nsIFrame* aFrame, nsSize aSize); nsresult CalculateScrollAreaSize(nsIPresContext& aPresContext, @@ -203,11 +204,11 @@ public: void AddVerticalScrollbar (const nsSize& aSbSize, nsSize& aScrollAreaSize); void RemoveHorizontalScrollbar(const nsSize& aSbSize, nsSize& aScrollAreaSize); void RemoveVerticalScrollbar (const nsSize& aSbSize, nsSize& aScrollAreaSize); - nsIScrollableView* GetScrollableView(); + nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext); void GetScrolledContentSize(nsSize& aSize); - void ScrollbarChanged(nscoord aX, nscoord aY); + void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY); nsresult GetContentOf(nsIFrame* aFrame, nsIContent** aContent); nsIFrame* mHScrollbarFrame; @@ -246,12 +247,14 @@ nsGfxScrollFrame::nsGfxScrollFrame(nsIDocument* aDocument) mInner = new nsGfxScrollFrameInner(this); mInner->AddRef(); mInner->mDocument = aDocument; + mPresContext = nsnull; } nsGfxScrollFrame::~nsGfxScrollFrame() { mInner->mOuter = nsnull; mInner->Release(); + mPresContext = nsnull; } nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr& aNewNode); @@ -313,6 +316,7 @@ nsGfxScrollFrame::Init(nsIPresContext& aPresContext, nsIStyleContext* aStyleContext, nsIFrame* aPrevInFlow) { + mPresContext = &aPresContext; nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aStyleContext, aPrevInFlow); @@ -342,7 +346,7 @@ nsGfxScrollFrame::SetInitialChildList(nsIPresContext& aPresContext, mInner->mHScrollbarFrame->GetNextSibling(&mInner->mVScrollbarFrame); // listen for scroll events. - mInner->GetScrollableView()->AddScrollPositionListener(mInner); + mInner->GetScrollableView(&aPresContext)->AddScrollPositionListener(mInner); return rv; } @@ -470,7 +474,7 @@ nsGfxScrollFrame::Reflow(nsIPresContext& aPresContext, // redraw anything that needs it. if ( aReflowState.reason == eReflowReason_Incremental ) if (hscrollbarNeedsReflow && vscrollbarNeedsReflow && scrollAreaNeedsReflow) - Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE); + Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE); mInner->mHscrollbarNeedsReflow = PR_FALSE; @@ -643,7 +647,7 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsGfxScrollFrame* aOuter):mHScrollb mScrollAreaFrame(nsnull), mHasVerticalScrollbar(PR_FALSE), mHasHorizontalScrollbar(PR_FALSE), - mOnePixel(20) + mOnePixel(20) { mOuter = aOuter; mRefCnt = 0; @@ -674,10 +678,10 @@ nsGfxScrollFrameInner::ScrollPositionDidChange(nsIScrollableView* aScrollable, n NS_IMETHODIMP nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, - nsIContent* aContent, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aHint) + nsIContent* aContent, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aHint) { if (mHScrollbarFrame && mVScrollbarFrame) { @@ -709,7 +713,7 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, y = value.ToInteger(&error); } - ScrollbarChanged(x*mOnePixel, y*mOnePixel); + ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel); } } @@ -718,11 +722,11 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, nsIScrollableView* -nsGfxScrollFrameInner::GetScrollableView() +nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext) { nsIScrollableView* scrollingView; nsIView* view; - mScrollAreaFrame->GetView(&view); + mScrollAreaFrame->GetView(aPresContext, &view); nsresult result = view->QueryInterface(kScrollViewIID, (void**)&scrollingView); NS_ASSERTION(NS_SUCCEEDED(result), "assertion gfx scrollframe does not contain a scrollframe"); return scrollingView; @@ -743,8 +747,9 @@ nsGfxScrollFrameInner::GetScrolledContentSize(nsSize& aSize) nsresult -nsGfxScrollFrameInner::SetFrameSize( nsIFrame* aFrame, - nsSize aSize) +nsGfxScrollFrameInner::SetFrameSize(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsSize aSize) { // get the margin @@ -764,7 +769,7 @@ nsGfxScrollFrameInner::SetFrameSize( nsIFrame* aFrame, aSize.width -= margin.left + margin.right; aSize.height -= margin.top + margin.bottom; - aFrame->SizeTo(aSize.width, aSize.height); + aFrame->SizeTo(aPresContext, aSize.width, aSize.height); return NS_OK; } @@ -1187,7 +1192,7 @@ nsGfxScrollFrameInner::ReflowFrame( nsIPresContext& aPresContext, // if the frame size change then mark the flag if (oldSize.width != aDesiredSize.width || oldSize.height != aDesiredSize.height) { - aFrame->SizeTo(aDesiredSize.width, aDesiredSize.height); + aFrame->SizeTo(&aPresContext, aDesiredSize.width, aDesiredSize.height); aResized = PR_TRUE; } @@ -1409,7 +1414,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext SetAttribute(mHScrollbarFrame, nsXULAtoms::pageincrement, nscoord(float(scrollAreaSize.width)*0.8)); SetAttribute(mVScrollbarFrame, nsXULAtoms::increment, fontHeight); - nsIScrollableView* scrollable = GetScrollableView(); + nsIScrollableView* scrollable = GetScrollableView(&aPresContext); scrollable->SetLineHeight(fontHeight); SetAttribute(mHScrollbarFrame, nsXULAtoms::increment, 10*mOnePixel); @@ -1418,7 +1423,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext // even if it is different from the old size. This is because ReflowFrame set the child's // frame so we have to make sure our final size is scrollAreaSize - SetFrameSize(mScrollAreaFrame, scrollAreaSize); + SetFrameSize(&aPresContext, mScrollAreaFrame, scrollAreaSize); } } @@ -1443,13 +1448,13 @@ nsGfxScrollFrameInner::LayoutChildren(nsIPresContext& aPresContext, const nsMargin& border = aReflowState.mComputedBorderPadding; // Place scroll area - mScrollAreaFrame->MoveTo(border.left, border.top); + mScrollAreaFrame->MoveTo(&aPresContext, border.left, border.top); // place vertical scrollbar - mVScrollbarFrame->MoveTo(border.left + scrollAreaSize.width, border.top); + mVScrollbarFrame->MoveTo(&aPresContext, border.left + scrollAreaSize.width, border.top); // place horizontal scrollbar - mHScrollbarFrame->MoveTo(border.left, border.top + scrollAreaSize.height); + mHScrollbarFrame->MoveTo(&aPresContext, border.left, border.top + scrollAreaSize.height); // Compute our desired size // ---------- compute width ----------- @@ -1499,9 +1504,9 @@ nsGfxScrollFrameInner::LayoutChildren(nsIPresContext& aPresContext, } void -nsGfxScrollFrameInner::ScrollbarChanged(nscoord aX, nscoord aY) +nsGfxScrollFrameInner::ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY) { - nsIScrollableView* scrollable = GetScrollableView(); + nsIScrollableView* scrollable = GetScrollableView(aPresContext); scrollable->ScrollTo(aX,aY, NS_SCROLL_PROPERTY_ALWAYS_BLIT); // printf("scrolling to: %d, %d\n", aX, aY); } diff --git a/mozilla/layout/generic/nsGfxScrollFrame.h b/mozilla/layout/generic/nsGfxScrollFrame.h index 0ecdb66cf46..9eda661abd5 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.h +++ b/mozilla/layout/generic/nsGfxScrollFrame.h @@ -116,6 +116,7 @@ protected: private: friend class nsGfxScrollFrameInner; nsGfxScrollFrameInner* mInner; + nsIPresContext* mPresContext; // weak reference }; #endif /* nsScrollFrame_h___ */ diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index 35a5dc30ced..70012bcf58f 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -130,7 +130,8 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext& aPresContext, } static nsresult -ReparentFrameViewTo(nsIFrame* aFrame, +ReparentFrameViewTo(nsIPresContext* aPresContext, + nsIFrame* aFrame, nsIViewManager* aViewManager, nsIView* aNewParentView, nsIView* aOldParentView) @@ -138,7 +139,7 @@ ReparentFrameViewTo(nsIFrame* aFrame, nsIView* view; // Does aFrame have a view? - aFrame->GetView(&view); + aFrame->GetView(aPresContext, &view); if (view) { #ifdef NS_DEBUG // Verify that the current parent view is what we think it is @@ -163,7 +164,7 @@ ReparentFrameViewTo(nsIFrame* aFrame, aFrame->FirstChild(nsnull, &childFrame); while (childFrame) { - ReparentFrameViewTo(childFrame, aViewManager, aNewParentView, aOldParentView); + ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView); childFrame->GetNextSibling(&childFrame); } } @@ -174,13 +175,13 @@ ReparentFrameViewTo(nsIFrame* aFrame, // Helper function that returns the nearest view to this frame. Checks // this frame, its parent frame, its parent frame, ... static nsIView* -GetClosestViewFor(nsIFrame* aFrame) +GetClosestViewFor(nsIPresContext* aPresContext, nsIFrame* aFrame) { NS_PRECONDITION(aFrame, "null frame pointer"); nsIView* view; do { - aFrame->GetView(&view); + aFrame->GetView(aPresContext, &view); if (view) { break; } @@ -192,9 +193,10 @@ GetClosestViewFor(nsIFrame* aFrame) } nsresult -nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, - nsIFrame* aOldParentFrame, - nsIFrame* aNewParentFrame) +nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, + nsIFrame* aChildFrame, + nsIFrame* aOldParentFrame, + nsIFrame* aNewParentFrame) { NS_PRECONDITION(aChildFrame, "null child frame pointer"); NS_PRECONDITION(aOldParentFrame, "null old parent frame pointer"); @@ -207,7 +209,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, // This code is called often and we need it to be as fast as possible, so // see if we can trivially detect that no work needs to be done - aChildFrame->GetView(&childView); + aChildFrame->GetView(aPresContext, &childView); if (!childView) { // Child frame doesn't have a view. See if it has any child frames nsIFrame* firstChild; @@ -218,8 +220,8 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, } // See if either the old parent frame or the new parent frame have a view - aOldParentFrame->GetView(&oldParentView); - aNewParentFrame->GetView(&newParentView); + aOldParentFrame->GetView(aPresContext, &oldParentView); + aNewParentFrame->GetView(aPresContext, &newParentView); if (!oldParentView && !newParentView) { // Walk up both the old parent frame and the new parent frame nodes @@ -243,8 +245,8 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, } // Get the views - aOldParentFrame->GetView(&oldParentView); - aNewParentFrame->GetView(&newParentView); + aOldParentFrame->GetView(aPresContext, &oldParentView); + aNewParentFrame->GetView(aPresContext, &newParentView); } while (!(oldParentView || newParentView)); } @@ -262,10 +264,10 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, // common parent NS_ASSERTION(oldParentView || newParentView, "internal error"); if (!oldParentView) { - oldParentView = GetClosestViewFor(aOldParentFrame); + oldParentView = GetClosestViewFor(aPresContext, aOldParentFrame); } if (!newParentView) { - newParentView = GetClosestViewFor(aNewParentFrame); + newParentView = GetClosestViewFor(aPresContext, aNewParentFrame); } // See if the old parent frame and the new parent frame are in the @@ -276,7 +278,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, oldParentView->GetViewManager(*getter_AddRefs(viewManager)); // They're not so we need to reparent any child views - return ReparentFrameViewTo(aChildFrame, viewManager, newParentView, + return ReparentFrameViewTo(aPresContext, aChildFrame, viewManager, newParentView, oldParentView); } @@ -290,7 +292,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext, PRBool aForce) { nsIView* view; - aFrame->GetView(&view); + aFrame->GetView(&aPresContext, &view); // If we don't yet have a view, see if we need a view if (nsnull == view) { PRInt32 zIndex = 0; @@ -361,11 +363,11 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext, // Create a view nsIFrame* parent; - aFrame->GetParentWithView(&parent); + aFrame->GetParentWithView(&aPresContext, &parent); NS_ASSERTION(parent, "GetParentWithView failed"); nsIView* parentView; - parent->GetView(&parentView); + parent->GetView(&aPresContext, &parentView); NS_ASSERTION(parentView, "no parent with view"); // Create a view @@ -470,7 +472,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext, } // Remember our view - aFrame->SetView(view); + aFrame->SetView(&aPresContext, view); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsHTMLContainerFrame::CreateViewForFrame: frame=%p view=%p", diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.h b/mozilla/layout/generic/nsHTMLContainerFrame.h index 0d61d6e3bda..5a939c2c3ca 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.h +++ b/mozilla/layout/generic/nsHTMLContainerFrame.h @@ -65,9 +65,10 @@ public: nsIStyleContext* aStyleContext, PRBool aForce); - static nsresult ReparentFrameView(nsIFrame* aChildFrame, - nsIFrame* aOldParentFrame, - nsIFrame* aNewParentFrame); + static nsresult ReparentFrameView(nsIPresContext* aPresContext, + nsIFrame* aChildFrame, + nsIFrame* aOldParentFrame, + nsIFrame* aNewParentFrame); protected: virtual PRIntn GetSkipSides() const = 0; diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index 0c1bea45e79..cc21a8e4f5d 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -94,7 +94,7 @@ public: #endif // XXX Temporary hack... - NS_IMETHOD SetRect(const nsRect& aRect); + NS_IMETHOD SetRect(nsIPresContext* aPresContext, const nsRect& aRect); protected: virtual PRIntn GetSkipSides() const; @@ -124,9 +124,9 @@ NS_NewRootFrame(nsIFrame** aNewFrame) // 'min-height', and 'max-height' properties. Then we can do this in a top-down // fashion NS_IMETHODIMP -RootFrame::SetRect(const nsRect& aRect) +RootFrame::SetRect(nsIPresContext* aPresContext, const nsRect& aRect) { - nsresult rv = nsHTMLContainerFrame::SetRect(aRect); + nsresult rv = nsHTMLContainerFrame::SetRect(aPresContext, aRect); // If our height is larger than our natural height (the height we returned // as our desired height), then make sure the document element's frame is @@ -143,7 +143,7 @@ RootFrame::SetRect(const nsRect& aRect) nsSize kidSize; kidFrame->GetSize(kidSize); - kidFrame->SizeTo(kidSize.width, kidSize.height + yDelta); + kidFrame->SizeTo(aPresContext, kidSize.width, kidSize.height + yDelta); } } @@ -226,7 +226,7 @@ RootFrame::RemoveFrame(nsIPresContext& aPresContext, // Damage the area occupied by the deleted frame nsRect damageRect; aOldFrame->GetRect(damageRect); - Invalidate(damageRect, PR_FALSE); + Invalidate(&aPresContext, damageRect, PR_FALSE); // Remove the frame and destroy it mFrames.DestroyFrame(aPresContext, aOldFrame); @@ -386,13 +386,13 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // Position and size the child frame nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - kidFrame->SetRect(rect); + kidFrame->SetRect(&aPresContext, rect); // If the child frame was just inserted, then we're responsible for making sure // it repaints if (isDirtyChildReflow) { // Damage the area occupied by the deleted frame - Invalidate(rect, PR_FALSE); + Invalidate(&aPresContext, rect, PR_FALSE); } } diff --git a/mozilla/layout/generic/nsIFrame.h b/mozilla/layout/generic/nsIFrame.h index 9197fd64c90..7e92977db80 100644 --- a/mozilla/layout/generic/nsIFrame.h +++ b/mozilla/layout/generic/nsIFrame.h @@ -389,9 +389,14 @@ public: NS_IMETHOD GetRect(nsRect& aRect) const = 0; NS_IMETHOD GetOrigin(nsPoint& aPoint) const = 0; NS_IMETHOD GetSize(nsSize& aSize) const = 0; - NS_IMETHOD SetRect(const nsRect& aRect) = 0; - NS_IMETHOD MoveTo(nscoord aX, nscoord aY) = 0; - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight) = 0; + NS_IMETHOD SetRect(nsIPresContext* aPresContext, + const nsRect& aRect) = 0; + NS_IMETHOD MoveTo(nsIPresContext* aPresContext, + nscoord aX, + nscoord aY) = 0; + NS_IMETHOD SizeTo(nsIPresContext* aPresContext, + nscoord aWidth, + nscoord aHeight) = 0; /** * Used to iterate the list of additional child list names. Returns the atom @@ -466,7 +471,8 @@ public: nsPoint& aPoint, PRInt32& aCursor) = 0; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) = 0; @@ -563,19 +569,24 @@ public: /** * Accessor functions to get/set the associated view object */ - NS_IMETHOD GetView(nsIView** aView) const = 0; // may be null - NS_IMETHOD SetView(nsIView* aView) = 0; + NS_IMETHOD GetView(nsIPresContext* aPresContext, + nsIView** aView) const = 0; // may be null + NS_IMETHOD SetView(nsIPresContext* aPresContext, + nsIView* aView) = 0; /** * Find the first geometric parent that has a view */ - NS_IMETHOD GetParentWithView(nsIFrame** aParent) const = 0; + NS_IMETHOD GetParentWithView(nsIPresContext* aPresContext, + nsIFrame** aParent) const = 0; /** * Returns the offset from this frame to the closest geometric parent that * has a view. Also returns the containing view or null in case of error */ - NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const = 0; + NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, + nsPoint& aOffset, + nsIView** aView) const = 0; /** * Returns the window that contains this frame. If this frame has a @@ -583,7 +594,8 @@ public: * returned, otherwise this frame's geometric parent is checked * recursively upwards. */ - NS_IMETHOD GetWindow(nsIWidget**) const = 0; + NS_IMETHOD GetWindow(nsIPresContext* aPresContext, + nsIWidget** aWidget) const = 0; /** * Get the "type" of the frame. May return a NULL atom pointer @@ -604,7 +616,7 @@ public: NS_IMETHOD Scrolled(nsIView *aView) = 0; // Debugging - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const = 0; /** * Get a printable from of the name of the frame type. @@ -650,7 +662,10 @@ public: * @param aSelected is it selected * @param aSpread should is spread selection to flow elements around it? or go down to its children? */ - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) = 0; + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, + nsIDOMRange* aRange, + PRBool aSelected, + nsSpread aSpread) = 0; NS_IMETHOD GetSelected(PRBool *aSelected) const = 0; @@ -664,7 +679,7 @@ public: * return NS_ERROR_FAILURE * @param aPOS is defined in nsIFrameSelection */ - NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos) = 0; + NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) = 0; /** * See if tree verification is enabled. To enable tree verification add diff --git a/mozilla/layout/generic/nsIStatefulFrame.h b/mozilla/layout/generic/nsIStatefulFrame.h index 912a4112ff6..1bc14d30a5e 100644 --- a/mozilla/layout/generic/nsIStatefulFrame.h +++ b/mozilla/layout/generic/nsIStatefulFrame.h @@ -3,6 +3,8 @@ #include "nsISupports.h" +class nsIPresContext; + #define NS_ISTATEFULFRAME_IID_STR "306c8ca0-5f0c-11d3-a9fb-000064657374" #define NS_ISTATEFULFRAME_IID \ @@ -18,9 +20,9 @@ class nsIStatefulFrame : public nsISupports { enum StateType {eNoType=-1, eCheckboxType, eFileType, eRadioType, eSelectType, eTextType, eNumStateTypes}; - NS_IMETHOD GetStateType(nsIStatefulFrame::StateType* aStateType) = 0; - NS_IMETHOD SaveState(nsISupports** aState) = 0; - NS_IMETHOD RestoreState(nsISupports* aState) = 0; + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) = 0; + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState) = 0; + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState) = 0; }; diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 429135e71bf..14b6960639e 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -646,10 +646,10 @@ nsImageFrame::TranslateEventCoords(nsIPresContext& aPresContext, // to this frame; otherwise we have to adjust the coordinates // appropriately. nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull == view) { nsPoint offset; - GetOffsetFromView(offset, &view); + GetOffsetFromView(&aPresContext, offset, &view); if (nsnull != view) { x -= offset.x; y -= offset.y; @@ -855,7 +855,7 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, if (loadStatus & NS_IMAGE_LOAD_STATUS_IMAGE_READY) { // Trigger a paint now because image-loader won't if the // image is already loaded and ready to go. - Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_FALSE); + Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height), PR_FALSE); } } else { diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 9fbe213d6f7..10e6cac1c25 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -1357,7 +1357,7 @@ nsInlineFrame::DrainOverflow(nsIPresContext* aPresContext) // change InsertFrames() to do this, but that's a general purpose // function and it doesn't seem like this functionality belongs there... for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); } mFrames.InsertFrames(this, nsnull, prevOverflowFrames); } @@ -1637,7 +1637,7 @@ nsInlineFrame::PullInlineFrame(nsIPresContext* aPresContext, frame = mFrames.PullFrame(this, irs.mPrevFrame, nextInFlow->mFrames); if (nsnull != frame) { isComplete = PR_FALSE; - nsHTMLContainerFrame::ReparentFrameView(frame, nextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, nextInFlow, this); break; } nextInFlow = (nsInlineFrame*) nextInFlow->mNextInFlow; @@ -1657,7 +1657,7 @@ nsInlineFrame::PullAnyFrame(nsIPresContext* aPresContext, while (nsnull != nextInFlow) { frame = mFrames.PullFrame(this, irs.mPrevFrame, nextInFlow->mFrames); if (nsnull != frame) { - nsHTMLContainerFrame::ReparentFrameView(frame, nextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, nextInFlow, this); break; } diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index 297cb006aa5..9fa9bafb693 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -135,7 +135,7 @@ nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const } void -nsLineBox::List(FILE* out, PRInt32 aIndent) const +nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { PRInt32 i; @@ -161,7 +161,7 @@ nsLineBox::List(FILE* out, PRInt32 aIndent) const nsIFrame* frame = mFirstChild; PRInt32 n = GetChildCount(); while (--n >= 0) { - frame->List(out, aIndent + 1); + frame->List(aPresContext, out, aIndent + 1); frame->GetNextSibling(&frame); } diff --git a/mozilla/layout/generic/nsLineBox.h b/mozilla/layout/generic/nsLineBox.h index bae95fef89f..de5f2fbbe59 100644 --- a/mozilla/layout/generic/nsLineBox.h +++ b/mozilla/layout/generic/nsLineBox.h @@ -254,7 +254,7 @@ public: static nsLineBox* FindLineContaining(nsLineBox* aLine, nsIFrame* aFrame, PRInt32* aFrameIndexInLine); - void List(FILE* out, PRInt32 aIndent) const; + void List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; nsIFrame* LastChild() const; diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 68e72b0ea32..2b2d468544e 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -1517,7 +1517,7 @@ nsLineLayout::VerticalAlignFrames(nsRect& aLineBoxResult, pfd->mBounds.y += baselineY; break; } - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, pfd->mFrame); @@ -1563,7 +1563,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, else { pfd->mBounds.y = -aDistanceFromTop + pfd->mMargin.top; } - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, pfd->mFrame); @@ -1584,7 +1584,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, pfd->mBounds.y = -aDistanceFromTop + aLineHeight - pfd->mMargin.bottom - pfd->mBounds.height; } - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, pfd->mFrame); @@ -1967,7 +1967,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) #endif } if (psd != mRootSpan) { - frame->SetRect(pfd->mBounds); + frame->SetRect(&mPresContext, pfd->mBounds); } } pfd = pfd->mNext; @@ -2078,7 +2078,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, nsIFrame* f = pfd->mFrame; f->GetRect(r); r.width -= deltaWidth; - f->SetRect(r); + f->SetRect(&mPresContext, r); } // Adjust the right edge of the span that contains the child span @@ -2130,7 +2130,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, if (psd != mRootSpan) { // The frame was already placed during psd's // reflow. Update the frames rectangle now. - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); } // Adjust containing span's right edge @@ -2227,7 +2227,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, PRBool aAllowJustify) PerFrameData* pfd = psd->mFirstFrame; while (nsnull != pfd) { pfd->mBounds.x += dx; - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); pfd = pfd->mNext; } aLineBounds.width += dx; @@ -2242,7 +2242,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, PRBool aAllowJustify) PRUint32 maxX = psd->mRightEdge; while (nsnull != pfd) { pfd->mBounds.x = maxX - pfd->mBounds.width; - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); maxX = pfd->mBounds.x; pfd = pfd->mNext; } @@ -2297,7 +2297,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea) // XXX what about right and bottom? nscoord dx = pfd->mOffsets.left; nscoord dy = pfd->mOffsets.top; - frame->MoveTo(origin.x + dx, origin.y + dy); + frame->MoveTo(&mPresContext, origin.x + dx, origin.y + dy); x += dx; y += dy; } diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index f3229d42f3e..a8da72c75c4 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -206,7 +206,10 @@ public: nsIContent* aChild, nsISupports* aSubContent); //local methods - nsresult CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly); + nsresult CreateWidget(nsIPresContext* aPresContext, + nscoord aWidth, + nscoord aHeight, + PRBool aViewOnly); nsresult GetFullURL(nsIURI*& aFullURL); nsresult GetPluginInstance(nsIPluginInstance*& aPluginInstance); @@ -406,7 +409,10 @@ nsObjectFrame::GetFrameName(nsString& aResult) const } nsresult -nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly) +nsObjectFrame::CreateWidget(nsIPresContext* aPresContext, + nscoord aWidth, + nscoord aHeight, + PRBool aViewOnly) { nsIView* view; @@ -425,8 +431,8 @@ nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly) nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(aPresContext, &parWithView); + parWithView->GetView(aPresContext, &parView); if (NS_OK == parView->GetViewManager(viewMan)) { @@ -474,12 +480,12 @@ nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly) nsIView* parentWithView; nsPoint origin; view->SetVisibility(nsViewVisibility_kShow); - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(aPresContext, origin, &parentWithView); viewMan->ResizeView(view, mRect.width, mRect.height); viewMan->MoveViewTo(view, origin.x, origin.y); } - SetView(view); + SetView(aPresContext, view); exit: NS_IF_RELEASE(viewMan); @@ -953,7 +959,7 @@ nsObjectFrame::InstantiateWidget(nsIPresContext& aPresContext, GetDesiredSize(&aPresContext, aReflowState, aMetrics); nsIView *parentWithView; nsPoint origin; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); // Just make the frigging widget float t2p; @@ -1004,7 +1010,7 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext& aPresContext, mInstanceOwner->GetWindow(window); - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); window->x = NSTwipsToIntPixels(origin.x, t2p); window->y = NSTwipsToIntPixels(origin.y, t2p); window->width = NSTwipsToIntPixels(aMetrics.width, t2p); @@ -1044,7 +1050,7 @@ nsObjectFrame::ReinstantiatePlugin(nsIPresContext& aPresContext, nsHTMLReflowMet mInstanceOwner->GetWindow(window); - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); window->x = NSTwipsToIntPixels(origin.x, t2p); window->y = NSTwipsToIntPixels(origin.y, t2p); window->width = NSTwipsToIntPixels(aMetrics.width, t2p); @@ -1122,7 +1128,7 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext, ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, status); nsRect rect(0, 0, kidDesiredSize.width, kidDesiredSize.height); - child->SetRect(rect); + child->SetRect(&aPresContext, rect); aMetrics.width = kidDesiredSize.width; aMetrics.height = kidDesiredSize.height; @@ -1187,7 +1193,7 @@ nsObjectFrame::DidReflow(nsIPresContext& aPresContext, // positioned then we show it. if (NS_FRAME_REFLOW_FINISHED == aStatus) { nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull != view) { view->SetVisibility(nsViewVisibility_kShow); } @@ -1203,7 +1209,7 @@ nsObjectFrame::DidReflow(nsIPresContext& aPresContext, aPresContext.GetTwipsToPixels(&t2p); nscoord offx, offy; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); #if 0 // beard: how do we get this? @@ -1759,7 +1765,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge if ((nsnull != mOwner) && (nsnull != mContext)) { - rv = mOwner->GetOffsetFromView(origin, &view); + rv = mOwner->GetOffsetFromView(mContext, origin, &view); if (NS_OK == rv) { @@ -2433,7 +2439,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) { // Create view if necessary - mOwner->GetView(&view); + mOwner->GetView(mContext, &view); if (nsnull == view) { @@ -2441,12 +2447,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) mInstance->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless); - rv = mOwner->CreateWidget(mPluginWindow.width, + rv = mOwner->CreateWidget(mContext, + mPluginWindow.width, mPluginWindow.height, windowless); if (NS_OK == rv) { - mOwner->GetView(&view); + mOwner->GetView(mContext, &view); view->GetWidget(mWidget); if (PR_TRUE == windowless) diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index edf7391efd0..4afafc251d8 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -85,7 +85,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, } nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); - mFrames.FirstChild()->SetRect(rect); + mFrames.FirstChild()->SetRect(&aPresContext, rect); } else { // Do we have any children? @@ -129,7 +129,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Place and size the child nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); - frame->SetRect(rect); + frame->SetRect(&aPresContext, rect); // XXX Should we be sending the DidReflow? htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index 8e0b315f4f9..67ac3064f3a 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -95,12 +95,12 @@ nsPlaceholderFrame::GetFrameName(nsString& aResult) const } NS_IMETHODIMP -nsPlaceholderFrame::List(FILE* out, PRInt32 aIndent) const +nsPlaceholderFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } diff --git a/mozilla/layout/generic/nsPlaceholderFrame.h b/mozilla/layout/generic/nsPlaceholderFrame.h index 5384c965c5c..f8b888a22f6 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.h +++ b/mozilla/layout/generic/nsPlaceholderFrame.h @@ -46,7 +46,7 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; /** * Get the "type" of the frame diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index ea0d83386c9..a97518238b3 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -127,7 +127,7 @@ nsSimplePageSequenceFrame::IncrementalReflow(nsIPresContext& aPresConte // Place and size the page. If the page is narrower than our max width, then // center it horizontally nsRect rect(aX, aY, kidSize.width, kidSize.height); - nextFrame->SetRect(rect); + nextFrame->SetRect(&aPresContext, rect); aY += kidSize.height + PAGE_SPACING_TWIPS; // Check if the page is complete... @@ -166,7 +166,7 @@ nsSimplePageSequenceFrame::IncrementalReflow(nsIPresContext& aPresConte // max width then center it horizontally ReflowChild(kidFrame, aPresContext, childSize, childReflowState, status); - kidFrame->SetRect(nsRect(aX, aY, childSize.width, childSize.height)); + kidFrame->SetRect(&aPresContext, nsRect(aX, aY, childSize.width, childSize.height)); aY += childSize.height; // Leave a slight gap between the pages @@ -239,7 +239,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, // Place and size the page. If the page is narrower than our // max width then center it horizontally ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, status); - kidFrame->SetRect(nsRect(x, y, kidSize.width, kidSize.height)); + kidFrame->SetRect(&aPresContext, nsRect(x, y, kidSize.width, kidSize.height)); y += kidSize.height; // Leave a slight gap between the pages @@ -419,7 +419,7 @@ nsSimplePageSequenceFrame::Print(nsIPresContext& aPresContext, // Print the page nsIView* view; - page->GetView(&view); + page->GetView(&aPresContext, &view); NS_ASSERTION(nsnull != view, "no page view"); vm->Display(view); diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index e5e7f056bc8..f3d8974d4be 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -144,7 +144,7 @@ public: NS_DECL_ISUPPORTS - void AddFrame(nsIFrame* aFrame); + void AddFrame(nsIPresContext* aPresContext, nsIFrame* aFrame); PRBool RemoveFrame(nsIFrame* aFrame); @@ -156,8 +156,19 @@ public: virtual void Notify(nsITimer *timer); + struct FrameData { + nsIPresContext* mPresContext; // pres context associated with the frame + nsIFrame* mFrame; + + + FrameData(nsIPresContext* aPresContext, + nsIFrame* aFrame) + : mPresContext(aPresContext), mFrame(aFrame) {} + }; + nsITimer* mTimer; nsVoidArray mFrames; + nsIPresContext* mPresContext; }; static PRBool gBlinkTextOff; @@ -196,15 +207,27 @@ void nsBlinkTimer::Stop() static NS_DEFINE_IID(kITimerCallbackIID, NS_ITIMERCALLBACK_IID); NS_IMPL_ISUPPORTS(nsBlinkTimer, kITimerCallbackIID); -void nsBlinkTimer::AddFrame(nsIFrame* aFrame) { - mFrames.AppendElement(aFrame); +void nsBlinkTimer::AddFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) { + FrameData* frameData = new FrameData(aPresContext, aFrame); + mFrames.AppendElement(frameData); if (1 == mFrames.Count()) { Start(); } } PRBool nsBlinkTimer::RemoveFrame(nsIFrame* aFrame) { - PRBool rv = mFrames.RemoveElement(aFrame); + PRInt32 i, n = mFrames.Count(); + PRBool rv = PR_FALSE; + for (i = 0; i < n; i++) { + FrameData* frameData = (FrameData*) mFrames.ElementAt(i); + + if (frameData->mFrame == aFrame) { + rv = mFrames.RemoveElementAt(i); + delete frameData; + break; + } + } + if (0 == mFrames.Count()) { Stop(); } @@ -239,14 +262,14 @@ void nsBlinkTimer::Notify(nsITimer *timer) PRInt32 i, n = mFrames.Count(); for (i = 0; i < n; i++) { - nsIFrame* text = (nsIFrame*) mFrames.ElementAt(i); + FrameData* frameData = (FrameData*) mFrames.ElementAt(i); // Determine damaged area and tell view manager to redraw it nsPoint offset; nsRect bounds; - text->GetRect(bounds); + frameData->mFrame->GetRect(bounds); nsIView* view; - text->GetOffsetFromView(offset, &view); + frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view); nsIViewManager* vm; view->GetViewManager(vm); bounds.x = offset.x; @@ -290,7 +313,7 @@ public: return NS_OK; } - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; /** * Get the "type" of the frame @@ -325,9 +348,12 @@ public: PRInt32& aOffset); - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread); - NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos); + NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos); NS_IMETHOD HandleMultiplePress(nsIPresContext& aPresContext, nsGUIEvent * aEvent, @@ -1281,8 +1307,8 @@ nsTextFrame::GetPositionSlowly(nsIPresContext& aPresContext, } nsIView * view; nsPoint origin; - GetView(&view); - GetOffsetFromView(origin, &view); + GetView(&aPresContext, &view); + GetOffsetFromView(&aPresContext, origin, &view); if (aXCoord - origin.x <0) { @@ -1912,7 +1938,7 @@ nsTextFrame::GetPosition(nsIPresContext& aCX, PRUnichar* text = paintBuffer.mBuffer; nsPoint origin; nsIView * view; - GetOffsetFromView(origin, &view); + GetOffsetFromView(&aCX, origin, &view); PRBool found = BinarySearchForPosition(acx, text, origin.x, 0, 0, PRInt32(textLength), PRInt32(aXCoord) , //go to local coordinates @@ -1970,7 +1996,10 @@ void ForceDrawFrame(nsFrame * aFrame); //null range means the whole thing NS_IMETHODIMP -nsTextFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) +nsTextFrame::SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread) { nsresult result; if (aSelected && ParentDisablesSelection()) @@ -2046,7 +2075,7 @@ nsTextFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) nsRect frameRect; GetRect(frameRect); nsRect rect(0, 0, frameRect.width, frameRect.height); - Invalidate(rect, PR_FALSE); + Invalidate(aPresContext, rect, PR_FALSE); // ForceDrawFrame(this); } if (aSpread == eSpreadDown) @@ -2054,14 +2083,14 @@ nsTextFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) nsIFrame *frame; GetPrevInFlow(&frame); while(frame){ - frame->SetSelected(aRange,aSelected,eSpreadNone); + frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); result = frame->GetPrevInFlow(&frame); if (NS_FAILED(result)) break; } GetNextInFlow(&frame); while (frame){ - frame->SetSelected(aRange,aSelected,eSpreadNone); + frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); result = frame->GetNextInFlow(&frame); if (NS_FAILED(result)) break; @@ -2181,7 +2210,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, NS_IMETHODIMP -nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) +nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) { if (!aPos || !mContent) @@ -2198,13 +2227,13 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) NS_ASSERTION(PR_FALSE,"nsTextFrame::PeekOffset no more flow \n"); return NS_ERROR_INVALID_ARG; } - return nextInFlow->PeekOffset(aPos); + return nextInFlow->PeekOffset(aPresContext, aPos); } if (aPos->mAmount == eSelectLine || aPos->mAmount == eSelectBeginLine || aPos->mAmount == eSelectEndLine) { - return nsFrame::PeekOffset(aPos); + return nsFrame::PeekOffset(aPresContext, aPos); } nsAutoTextBuffer paintBuffer; @@ -2242,7 +2271,7 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) else { aPos->mAmount = eSelectDir;//go to "next" or previous frame based on direction not THIS frame - return nsFrame::PeekOffset(aPos);//no matter what this is not a valid frame to end up on + return nsFrame::PeekOffset(aPresContext, aPos);//no matter what this is not a valid frame to end up on } } break; @@ -2305,7 +2334,7 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) { result = GetFrameFromDirection(aPos); if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this) - result = aPos->mResultFrame->PeekOffset(aPos); + result = aPos->mResultFrame->PeekOffset(aPresContext, aPos); } else aPos->mResultContent = mContent; @@ -2425,7 +2454,7 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) result = GetFrameFromDirection(aPos); if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this) { - if (NS_SUCCEEDED(result = aPos->mResultFrame->PeekOffset(aPos))) + if (NS_SUCCEEDED(result = aPos->mResultFrame->PeekOffset(aPresContext, aPos))) return NS_OK;//else fall through } else @@ -2569,7 +2598,7 @@ nsTextFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); - rv = PeekOffset(&startpos); + rv = PeekOffset(&aPresContext, &startpos); if (NS_FAILED(rv)) return rv; nsPeekOffsetStruct endpos; @@ -2581,7 +2610,7 @@ nsTextFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_FALSE, PR_FALSE); - rv = PeekOffset(&endpos); + rv = PeekOffset(&aPresContext, &endpos); if (NS_FAILED(rv)) return rv; @@ -2673,7 +2702,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, if (ts.mFont->mFont.decorations & NS_STYLE_TEXT_DECORATION_BLINK) { if (0 == (mState & TEXT_BLINK_ON)) { mState |= TEXT_BLINK_ON; - gTextBlinker->AddFrame(this); + gTextBlinker->AddFrame(&aPresContext, this); } } else { @@ -3049,7 +3078,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, // XXX We need a finer granularity than this, but it isn't clear what // has actually changed... if (eReflowReason_Incremental == aReflowState.reason) { - Invalidate(mRect); + Invalidate(&aPresContext, mRect); } nsReflowStatus rs = (offset == contentLength) @@ -3372,13 +3401,13 @@ nsTextFrame::GetFrameName(nsString& aResult) const } NS_IMETHODIMP -nsTextFrame::List(FILE* out, PRInt32 aIndent) const +nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { // Output the tag IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index a80208b820e..4b981bedc44 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -292,7 +292,7 @@ ViewportFrame::CalculateFixedContainingBlockSize(nsIPresContext& aPresC nsIFrame* kidFrame = mFrames.FirstChild(); nsIView* kidView; - kidFrame->GetView(&kidView); + kidFrame->GetView(&aPresContext, &kidView); if (nsnull != kidView) { nsIScrollableView* scrollingView; @@ -359,7 +359,7 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext& aPresContext, nsRect rect(kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left, kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - aKidFrame->SetRect(rect); + aKidFrame->SetRect(&aPresContext, rect); htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); } @@ -514,7 +514,7 @@ ViewportFrame::Reflow(nsIPresContext& aPresContext, aStatus); nsRect rect(0, 0, kidDesiredSize.width, kidDesiredSize.height); - kidFrame->SetRect(rect); + kidFrame->SetRect(&aPresContext, rect); kidRect = rect; // XXX We should resolve the details of who/when DidReflow() @@ -554,7 +554,7 @@ ViewportFrame::Reflow(nsIPresContext& aPresContext, if ((eReflowReason_Initial == aReflowState.reason) || (eReflowReason_Resize == aReflowState.reason)) { nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height); - Invalidate(damageRect, PR_FALSE); + Invalidate(&aPresContext, damageRect, PR_FALSE); } NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus); diff --git a/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp b/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp index 3c6cec3b5d2..4d02a172b09 100644 --- a/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp +++ b/mozilla/layout/html/base/src/nsAbsoluteContainingBlock.cpp @@ -365,7 +365,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat nsRect rect(border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left, border.top + kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - aKidFrame->SetRect(rect); + aKidFrame->SetRect(&aPresContext, rect); } return rv; diff --git a/mozilla/layout/html/base/src/nsAreaFrame.cpp b/mozilla/layout/html/base/src/nsAreaFrame.cpp index 4b0a864163a..fb3c0674d1a 100644 --- a/mozilla/layout/html/base/src/nsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsAreaFrame.cpp @@ -339,7 +339,7 @@ nsAreaFrame::DidReflow(nsIPresContext& aPresContext, const nsStyleDisplay* display = (const nsStyleDisplay*) mStyleContext->GetStyleData(eStyleStruct_Display); - GetView(&view); + GetView(&aPresContext, &view); if (view && (NS_STYLE_OVERFLOW_VISIBLE == display->mOverflow)) { // Don't let our base class position the view since we're doing it mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; @@ -357,7 +357,7 @@ nsAreaFrame::DidReflow(nsIPresContext& aPresContext, // XXX We need to handle the case where child frames stick out on the // left and top edges as well... - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); vm->ResizeView(view, mCombinedArea.XMost(), mCombinedArea.YMost()); vm->MoveViewTo(view, origin.x, origin.y); NS_RELEASE(vm); diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 9fd40ccd31c..ad3f9816883 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -1016,7 +1016,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, fc->mCombinedArea.y += finalDeltaY; nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame(); floater->GetRect(r); - floater->MoveTo(r.x, r.y + finalDeltaY); + floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY); #ifdef DEBUG if (gNoisyReflow || gNoisySpaceManager) { nscoord tx, ty; @@ -1161,12 +1161,12 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) } NS_METHOD -nsBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -1211,7 +1211,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const if (nsnull != mLines) { nsLineBox* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(aPresContext, out, aIndent); line = line->mNext; } } @@ -1234,7 +1234,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1416,7 +1416,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=initial\n"); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareInitialReflow(state); mState &= ~NS_FRAME_FIRST_REFLOW; break; @@ -1467,7 +1467,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=resize (%d)\n", aReflowState.reason); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareResizeReflow(state); break; } @@ -1534,7 +1534,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, if (isStyleChange) { // Lots of things could have changed so damage our entire // bounds - Invalidate(nsRect(0, 0, mRect.width, mRect.height)); + Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height)); } else { nsMargin border = aReflowState.mComputedBorderPadding - @@ -1560,7 +1560,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.height = mRect.height; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } // See if our height changed @@ -1583,7 +1583,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = mRect.height - border.bottom; damageRect.height = border.bottom; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } } @@ -2429,7 +2429,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) RecoverStateFrom(aState, line, deltaY, incrementalReflow ? &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { - Invalidate(damageRect); + Invalidate(aState.mPresContext, damageRect); } } @@ -2482,7 +2482,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) frame->SetParent(this); // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, mNextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, mNextInFlow, this); lastFrame = frame; frame->GetNextSibling(&frame); } @@ -2602,7 +2602,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // XXX We need to improve on this... nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } else { if (oldCombinedArea.width != lineCombinedArea.width) { @@ -2618,7 +2618,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.x; dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } if (oldCombinedArea.height != lineCombinedArea.height) { nsRect dirtyRect; @@ -2633,7 +2633,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.YMost(), lineCombinedArea.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } } @@ -2649,7 +2649,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } @@ -2758,7 +2758,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState, // When pushing and pulling frames we need to check for whether any // views need to be reparented NS_ASSERTION(oldParentFrame != this, "unexpected parent frame"); - nsHTMLContainerFrame::ReparentFrameView(frame, oldParentFrame, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, oldParentFrame, this); // The frame is being pulled from a next-in-flow; therefore we // need to add it to our sibling list. @@ -2796,7 +2796,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, kid->GetRect(r); if (aDY) { r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); } // If the child has any floaters that impact the space-manager, @@ -2827,7 +2827,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, while (--n >= 0) { kid->GetRect(r); r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); kid->GetNextSibling(&kid); } } @@ -3361,7 +3361,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nscoord bulletTopMargin = applyTopMargin ? collapsedBottomMargin : 0; bbox.y = aState.BorderPadding().top + ascent - metrics.ascent + bulletTopMargin; - mBullet->SetRect(bbox); + mBullet->SetRect(aState.mPresContext, bbox); } } else { @@ -4160,7 +4160,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState) } PRBool -nsBlockFrame::DrainOverflowLines() +nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) { #ifdef DEBUG VerifyOverflowSituation(); @@ -4183,7 +4183,7 @@ nsBlockFrame::DrainOverflowLines() // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, prevBlock, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this); // Get the next frame lastFrame = frame; @@ -4721,7 +4721,7 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent(&oldParent); aFrame->SetParent(this); if (this != oldParent) { - nsHTMLContainerFrame::ReparentFrameView(aFrame, oldParent, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this); aPresContext->ReParentStyleContext(aFrame, mStyleContext); } aFrame->GetNextSibling(&aFrame); @@ -4902,7 +4902,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, // cases... nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); - Invalidate(lineCombinedArea); + Invalidate(aPresContext, lineCombinedArea); delete line; line = next; } @@ -5063,7 +5063,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, const nsHTMLReflowMetrics& metrics = brc.GetMetrics(); aCombinedRect = metrics.mCombinedArea; - floater->SizeTo(metrics.width, metrics.height); + floater->SizeTo(aState.mPresContext, metrics.width, metrics.height); // Stash away the max-element-size for later aState.StoreMaxElementSize(floater, brc.GetMaxElementSize()); @@ -5402,7 +5402,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, x += aFloaterCache->mOffsets.left; y += aFloaterCache->mOffsets.top; } - floater->MoveTo(x, y); + floater->MoveTo(mPresContext, x, y); // Update the floater combined area state nsRect combinedArea = aFloaterCache->mCombinedArea; @@ -5818,7 +5818,7 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, while(NS_SUCCEEDED(result)) { //we are starting aloop to allow us to "drill down to the one we want" - mainframe->GetOffsetFromView(origin, &parentWithView); + mainframe->GetOffsetFromView(&aPresContext, origin, &parentWithView); if (NS_FAILED(result)) return NS_OK;//do not handle @@ -5865,7 +5865,8 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - result = nsFrame::GetNextPrevLineFromeBlockFrame(&pos, + result = nsFrame::GetNextPrevLineFromeBlockFrame(&aPresContext, + &pos, mainframe, closestLine-1, 0 @@ -5893,20 +5894,22 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsresult rv = GetFrameForPointUsing(aPoint, nsnull, aFrame); + nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); if (NS_OK == rv) { return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (mFloaters.NotEmpty()) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } @@ -6339,7 +6342,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // the final vertical location. const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; - mBullet->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height)); + mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index 9d30e359ee7..b9a35c5a3ce 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -93,14 +93,14 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD GetFrameType(nsIAtom** aType) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif NS_IMETHOD VerifyTree() const; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, nsGUIEvent* aEvent, nsEventStatus& aEventStatus); @@ -161,7 +161,7 @@ protected: void SlideLine(nsBlockReflowState& aState, nsLineBox* aLine, nscoord aDY); - PRBool DrainOverflowLines(); + PRBool DrainOverflowLines(nsIPresContext* aPresContext); virtual PRIntn GetSkipSides() const; diff --git a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp index 01c9c92be88..c48c29ac937 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowContext.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowContext.cpp @@ -419,7 +419,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, // Empty blocks do not have anything special done to them and they // always fit. Note: don't force the width to 0 nsRect r(x, y, mMetrics.width, 0); - mFrame->SetRect(r); + mFrame->SetRect(mPresContext, r); aInFlowBounds = r; // Retain combined area information in case we contain a floater @@ -547,7 +547,7 @@ nsBlockReflowContext::PlaceBlock(PRBool aForceFit, aCombinedRect.height = mMetrics.mCombinedArea.height; // Now place the frame - mFrame->SetRect(nsRect(x, y, mMetrics.width, mMetrics.height)); + mFrame->SetRect(mPresContext, nsRect(x, y, mMetrics.width, mMetrics.height)); // XXX obsolete, i believe... #if 0 diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index 9fd40ccd31c..ad3f9816883 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -1016,7 +1016,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, fc->mCombinedArea.y += finalDeltaY; nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame(); floater->GetRect(r); - floater->MoveTo(r.x, r.y + finalDeltaY); + floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY); #ifdef DEBUG if (gNoisyReflow || gNoisySpaceManager) { nscoord tx, ty; @@ -1161,12 +1161,12 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) } NS_METHOD -nsBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -1211,7 +1211,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const if (nsnull != mLines) { nsLineBox* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(aPresContext, out, aIndent); line = line->mNext; } } @@ -1234,7 +1234,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1416,7 +1416,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=initial\n"); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareInitialReflow(state); mState &= ~NS_FRAME_FIRST_REFLOW; break; @@ -1467,7 +1467,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=resize (%d)\n", aReflowState.reason); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareResizeReflow(state); break; } @@ -1534,7 +1534,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, if (isStyleChange) { // Lots of things could have changed so damage our entire // bounds - Invalidate(nsRect(0, 0, mRect.width, mRect.height)); + Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height)); } else { nsMargin border = aReflowState.mComputedBorderPadding - @@ -1560,7 +1560,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.height = mRect.height; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } // See if our height changed @@ -1583,7 +1583,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = mRect.height - border.bottom; damageRect.height = border.bottom; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } } @@ -2429,7 +2429,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) RecoverStateFrom(aState, line, deltaY, incrementalReflow ? &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { - Invalidate(damageRect); + Invalidate(aState.mPresContext, damageRect); } } @@ -2482,7 +2482,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) frame->SetParent(this); // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, mNextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, mNextInFlow, this); lastFrame = frame; frame->GetNextSibling(&frame); } @@ -2602,7 +2602,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // XXX We need to improve on this... nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } else { if (oldCombinedArea.width != lineCombinedArea.width) { @@ -2618,7 +2618,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.x; dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } if (oldCombinedArea.height != lineCombinedArea.height) { nsRect dirtyRect; @@ -2633,7 +2633,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.YMost(), lineCombinedArea.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } } @@ -2649,7 +2649,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } @@ -2758,7 +2758,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState, // When pushing and pulling frames we need to check for whether any // views need to be reparented NS_ASSERTION(oldParentFrame != this, "unexpected parent frame"); - nsHTMLContainerFrame::ReparentFrameView(frame, oldParentFrame, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, oldParentFrame, this); // The frame is being pulled from a next-in-flow; therefore we // need to add it to our sibling list. @@ -2796,7 +2796,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, kid->GetRect(r); if (aDY) { r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); } // If the child has any floaters that impact the space-manager, @@ -2827,7 +2827,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, while (--n >= 0) { kid->GetRect(r); r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); kid->GetNextSibling(&kid); } } @@ -3361,7 +3361,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nscoord bulletTopMargin = applyTopMargin ? collapsedBottomMargin : 0; bbox.y = aState.BorderPadding().top + ascent - metrics.ascent + bulletTopMargin; - mBullet->SetRect(bbox); + mBullet->SetRect(aState.mPresContext, bbox); } } else { @@ -4160,7 +4160,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState) } PRBool -nsBlockFrame::DrainOverflowLines() +nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) { #ifdef DEBUG VerifyOverflowSituation(); @@ -4183,7 +4183,7 @@ nsBlockFrame::DrainOverflowLines() // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, prevBlock, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this); // Get the next frame lastFrame = frame; @@ -4721,7 +4721,7 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent(&oldParent); aFrame->SetParent(this); if (this != oldParent) { - nsHTMLContainerFrame::ReparentFrameView(aFrame, oldParent, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this); aPresContext->ReParentStyleContext(aFrame, mStyleContext); } aFrame->GetNextSibling(&aFrame); @@ -4902,7 +4902,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, // cases... nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); - Invalidate(lineCombinedArea); + Invalidate(aPresContext, lineCombinedArea); delete line; line = next; } @@ -5063,7 +5063,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, const nsHTMLReflowMetrics& metrics = brc.GetMetrics(); aCombinedRect = metrics.mCombinedArea; - floater->SizeTo(metrics.width, metrics.height); + floater->SizeTo(aState.mPresContext, metrics.width, metrics.height); // Stash away the max-element-size for later aState.StoreMaxElementSize(floater, brc.GetMaxElementSize()); @@ -5402,7 +5402,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, x += aFloaterCache->mOffsets.left; y += aFloaterCache->mOffsets.top; } - floater->MoveTo(x, y); + floater->MoveTo(mPresContext, x, y); // Update the floater combined area state nsRect combinedArea = aFloaterCache->mCombinedArea; @@ -5818,7 +5818,7 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, while(NS_SUCCEEDED(result)) { //we are starting aloop to allow us to "drill down to the one we want" - mainframe->GetOffsetFromView(origin, &parentWithView); + mainframe->GetOffsetFromView(&aPresContext, origin, &parentWithView); if (NS_FAILED(result)) return NS_OK;//do not handle @@ -5865,7 +5865,8 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - result = nsFrame::GetNextPrevLineFromeBlockFrame(&pos, + result = nsFrame::GetNextPrevLineFromeBlockFrame(&aPresContext, + &pos, mainframe, closestLine-1, 0 @@ -5893,20 +5894,22 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsresult rv = GetFrameForPointUsing(aPoint, nsnull, aFrame); + nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); if (NS_OK == rv) { return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (mFloaters.NotEmpty()) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } @@ -6339,7 +6342,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // the final vertical location. const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; - mBullet->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height)); + mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index 9fd40ccd31c..ad3f9816883 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -1016,7 +1016,7 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine, fc->mCombinedArea.y += finalDeltaY; nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame(); floater->GetRect(r); - floater->MoveTo(r.x, r.y + finalDeltaY); + floater->MoveTo(mPresContext, r.x, r.y + finalDeltaY); #ifdef DEBUG if (gNoisyReflow || gNoisySpaceManager) { nscoord tx, ty; @@ -1161,12 +1161,12 @@ ListTextRuns(FILE* out, PRInt32 aIndent, nsTextRun* aRuns) } NS_METHOD -nsBlockFrame::List(FILE* out, PRInt32 aIndent) const +nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -1211,7 +1211,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const if (nsnull != mLines) { nsLineBox* line = mLines; while (nsnull != line) { - line->List(out, aIndent); + line->List(aPresContext, out, aIndent); line = line->mNext; } } @@ -1234,7 +1234,7 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); @@ -1416,7 +1416,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=initial\n"); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareInitialReflow(state); mState &= ~NS_FRAME_FIRST_REFLOW; break; @@ -1467,7 +1467,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, ListTag(stdout); printf(": reflow=resize (%d)\n", aReflowState.reason); #endif - DrainOverflowLines(); + DrainOverflowLines(&aPresContext); rv = PrepareResizeReflow(state); break; } @@ -1534,7 +1534,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, if (isStyleChange) { // Lots of things could have changed so damage our entire // bounds - Invalidate(nsRect(0, 0, mRect.width, mRect.height)); + Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height)); } else { nsMargin border = aReflowState.mComputedBorderPadding - @@ -1560,7 +1560,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.height = mRect.height; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } // See if our height changed @@ -1583,7 +1583,7 @@ nsBlockFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = mRect.height - border.bottom; damageRect.height = border.bottom; } - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } } @@ -2429,7 +2429,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) RecoverStateFrom(aState, line, deltaY, incrementalReflow ? &damageRect : 0); if (incrementalReflow && !damageRect.IsEmpty()) { - Invalidate(damageRect); + Invalidate(aState.mPresContext, damageRect); } } @@ -2482,7 +2482,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState) frame->SetParent(this); // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, mNextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, mNextInFlow, this); lastFrame = frame; frame->GetNextSibling(&frame); } @@ -2602,7 +2602,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, // XXX We need to improve on this... nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, lineCombinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } else { if (oldCombinedArea.width != lineCombinedArea.width) { @@ -2618,7 +2618,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.x; dirtyRect.height = PR_MAX(oldCombinedArea.height, lineCombinedArea.height); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } if (oldCombinedArea.height != lineCombinedArea.height) { nsRect dirtyRect; @@ -2633,7 +2633,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, dirtyRect.height = PR_MAX(oldCombinedArea.YMost(), lineCombinedArea.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } } @@ -2649,7 +2649,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, nsRect dirtyRect; dirtyRect.UnionRect(oldCombinedArea, combinedArea); - Invalidate(dirtyRect); + Invalidate(aState.mPresContext, dirtyRect); } } @@ -2758,7 +2758,7 @@ nsBlockFrame::PullFrame(nsBlockReflowState& aState, // When pushing and pulling frames we need to check for whether any // views need to be reparented NS_ASSERTION(oldParentFrame != this, "unexpected parent frame"); - nsHTMLContainerFrame::ReparentFrameView(frame, oldParentFrame, this); + nsHTMLContainerFrame::ReparentFrameView(aState.mPresContext, frame, oldParentFrame, this); // The frame is being pulled from a next-in-flow; therefore we // need to add it to our sibling list. @@ -2796,7 +2796,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, kid->GetRect(r); if (aDY) { r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); } // If the child has any floaters that impact the space-manager, @@ -2827,7 +2827,7 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState, while (--n >= 0) { kid->GetRect(r); r.y += aDY; - kid->SetRect(r); + kid->SetRect(aState.mPresContext, r); kid->GetNextSibling(&kid); } } @@ -3361,7 +3361,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState, nscoord bulletTopMargin = applyTopMargin ? collapsedBottomMargin : 0; bbox.y = aState.BorderPadding().top + ascent - metrics.ascent + bulletTopMargin; - mBullet->SetRect(bbox); + mBullet->SetRect(aState.mPresContext, bbox); } } else { @@ -4160,7 +4160,7 @@ nsBlockFrame::PushLines(nsBlockReflowState& aState) } PRBool -nsBlockFrame::DrainOverflowLines() +nsBlockFrame::DrainOverflowLines(nsIPresContext* aPresContext) { #ifdef DEBUG VerifyOverflowSituation(); @@ -4183,7 +4183,7 @@ nsBlockFrame::DrainOverflowLines() // When pushing and pulling frames we need to check for whether any // views need to be reparented - nsHTMLContainerFrame::ReparentFrameView(frame, prevBlock, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, prevBlock, this); // Get the next frame lastFrame = frame; @@ -4721,7 +4721,7 @@ nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame) aFrame->GetParent(&oldParent); aFrame->SetParent(this); if (this != oldParent) { - nsHTMLContainerFrame::ReparentFrameView(aFrame, oldParent, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this); aPresContext->ReParentStyleContext(aFrame, mStyleContext); } aFrame->GetNextSibling(&aFrame); @@ -4902,7 +4902,7 @@ nsBlockFrame::DoRemoveFrame(nsIPresContext* aPresContext, // cases... nsRect lineCombinedArea; line->GetCombinedArea(&lineCombinedArea); - Invalidate(lineCombinedArea); + Invalidate(aPresContext, lineCombinedArea); delete line; line = next; } @@ -5063,7 +5063,7 @@ nsBlockFrame::ReflowFloater(nsBlockReflowState& aState, const nsHTMLReflowMetrics& metrics = brc.GetMetrics(); aCombinedRect = metrics.mCombinedArea; - floater->SizeTo(metrics.width, metrics.height); + floater->SizeTo(aState.mPresContext, metrics.width, metrics.height); // Stash away the max-element-size for later aState.StoreMaxElementSize(floater, brc.GetMaxElementSize()); @@ -5402,7 +5402,7 @@ nsBlockReflowState::PlaceFloater(nsFloaterCache* aFloaterCache, x += aFloaterCache->mOffsets.left; y += aFloaterCache->mOffsets.top; } - floater->MoveTo(x, y); + floater->MoveTo(mPresContext, x, y); // Update the floater combined area state nsRect combinedArea = aFloaterCache->mCombinedArea; @@ -5818,7 +5818,7 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, while(NS_SUCCEEDED(result)) { //we are starting aloop to allow us to "drill down to the one we want" - mainframe->GetOffsetFromView(origin, &parentWithView); + mainframe->GetOffsetFromView(&aPresContext, origin, &parentWithView); if (NS_FAILED(result)) return NS_OK;//do not handle @@ -5865,7 +5865,8 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, pos.mDirection = eDirNext; pos.mDesiredX = aEvent->point.x; - result = nsFrame::GetNextPrevLineFromeBlockFrame(&pos, + result = nsFrame::GetNextPrevLineFromeBlockFrame(&aPresContext, + &pos, mainframe, closestLine-1, 0 @@ -5893,20 +5894,22 @@ nsBlockFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsBlockFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsBlockFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsresult rv = GetFrameForPointUsing(aPoint, nsnull, aFrame); + nsresult rv = GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); if (NS_OK == rv) { return NS_OK; } if (nsnull != mBullet) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::bulletList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::bulletList, aFrame); if (NS_OK == rv) { return NS_OK; } } if (mFloaters.NotEmpty()) { - rv = GetFrameForPointUsing(aPoint, nsLayoutAtoms::floaterList, aFrame); + rv = GetFrameForPointUsing(aPresContext, aPoint, nsLayoutAtoms::floaterList, aFrame); if (NS_OK == rv) { return NS_OK; } @@ -6339,7 +6342,7 @@ nsBlockFrame::ReflowBullet(nsBlockReflowState& aState, // the final vertical location. const nsMargin& bp = aState.BorderPadding(); nscoord y = bp.top; - mBullet->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height)); + mBullet->SetRect(aState.mPresContext, nsRect(x, y, aMetrics.width, aMetrics.height)); } //XXX get rid of this -- its slow diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index 9eb20819086..b7d4bfd1678 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -80,7 +80,7 @@ nsContainerFrame::Destroy(nsIPresContext& aPresContext) { // Prevent event dispatch during destruction nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull != view) { view->SetClientData(nsnull); } @@ -205,7 +205,7 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, nsFramePaintLayer aWhichLayer) { nsIView *pView; - aFrame->GetView(&pView); + aFrame->GetView(&aPresContext, &pView); if (nsnull == pView) { nsRect kidRect; aFrame->GetRect(kidRect); @@ -263,14 +263,16 @@ nsContainerFrame::PaintChild(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsContainerFrame::GetFrameForPoint(const nsPoint& aPoint, +nsContainerFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) { - return GetFrameForPointUsing(aPoint, nsnull, aFrame); + return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aFrame); } nsresult -nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, +nsContainerFrame::GetFrameForPointUsing(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIAtom* aList, nsIFrame** aFrame) { @@ -284,7 +286,7 @@ nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, kid->GetRect(kidRect); if (kidRect.Contains(aPoint)) { tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y); - return kid->GetFrameForPoint(tmp, aFrame); + return kid->GetFrameForPoint(aPresContext, tmp, aFrame); } kid->GetNextSibling(&kid); } @@ -296,7 +298,7 @@ nsContainerFrame::GetFrameForPointUsing(const nsPoint& aPoint, if (NS_FRAME_OUTSIDE_CHILDREN & state) { kid->GetRect(kidRect); tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y); - if (NS_OK == kid->GetFrameForPoint(tmp, aFrame)) { + if (NS_OK == kid->GetFrameForPoint(aPresContext, tmp, aFrame)) { return NS_OK; } else { @@ -561,7 +563,7 @@ nsContainerFrame::PushChildren(nsIPresContext* aPresContext, // When pushing and pulling frames we need to check for whether any // views need to be reparented. for (nsIFrame* f = aFromChild; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, this, mNextInFlow); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, this, mNextInFlow); } nextInFlow->mFrames.InsertFrames(mNextInFlow, nsnull, aFromChild); } @@ -594,7 +596,7 @@ nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) // When pushing and pulling frames we need to check for whether any // views need to be reparented. for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); } mFrames.InsertFrames(this, nsnull, prevOverflowFrames); result = PR_TRUE; @@ -615,12 +617,12 @@ nsContainerFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) // Debugging NS_IMETHODIMP -nsContainerFrame::List(FILE* out, PRInt32 aIndent) const +nsContainerFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -658,7 +660,7 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const } fputs("<\n", out); while (nsnull != kid) { - kid->List(out, aIndent + 1); + kid->List(aPresContext, out, aIndent + 1); kid->GetNextSibling(&kid); } IndentBy(out, aIndent); diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index a7a2d221455..6ec21ed5a38 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -37,14 +37,15 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame); NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, nsIAtom* aListName, nsIFrame* aOldFrame, nsIFrame* aNewFrame); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; #ifdef DEBUG NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; #endif @@ -66,7 +67,8 @@ protected: nsContainerFrame(); ~nsContainerFrame(); - nsresult GetFrameForPointUsing(const nsPoint& aPoint, + nsresult GetFrameForPointUsing(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIAtom* aList, nsIFrame** aFrame); diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index d424ef07859..1e667fd6c15 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -216,8 +216,8 @@ nsFirstLetterFrame::Reflow(nsIPresContext& aPresContext, } // Place and size the child and update the output metrics - kid->MoveTo(bp.left, bp.top); - kid->SizeTo(aMetrics.width, aMetrics.height); + kid->MoveTo(&aPresContext, bp.left, bp.top); + kid->SizeTo(&aPresContext, aMetrics.width, aMetrics.height); aMetrics.width += lr; aMetrics.height += tb; if (aMetrics.maxElementSize) { @@ -278,7 +278,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext) // views need to be reparented. nsIFrame* f = overflowFrames; while (f) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); f->GetNextSibling(&f); } mFrames.InsertFrames(this, nsnull, overflowFrames); diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index aac1fdc6fd9..7c125ffdc11 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -77,7 +77,7 @@ static NS_DEFINE_IID(kCTransferableCID, NS_TRANSFERABLE_CID); #include "nsICaret.h" #include "nsILineIterator.h" // [HACK] Foward Declarations -void ForceDrawFrame(nsFrame * aFrame); +void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame); //non Hack prototypes #if 0 static void RefreshContentFrames(nsIPresContext& aPresContext, nsIContent * aStartContent, nsIContent * aEndContent); @@ -487,14 +487,15 @@ NS_IMETHODIMP nsFrame::GetSize(nsSize& aSize) const return NS_OK; } -NS_IMETHODIMP nsFrame::SetRect(const nsRect& aRect) +NS_IMETHODIMP nsFrame::SetRect(nsIPresContext* aPresContext, + const nsRect& aRect) { - MoveTo(aRect.x, aRect.y); - SizeTo(aRect.width, aRect.height); + MoveTo(aPresContext, aRect.x, aRect.y); + SizeTo(aPresContext, aRect.width, aRect.height); return NS_OK; } -NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) +NS_IMETHODIMP nsFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY) { mRect.x = aX; mRect.y = aY; @@ -509,7 +510,7 @@ NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) // parent frame (our parent frame may not have a view). nsIView* parentWithView; nsPoint origin; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(aPresContext, origin, &parentWithView); nsIViewManager *vm; mView->GetViewManager(vm); vm->MoveViewTo(mView, origin.x, origin.y); @@ -520,7 +521,7 @@ NS_IMETHODIMP nsFrame::MoveTo(nscoord aX, nscoord aY) return NS_OK; } -NS_IMETHODIMP nsFrame::SizeTo(nscoord aWidth, nscoord aHeight) +NS_IMETHODIMP nsFrame::SizeTo(nsIPresContext* aPresContext, nscoord aWidth, nscoord aHeight) { mRect.width = aWidth; mRect.height = aHeight; @@ -881,7 +882,7 @@ nsFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_TRUE, PR_TRUE); - rv = PeekOffset(&startpos); + rv = PeekOffset(&aPresContext, &startpos); if (NS_FAILED(rv)) return rv; nsPeekOffsetStruct endpos; @@ -893,7 +894,7 @@ nsFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_FALSE, PR_TRUE); - rv = PeekOffset(&endpos); + rv = PeekOffset(&aPresContext, &endpos); if (NS_FAILED(rv)) return rv; @@ -996,7 +997,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, nsIFrame *kid = nsnull; nsIFrame *closestFrame = nsnull; - result = GetClosestViewForFrame(this, &view); + result = GetClosestViewForFrame(&aCX, this, &view); if (NS_FAILED(result)) return result; @@ -1016,7 +1017,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, nsIView * kidView = nsnull; kid->GetRect(rect); - kid->GetOffsetFromView(offsetPoint, &kidView); + kid->GetOffsetFromView(&aCX, offsetPoint, &kidView); rect.x = offsetPoint.x; rect.y = offsetPoint.y; @@ -1063,7 +1064,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, nsPoint newPoint = aPoint; nsIView *closestView = nsnull; - result = GetClosestViewForFrame(closestFrame, &closestView); + result = GetClosestViewForFrame(&aCX, closestFrame, &closestView); if (NS_FAILED(result)) return result; @@ -1094,7 +1095,7 @@ nsresult nsFrame::GetContentAndOffsetsFromPoint(nsIPresContext& aCX, if (NS_FAILED(result)) return result; nsPoint offsetPoint; - GetOffsetFromView(offsetPoint, &view); + GetOffsetFromView(&aCX, offsetPoint, &view); thisRect.x = offsetPoint.x; thisRect.y = offsetPoint.y; @@ -1140,7 +1141,9 @@ nsFrame::GetCursor(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { *aFrame = this; return NS_OK; @@ -1193,7 +1196,7 @@ nsFrame::DidReflow(nsIPresContext& aPresContext, // parent frame (our parent frame may not have a view). nsIView* parentWithView; nsPoint origin; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); vm->ResizeView(mView, mRect.width, mRect.height); vm->MoveViewTo(mView, origin.x, origin.y); } @@ -1419,14 +1422,14 @@ NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*) } // Associated view object -NS_IMETHODIMP nsFrame::GetView(nsIView** aView) const +NS_IMETHODIMP nsFrame::GetView(nsIPresContext* aPresContext, nsIView** aView) const { NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer"); *aView = mView; return NS_OK; } -NS_IMETHODIMP nsFrame::SetView(nsIView* aView) +NS_IMETHODIMP nsFrame::SetView(nsIPresContext* aPresContext, nsIView* aView) { nsresult rv; @@ -1442,7 +1445,8 @@ NS_IMETHODIMP nsFrame::SetView(nsIView* aView) } // Find the first geometric parent that has a view -NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const +NS_IMETHODIMP nsFrame::GetParentWithView(nsIPresContext* aPresContext, + nsIFrame** aParent) const { NS_PRECONDITION(nsnull != aParent, "null OUT parameter pointer"); @@ -1450,7 +1454,7 @@ NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const for (parent = mParent; nsnull != parent; parent->GetParent(&parent)) { nsIView* parView; - parent->GetView(&parView); + parent->GetView(aPresContext, &parView); if (nsnull != parView) { break; } @@ -1462,7 +1466,9 @@ NS_IMETHODIMP nsFrame::GetParentWithView(nsIFrame** aParent) const // Returns the offset from this frame to the closest geometric parent that // has a view. Also returns the containing view or null in case of error -NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const +NS_IMETHODIMP nsFrame::GetOffsetFromView(nsIPresContext* aPresContext, + nsPoint& aOffset, + nsIView** aView) const { NS_PRECONDITION(nsnull != aView, "null OUT parameter pointer"); nsIFrame* frame = (nsIFrame*)this; @@ -1476,22 +1482,23 @@ NS_IMETHODIMP nsFrame::GetOffsetFromView(nsPoint& aOffset, nsIView** aView) cons aOffset += origin; frame->GetParent(&frame); if (nsnull != frame) { - frame->GetView(aView); + frame->GetView(aPresContext, aView); } } while ((nsnull != frame) && (nsnull == *aView)); return NS_OK; } -NS_IMETHODIMP nsFrame::GetWindow(nsIWidget** aWindow) const +NS_IMETHODIMP nsFrame::GetWindow(nsIPresContext* aPresContext, + nsIWidget** aWindow) const { NS_PRECONDITION(nsnull != aWindow, "null OUT parameter pointer"); nsIFrame* frame; nsIWidget* window = nsnull; - for (frame = (nsIFrame*)this; nsnull != frame; frame->GetParentWithView(&frame)) { + for (frame = (nsIFrame*)this; nsnull != frame; frame->GetParentWithView(aPresContext, &frame)) { nsIView* view; - frame->GetView(&view); + frame->GetView(aPresContext, &view); if (nsnull != view) { view->GetWidget(window); if (nsnull != window) { @@ -1513,8 +1520,9 @@ nsFrame::GetFrameType(nsIAtom** aType) const } void -nsFrame::Invalidate(const nsRect& aDamageRect, - PRBool aImmediate) const +nsFrame::Invalidate(nsIPresContext* aPresContext, + const nsRect& aDamageRect, + PRBool aImmediate) const { nsIViewManager* viewManager = nsnull; nsRect damageRect(aDamageRect); @@ -1539,7 +1547,7 @@ nsFrame::Invalidate(const nsRect& aDamageRect, nsPoint offset; nsIView* view; - GetOffsetFromView(offset, &view); + GetOffsetFromView(aPresContext, offset, &view); NS_ASSERTION(nsnull != view, "no view"); rect += offset; view->GetViewManager(viewManager); @@ -1643,7 +1651,7 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame) // Debugging NS_IMETHODIMP -nsFrame::List(FILE* out, PRInt32 aIndent) const +nsFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); @@ -1836,7 +1844,7 @@ nsFrame::VerifyTree() const /*this method may.. invalidate if the state was changed or if aForceRedraw is PR_TRUE it will not update immediately.*/ NS_IMETHODIMP -nsFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) +nsFrame::SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) { if (aSelected && ParentDisablesSelection()) return NS_OK; @@ -1869,7 +1877,7 @@ nsFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) nsRect frameRect; GetRect(frameRect); nsRect rect(0, 0, frameRect.width, frameRect.height); - Invalidate(rect, PR_FALSE); + Invalidate(aPresContext, rect, PR_FALSE); #if 0 if (aRange) { //lets see if the range contains us, if so we must redraw! @@ -1950,7 +1958,8 @@ nsFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, PRBool inHint, P } nsresult -nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, +nsFrame::GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, + nsPeekOffsetStruct *aPos, nsIFrame *aBlockFrame, PRInt32 aLineStart, PRInt8 aOutSideLimit @@ -2029,7 +2038,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, } nsPoint offset; nsIView * view; //used for call of get offset from view - aBlockFrame->GetOffsetFromView(offset,&view); + aBlockFrame->GetOffsetFromView(aPresContext, offset,&view); nscoord newDesiredX = aPos->mDesiredX - offset.x;//get desired x into blockframe coordinates! result = it->FindFrameAt(searchingLine, newDesiredX, &resultFrame, &isBeforeFirstFrame, &isAfterLastFrame); } @@ -2135,7 +2144,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, aPos->mPreferLeft = !(aPos->mDirection == eDirNext); if (aPos->mDirection == eDirPrevious) aPos->mStartOffset = -1;//start from end - return aBlockFrame->PeekOffset(aPos); + return aBlockFrame->PeekOffset(aPresContext, aPos); } } return NS_OK; @@ -2143,7 +2152,7 @@ nsFrame::GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, NS_IMETHODIMP -nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) +nsFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) { if (!aPos || !aPos->mTracker ) return NS_ERROR_NULL_POINTER; @@ -2177,7 +2186,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) { return result?result:NS_ERROR_FAILURE; } - return aPos->mResultFrame->PeekOffset(aPos); + return aPos->mResultFrame->PeekOffset(aPresContext, aPos); } else { @@ -2235,7 +2244,8 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) //it will "drill down" to find a viable frame or it will return an error. do { - result = GetNextPrevLineFromeBlockFrame(aPos, + result = GetNextPrevLineFromeBlockFrame(aPresContext, + aPos, blockFrame, thisLine, edgeCase //start from thisLine @@ -2313,7 +2323,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) { nsPoint offsetPoint; //used for offset of result frame nsIView * view; //used for call of get offset from view - firstFrame->GetOffsetFromView(offsetPoint, &view); + firstFrame->GetOffsetFromView(aPresContext, offsetPoint, &view); offsetPoint.x = 0;//all the way to the left result = firstFrame->GetContentAndOffsetsFromPoint(*(context.get()), @@ -2337,7 +2347,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) nsPoint offsetPoint; //used for offset of result frame nsIView * view; //used for call of get offset from view - nextFrame->GetOffsetFromView(offsetPoint, &view); + nextFrame->GetOffsetFromView(aPresContext, offsetPoint, &view); offsetPoint.x = 2* usedRect.width; //2* just to be sure we are off the edge @@ -2363,7 +2373,7 @@ nsFrame::PeekOffset(nsPeekOffsetStruct *aPos) default: { if (NS_SUCCEEDED(result)) - result = aPos->mResultFrame->PeekOffset(aPos); + result = aPos->mResultFrame->PeekOffset(aPresContext, aPos); } } return result; @@ -2497,7 +2507,9 @@ nsFrame::GetFrameFromDirection(nsPeekOffsetStruct *aPos) return NS_OK; } -nsresult nsFrame::GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView) +nsresult nsFrame::GetClosestViewForFrame(nsIPresContext* aPresContext, + nsIFrame *aFrame, + nsIView **aView) { if (!aView) return NS_ERROR_NULL_POINTER; @@ -2510,7 +2522,7 @@ nsresult nsFrame::GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView) while (parent && !*aView) { - result = parent->GetView(aView); + result = parent->GetView(aPresContext, aView); if (NS_FAILED(result)) return result; @@ -2533,18 +2545,18 @@ nsresult nsFrame::GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView) /******************************************************** * Refreshes each content's frame *********************************************************/ -static void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent) +static void RefreshAllContentFrames(nsIPresContext* aPresContext, nsIFrame * aFrame, nsIContent * aContent) { nsIContent* frameContent; aFrame->GetContent(&frameContent); if (frameContent == aContent) { - ForceDrawFrame((nsFrame *)aFrame); + ForceDrawFrame(aPresContext, (nsFrame *)aFrame); } NS_IF_RELEASE(frameContent); aFrame->FirstChild(nsnull, &aFrame); while (aFrame) { - RefreshAllContentFrames(aFrame, aContent); + RefreshAllContentFrames(aPresContext, aFrame, aContent); aFrame->GetNextSibling(&aFrame); } } @@ -2556,7 +2568,7 @@ static void RefreshAllContentFrames(nsIFrame * aFrame, nsIContent * aContent) /** * */ -void ForceDrawFrame(nsFrame * aFrame)//, PRBool) +void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame)//, PRBool) { if (aFrame == nsnull) { return; @@ -2564,7 +2576,7 @@ void ForceDrawFrame(nsFrame * aFrame)//, PRBool) nsRect rect; nsIView * view; nsPoint pnt; - aFrame->GetOffsetFromView(pnt, &view); + aFrame->GetOffsetFromView(aPresContext, pnt, &view); aFrame->GetRect(rect); rect.x = pnt.x; rect.y = pnt.y; diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 319b86cc2cf..56ec5d9fdef 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -151,9 +151,9 @@ public: NS_IMETHOD GetRect(nsRect& aRect) const; NS_IMETHOD GetOrigin(nsPoint& aPoint) const; NS_IMETHOD GetSize(nsSize& aSize) const; - NS_IMETHOD SetRect(const nsRect& aRect); - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight); + NS_IMETHOD SetRect(nsIPresContext* aPresContext, const nsRect& aRect); + 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 Paint(nsIPresContext& aPresContext, @@ -166,8 +166,9 @@ public: NS_IMETHOD GetCursor(nsIPresContext& aPresContext, nsPoint& aPoint, PRInt32& aCursor); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, - nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame); NS_IMETHOD GetPointFromOffset(nsIPresContext* inPresContext, nsIRenderingContext* inRendContext, @@ -179,7 +180,8 @@ public: PRInt32* outFrameContentOffset, nsIFrame* *outChildFrame); - static nsresult GetNextPrevLineFromeBlockFrame(nsPeekOffsetStruct *aPos, + static nsresult GetNextPrevLineFromeBlockFrame(nsIPresContext* aPresContext, + nsPeekOffsetStruct *aPos, nsIFrame *aBlockFrame, PRInt32 aLineStart, PRInt8 aOutSideLimit @@ -204,24 +206,24 @@ public: NS_IMETHOD SetPrevInFlow(nsIFrame*); NS_IMETHOD GetNextInFlow(nsIFrame** aNextInFlow) const; NS_IMETHOD SetNextInFlow(nsIFrame*); - NS_IMETHOD GetView(nsIView** aView) const; - NS_IMETHOD SetView(nsIView* aView); - NS_IMETHOD GetParentWithView(nsIFrame** aParent) const; - NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const; - NS_IMETHOD GetWindow(nsIWidget**) const; + NS_IMETHOD GetView(nsIPresContext* aPresContext, nsIView** aView) const; + NS_IMETHOD SetView(nsIPresContext* aPresContext, nsIView* aView); + NS_IMETHOD GetParentWithView(nsIPresContext* aPresContext, nsIFrame** aParent) const; + NS_IMETHOD GetOffsetFromView(nsIPresContext* aPresContext, nsPoint& aOffset, nsIView** aView) const; + NS_IMETHOD GetWindow(nsIPresContext* aPresContext, nsIWidget**) const; NS_IMETHOD GetFrameType(nsIAtom** aType) const; NS_IMETHOD IsPercentageBase(PRBool& aBase) const; NS_IMETHOD GetNextSibling(nsIFrame** aNextSibling) const; NS_IMETHOD SetNextSibling(nsIFrame* aNextSibling); NS_IMETHOD Scrolled(nsIView *aView); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD DumpRegressionData(FILE* out, PRInt32 aIndent); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const; NS_IMETHOD VerifyTree() const; - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); NS_IMETHOD GetSelected(PRBool *aSelected) const; - NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos) ; + NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ; NS_IMETHOD GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const; @@ -272,7 +274,8 @@ public: // Invalidate part of the frame by asking the view manager to repaint. // aDamageRect is in the frame's local coordinate space - void Invalidate(const nsRect& aDamageRect, + void Invalidate(nsIPresContext* aPresContext, + const nsRect& aDamageRect, PRBool aImmediate = PR_FALSE) const; // Helper function to return the index in parent of the frame's content @@ -287,7 +290,9 @@ public: PRBool IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, nsHTMLReflowMetrics& aMetrics); - virtual nsresult GetClosestViewForFrame(nsIFrame *aFrame, nsIView **aView); + virtual nsresult GetClosestViewForFrame(nsIPresContext* aPresContext, + nsIFrame *aFrame, + nsIView **aView); #ifdef NS_DEBUG /** diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 9df2b73cc88..4fd2442ba7c 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -222,8 +222,12 @@ public: PRInt32 aMinChange, PRInt32& aTopLevelChange); - NS_IMETHOD CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState); - NS_IMETHOD RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState); + NS_IMETHOD CaptureFrameState(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsILayoutHistoryState* aState); + NS_IMETHOD RestoreFrameState(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsILayoutHistoryState* aState); // Gets and sets properties on a given frame NS_IMETHOD GetFrameProperty(nsIFrame* aFrame, @@ -1350,7 +1354,7 @@ FrameManager::ComputeStyleChangeFor(nsIPresContext& aPresContext, static nsresult -CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) +CaptureFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); @@ -1370,10 +1374,10 @@ CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) rv = content->GetContentID(&ID); if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content) nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType; - rv = statefulFrame->GetStateType(&type); + rv = statefulFrame->GetStateType(aPresContext, &type); if (NS_SUCCEEDED(rv)) { nsISupports* frameState; - rv = statefulFrame->SaveState(&frameState); + rv = statefulFrame->SaveState(aPresContext, &frameState); if (NS_SUCCEEDED(rv)) { rv = aState->AddState(ID, frameState, type); } @@ -1386,12 +1390,12 @@ CaptureFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) } NS_IMETHODIMP -FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) +FrameManager::CaptureFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); - rv = CaptureFrameStateFor(aFrame, aState); + rv = CaptureFrameStateFor(aPresContext, aFrame, aState); // Now capture state recursively for the frame hierarchy rooted at aFrame nsIAtom* childListName = nsnull; @@ -1400,7 +1404,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) nsIFrame* childFrame; aFrame->FirstChild(childListName, &childFrame); while (childFrame) { - rv = CaptureFrameState(childFrame, aState); + rv = CaptureFrameState(aPresContext, childFrame, aState); // Get the next sibling child frame childFrame->GetNextSibling(&childFrame); } @@ -1412,7 +1416,7 @@ FrameManager::CaptureFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) } static nsresult -RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) +RestoreFrameStateFor(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); @@ -1431,12 +1435,12 @@ RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) rv = content->GetContentID(&ID); if (NS_SUCCEEDED(rv) && ID) { // Must have ID (don't do anonymous content) nsIStatefulFrame::StateType type = nsIStatefulFrame::eNoType; - rv = statefulFrame->GetStateType(&type); + rv = statefulFrame->GetStateType(aPresContext, &type); if (NS_SUCCEEDED(rv)) { nsISupports* frameState = nsnull; rv = aState->GetState(ID, &frameState, type); if (NS_SUCCEEDED(rv) && nsnull != frameState) { - rv = statefulFrame->RestoreState(frameState); + rv = statefulFrame->RestoreState(aPresContext, frameState); } } } @@ -1447,12 +1451,12 @@ RestoreFrameStateFor(nsIFrame* aFrame, nsILayoutHistoryState* aState) } NS_IMETHODIMP -FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) +FrameManager::RestoreFrameState(nsIPresContext* aPresContext, nsIFrame* aFrame, nsILayoutHistoryState* aState) { nsresult rv = NS_OK; NS_PRECONDITION(nsnull != aFrame && nsnull != aState, "null parameters passed in"); - rv = RestoreFrameStateFor(aFrame, aState); + rv = RestoreFrameStateFor(aPresContext, aFrame, aState); // Now restore state recursively for the frame hierarchy rooted at aFrame nsIAtom* childListName = nsnull; @@ -1461,7 +1465,7 @@ FrameManager::RestoreFrameState(nsIFrame* aFrame, nsILayoutHistoryState* aState) nsIFrame* childFrame; aFrame->FirstChild(childListName, &childFrame); while (childFrame) { - rv = RestoreFrameState(childFrame, aState); + rv = RestoreFrameState(aPresContext, childFrame, aState); // Get the next sibling child frame childFrame->GetNextSibling(&childFrame); } diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index c14f5236865..88e0f022a1a 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -136,7 +136,8 @@ public: nsresult GetFrameSize( nsIFrame* aFrame, nsSize& aSize); - nsresult SetFrameSize( nsIFrame* aFrame, + nsresult SetFrameSize( nsIPresContext* aPresContext, + nsIFrame* aFrame, nsSize aSize); nsresult CalculateScrollAreaSize(nsIPresContext& aPresContext, @@ -203,11 +204,11 @@ public: void AddVerticalScrollbar (const nsSize& aSbSize, nsSize& aScrollAreaSize); void RemoveHorizontalScrollbar(const nsSize& aSbSize, nsSize& aScrollAreaSize); void RemoveVerticalScrollbar (const nsSize& aSbSize, nsSize& aScrollAreaSize); - nsIScrollableView* GetScrollableView(); + nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext); void GetScrolledContentSize(nsSize& aSize); - void ScrollbarChanged(nscoord aX, nscoord aY); + void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY); nsresult GetContentOf(nsIFrame* aFrame, nsIContent** aContent); nsIFrame* mHScrollbarFrame; @@ -246,12 +247,14 @@ nsGfxScrollFrame::nsGfxScrollFrame(nsIDocument* aDocument) mInner = new nsGfxScrollFrameInner(this); mInner->AddRef(); mInner->mDocument = aDocument; + mPresContext = nsnull; } nsGfxScrollFrame::~nsGfxScrollFrame() { mInner->mOuter = nsnull; mInner->Release(); + mPresContext = nsnull; } nsresult NS_CreateAnonymousNode(nsIContent* aParent, nsIAtom* aTag, PRInt32 aNameSpaceId, nsCOMPtr& aNewNode); @@ -313,6 +316,7 @@ nsGfxScrollFrame::Init(nsIPresContext& aPresContext, nsIStyleContext* aStyleContext, nsIFrame* aPrevInFlow) { + mPresContext = &aPresContext; nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aStyleContext, aPrevInFlow); @@ -342,7 +346,7 @@ nsGfxScrollFrame::SetInitialChildList(nsIPresContext& aPresContext, mInner->mHScrollbarFrame->GetNextSibling(&mInner->mVScrollbarFrame); // listen for scroll events. - mInner->GetScrollableView()->AddScrollPositionListener(mInner); + mInner->GetScrollableView(&aPresContext)->AddScrollPositionListener(mInner); return rv; } @@ -470,7 +474,7 @@ nsGfxScrollFrame::Reflow(nsIPresContext& aPresContext, // redraw anything that needs it. if ( aReflowState.reason == eReflowReason_Incremental ) if (hscrollbarNeedsReflow && vscrollbarNeedsReflow && scrollAreaNeedsReflow) - Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE); + Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE); mInner->mHscrollbarNeedsReflow = PR_FALSE; @@ -643,7 +647,7 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsGfxScrollFrame* aOuter):mHScrollb mScrollAreaFrame(nsnull), mHasVerticalScrollbar(PR_FALSE), mHasHorizontalScrollbar(PR_FALSE), - mOnePixel(20) + mOnePixel(20) { mOuter = aOuter; mRefCnt = 0; @@ -674,10 +678,10 @@ nsGfxScrollFrameInner::ScrollPositionDidChange(nsIScrollableView* aScrollable, n NS_IMETHODIMP nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, - nsIContent* aContent, - PRInt32 aNameSpaceID, - nsIAtom* aAttribute, - PRInt32 aHint) + nsIContent* aContent, + PRInt32 aNameSpaceID, + nsIAtom* aAttribute, + PRInt32 aHint) { if (mHScrollbarFrame && mVScrollbarFrame) { @@ -709,7 +713,7 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, y = value.ToInteger(&error); } - ScrollbarChanged(x*mOnePixel, y*mOnePixel); + ScrollbarChanged(mOuter->mPresContext, x*mOnePixel, y*mOnePixel); } } @@ -718,11 +722,11 @@ nsGfxScrollFrameInner::AttributeChanged(nsIDocument *aDocument, nsIScrollableView* -nsGfxScrollFrameInner::GetScrollableView() +nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext) { nsIScrollableView* scrollingView; nsIView* view; - mScrollAreaFrame->GetView(&view); + mScrollAreaFrame->GetView(aPresContext, &view); nsresult result = view->QueryInterface(kScrollViewIID, (void**)&scrollingView); NS_ASSERTION(NS_SUCCEEDED(result), "assertion gfx scrollframe does not contain a scrollframe"); return scrollingView; @@ -743,8 +747,9 @@ nsGfxScrollFrameInner::GetScrolledContentSize(nsSize& aSize) nsresult -nsGfxScrollFrameInner::SetFrameSize( nsIFrame* aFrame, - nsSize aSize) +nsGfxScrollFrameInner::SetFrameSize(nsIPresContext* aPresContext, + nsIFrame* aFrame, + nsSize aSize) { // get the margin @@ -764,7 +769,7 @@ nsGfxScrollFrameInner::SetFrameSize( nsIFrame* aFrame, aSize.width -= margin.left + margin.right; aSize.height -= margin.top + margin.bottom; - aFrame->SizeTo(aSize.width, aSize.height); + aFrame->SizeTo(aPresContext, aSize.width, aSize.height); return NS_OK; } @@ -1187,7 +1192,7 @@ nsGfxScrollFrameInner::ReflowFrame( nsIPresContext& aPresContext, // if the frame size change then mark the flag if (oldSize.width != aDesiredSize.width || oldSize.height != aDesiredSize.height) { - aFrame->SizeTo(aDesiredSize.width, aDesiredSize.height); + aFrame->SizeTo(&aPresContext, aDesiredSize.width, aDesiredSize.height); aResized = PR_TRUE; } @@ -1409,7 +1414,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext SetAttribute(mHScrollbarFrame, nsXULAtoms::pageincrement, nscoord(float(scrollAreaSize.width)*0.8)); SetAttribute(mVScrollbarFrame, nsXULAtoms::increment, fontHeight); - nsIScrollableView* scrollable = GetScrollableView(); + nsIScrollableView* scrollable = GetScrollableView(&aPresContext); scrollable->SetLineHeight(fontHeight); SetAttribute(mHScrollbarFrame, nsXULAtoms::increment, 10*mOnePixel); @@ -1418,7 +1423,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext // even if it is different from the old size. This is because ReflowFrame set the child's // frame so we have to make sure our final size is scrollAreaSize - SetFrameSize(mScrollAreaFrame, scrollAreaSize); + SetFrameSize(&aPresContext, mScrollAreaFrame, scrollAreaSize); } } @@ -1443,13 +1448,13 @@ nsGfxScrollFrameInner::LayoutChildren(nsIPresContext& aPresContext, const nsMargin& border = aReflowState.mComputedBorderPadding; // Place scroll area - mScrollAreaFrame->MoveTo(border.left, border.top); + mScrollAreaFrame->MoveTo(&aPresContext, border.left, border.top); // place vertical scrollbar - mVScrollbarFrame->MoveTo(border.left + scrollAreaSize.width, border.top); + mVScrollbarFrame->MoveTo(&aPresContext, border.left + scrollAreaSize.width, border.top); // place horizontal scrollbar - mHScrollbarFrame->MoveTo(border.left, border.top + scrollAreaSize.height); + mHScrollbarFrame->MoveTo(&aPresContext, border.left, border.top + scrollAreaSize.height); // Compute our desired size // ---------- compute width ----------- @@ -1499,9 +1504,9 @@ nsGfxScrollFrameInner::LayoutChildren(nsIPresContext& aPresContext, } void -nsGfxScrollFrameInner::ScrollbarChanged(nscoord aX, nscoord aY) +nsGfxScrollFrameInner::ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY) { - nsIScrollableView* scrollable = GetScrollableView(); + nsIScrollableView* scrollable = GetScrollableView(aPresContext); scrollable->ScrollTo(aX,aY, NS_SCROLL_PROPERTY_ALWAYS_BLIT); // printf("scrolling to: %d, %d\n", aX, aY); } diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.h b/mozilla/layout/html/base/src/nsGfxScrollFrame.h index 0ecdb66cf46..9eda661abd5 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.h +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.h @@ -116,6 +116,7 @@ protected: private: friend class nsGfxScrollFrameInner; nsGfxScrollFrameInner* mInner; + nsIPresContext* mPresContext; // weak reference }; #endif /* nsScrollFrame_h___ */ diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index 35a5dc30ced..70012bcf58f 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -130,7 +130,8 @@ nsHTMLContainerFrame::CreateNextInFlow(nsIPresContext& aPresContext, } static nsresult -ReparentFrameViewTo(nsIFrame* aFrame, +ReparentFrameViewTo(nsIPresContext* aPresContext, + nsIFrame* aFrame, nsIViewManager* aViewManager, nsIView* aNewParentView, nsIView* aOldParentView) @@ -138,7 +139,7 @@ ReparentFrameViewTo(nsIFrame* aFrame, nsIView* view; // Does aFrame have a view? - aFrame->GetView(&view); + aFrame->GetView(aPresContext, &view); if (view) { #ifdef NS_DEBUG // Verify that the current parent view is what we think it is @@ -163,7 +164,7 @@ ReparentFrameViewTo(nsIFrame* aFrame, aFrame->FirstChild(nsnull, &childFrame); while (childFrame) { - ReparentFrameViewTo(childFrame, aViewManager, aNewParentView, aOldParentView); + ReparentFrameViewTo(aPresContext, childFrame, aViewManager, aNewParentView, aOldParentView); childFrame->GetNextSibling(&childFrame); } } @@ -174,13 +175,13 @@ ReparentFrameViewTo(nsIFrame* aFrame, // Helper function that returns the nearest view to this frame. Checks // this frame, its parent frame, its parent frame, ... static nsIView* -GetClosestViewFor(nsIFrame* aFrame) +GetClosestViewFor(nsIPresContext* aPresContext, nsIFrame* aFrame) { NS_PRECONDITION(aFrame, "null frame pointer"); nsIView* view; do { - aFrame->GetView(&view); + aFrame->GetView(aPresContext, &view); if (view) { break; } @@ -192,9 +193,10 @@ GetClosestViewFor(nsIFrame* aFrame) } nsresult -nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, - nsIFrame* aOldParentFrame, - nsIFrame* aNewParentFrame) +nsHTMLContainerFrame::ReparentFrameView(nsIPresContext* aPresContext, + nsIFrame* aChildFrame, + nsIFrame* aOldParentFrame, + nsIFrame* aNewParentFrame) { NS_PRECONDITION(aChildFrame, "null child frame pointer"); NS_PRECONDITION(aOldParentFrame, "null old parent frame pointer"); @@ -207,7 +209,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, // This code is called often and we need it to be as fast as possible, so // see if we can trivially detect that no work needs to be done - aChildFrame->GetView(&childView); + aChildFrame->GetView(aPresContext, &childView); if (!childView) { // Child frame doesn't have a view. See if it has any child frames nsIFrame* firstChild; @@ -218,8 +220,8 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, } // See if either the old parent frame or the new parent frame have a view - aOldParentFrame->GetView(&oldParentView); - aNewParentFrame->GetView(&newParentView); + aOldParentFrame->GetView(aPresContext, &oldParentView); + aNewParentFrame->GetView(aPresContext, &newParentView); if (!oldParentView && !newParentView) { // Walk up both the old parent frame and the new parent frame nodes @@ -243,8 +245,8 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, } // Get the views - aOldParentFrame->GetView(&oldParentView); - aNewParentFrame->GetView(&newParentView); + aOldParentFrame->GetView(aPresContext, &oldParentView); + aNewParentFrame->GetView(aPresContext, &newParentView); } while (!(oldParentView || newParentView)); } @@ -262,10 +264,10 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, // common parent NS_ASSERTION(oldParentView || newParentView, "internal error"); if (!oldParentView) { - oldParentView = GetClosestViewFor(aOldParentFrame); + oldParentView = GetClosestViewFor(aPresContext, aOldParentFrame); } if (!newParentView) { - newParentView = GetClosestViewFor(aNewParentFrame); + newParentView = GetClosestViewFor(aPresContext, aNewParentFrame); } // See if the old parent frame and the new parent frame are in the @@ -276,7 +278,7 @@ nsHTMLContainerFrame::ReparentFrameView(nsIFrame* aChildFrame, oldParentView->GetViewManager(*getter_AddRefs(viewManager)); // They're not so we need to reparent any child views - return ReparentFrameViewTo(aChildFrame, viewManager, newParentView, + return ReparentFrameViewTo(aPresContext, aChildFrame, viewManager, newParentView, oldParentView); } @@ -290,7 +292,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext, PRBool aForce) { nsIView* view; - aFrame->GetView(&view); + aFrame->GetView(&aPresContext, &view); // If we don't yet have a view, see if we need a view if (nsnull == view) { PRInt32 zIndex = 0; @@ -361,11 +363,11 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext, // Create a view nsIFrame* parent; - aFrame->GetParentWithView(&parent); + aFrame->GetParentWithView(&aPresContext, &parent); NS_ASSERTION(parent, "GetParentWithView failed"); nsIView* parentView; - parent->GetView(&parentView); + parent->GetView(&aPresContext, &parentView); NS_ASSERTION(parentView, "no parent with view"); // Create a view @@ -470,7 +472,7 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext, } // Remember our view - aFrame->SetView(view); + aFrame->SetView(&aPresContext, view); NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("nsHTMLContainerFrame::CreateViewForFrame: frame=%p view=%p", diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.h b/mozilla/layout/html/base/src/nsHTMLContainerFrame.h index 0d61d6e3bda..5a939c2c3ca 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.h +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.h @@ -65,9 +65,10 @@ public: nsIStyleContext* aStyleContext, PRBool aForce); - static nsresult ReparentFrameView(nsIFrame* aChildFrame, - nsIFrame* aOldParentFrame, - nsIFrame* aNewParentFrame); + static nsresult ReparentFrameView(nsIPresContext* aPresContext, + nsIFrame* aChildFrame, + nsIFrame* aOldParentFrame, + nsIFrame* aNewParentFrame); protected: virtual PRIntn GetSkipSides() const = 0; diff --git a/mozilla/layout/html/base/src/nsHTMLFrame.cpp b/mozilla/layout/html/base/src/nsHTMLFrame.cpp index 0c1bea45e79..cc21a8e4f5d 100644 --- a/mozilla/layout/html/base/src/nsHTMLFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLFrame.cpp @@ -94,7 +94,7 @@ public: #endif // XXX Temporary hack... - NS_IMETHOD SetRect(const nsRect& aRect); + NS_IMETHOD SetRect(nsIPresContext* aPresContext, const nsRect& aRect); protected: virtual PRIntn GetSkipSides() const; @@ -124,9 +124,9 @@ NS_NewRootFrame(nsIFrame** aNewFrame) // 'min-height', and 'max-height' properties. Then we can do this in a top-down // fashion NS_IMETHODIMP -RootFrame::SetRect(const nsRect& aRect) +RootFrame::SetRect(nsIPresContext* aPresContext, const nsRect& aRect) { - nsresult rv = nsHTMLContainerFrame::SetRect(aRect); + nsresult rv = nsHTMLContainerFrame::SetRect(aPresContext, aRect); // If our height is larger than our natural height (the height we returned // as our desired height), then make sure the document element's frame is @@ -143,7 +143,7 @@ RootFrame::SetRect(const nsRect& aRect) nsSize kidSize; kidFrame->GetSize(kidSize); - kidFrame->SizeTo(kidSize.width, kidSize.height + yDelta); + kidFrame->SizeTo(aPresContext, kidSize.width, kidSize.height + yDelta); } } @@ -226,7 +226,7 @@ RootFrame::RemoveFrame(nsIPresContext& aPresContext, // Damage the area occupied by the deleted frame nsRect damageRect; aOldFrame->GetRect(damageRect); - Invalidate(damageRect, PR_FALSE); + Invalidate(&aPresContext, damageRect, PR_FALSE); // Remove the frame and destroy it mFrames.DestroyFrame(aPresContext, aOldFrame); @@ -386,13 +386,13 @@ RootFrame::Reflow(nsIPresContext& aPresContext, // Position and size the child frame nsRect rect(kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - kidFrame->SetRect(rect); + kidFrame->SetRect(&aPresContext, rect); // If the child frame was just inserted, then we're responsible for making sure // it repaints if (isDirtyChildReflow) { // Damage the area occupied by the deleted frame - Invalidate(rect, PR_FALSE); + Invalidate(&aPresContext, rect, PR_FALSE); } } diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 429135e71bf..14b6960639e 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -646,10 +646,10 @@ nsImageFrame::TranslateEventCoords(nsIPresContext& aPresContext, // to this frame; otherwise we have to adjust the coordinates // appropriately. nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull == view) { nsPoint offset; - GetOffsetFromView(offset, &view); + GetOffsetFromView(&aPresContext, offset, &view); if (nsnull != view) { x -= offset.x; y -= offset.y; @@ -855,7 +855,7 @@ nsImageFrame::AttributeChanged(nsIPresContext* aPresContext, if (loadStatus & NS_IMAGE_LOAD_STATUS_IMAGE_READY) { // Trigger a paint now because image-loader won't if the // image is already loaded and ready to go. - Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_FALSE); + Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height), PR_FALSE); } } else { diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 9fbe213d6f7..10e6cac1c25 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -1357,7 +1357,7 @@ nsInlineFrame::DrainOverflow(nsIPresContext* aPresContext) // change InsertFrames() to do this, but that's a general purpose // function and it doesn't seem like this functionality belongs there... for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); } mFrames.InsertFrames(this, nsnull, prevOverflowFrames); } @@ -1637,7 +1637,7 @@ nsInlineFrame::PullInlineFrame(nsIPresContext* aPresContext, frame = mFrames.PullFrame(this, irs.mPrevFrame, nextInFlow->mFrames); if (nsnull != frame) { isComplete = PR_FALSE; - nsHTMLContainerFrame::ReparentFrameView(frame, nextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, nextInFlow, this); break; } nextInFlow = (nsInlineFrame*) nextInFlow->mNextInFlow; @@ -1657,7 +1657,7 @@ nsInlineFrame::PullAnyFrame(nsIPresContext* aPresContext, while (nsnull != nextInFlow) { frame = mFrames.PullFrame(this, irs.mPrevFrame, nextInFlow->mFrames); if (nsnull != frame) { - nsHTMLContainerFrame::ReparentFrameView(frame, nextInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, frame, nextInFlow, this); break; } diff --git a/mozilla/layout/html/base/src/nsLineBox.cpp b/mozilla/layout/html/base/src/nsLineBox.cpp index 297cb006aa5..9fa9bafb693 100644 --- a/mozilla/layout/html/base/src/nsLineBox.cpp +++ b/mozilla/layout/html/base/src/nsLineBox.cpp @@ -135,7 +135,7 @@ nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const } void -nsLineBox::List(FILE* out, PRInt32 aIndent) const +nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { PRInt32 i; @@ -161,7 +161,7 @@ nsLineBox::List(FILE* out, PRInt32 aIndent) const nsIFrame* frame = mFirstChild; PRInt32 n = GetChildCount(); while (--n >= 0) { - frame->List(out, aIndent + 1); + frame->List(aPresContext, out, aIndent + 1); frame->GetNextSibling(&frame); } diff --git a/mozilla/layout/html/base/src/nsLineBox.h b/mozilla/layout/html/base/src/nsLineBox.h index bae95fef89f..de5f2fbbe59 100644 --- a/mozilla/layout/html/base/src/nsLineBox.h +++ b/mozilla/layout/html/base/src/nsLineBox.h @@ -254,7 +254,7 @@ public: static nsLineBox* FindLineContaining(nsLineBox* aLine, nsIFrame* aFrame, PRInt32* aFrameIndexInLine); - void List(FILE* out, PRInt32 aIndent) const; + void List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; nsIFrame* LastChild() const; diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 68e72b0ea32..2b2d468544e 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -1517,7 +1517,7 @@ nsLineLayout::VerticalAlignFrames(nsRect& aLineBoxResult, pfd->mBounds.y += baselineY; break; } - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, pfd->mFrame); @@ -1563,7 +1563,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, else { pfd->mBounds.y = -aDistanceFromTop + pfd->mMargin.top; } - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, pfd->mFrame); @@ -1584,7 +1584,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd, pfd->mBounds.y = -aDistanceFromTop + aLineHeight - pfd->mMargin.bottom - pfd->mBounds.height; } - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); #ifdef NOISY_VERTICAL_ALIGN printf(" "); nsFrame::ListTag(stdout, pfd->mFrame); @@ -1967,7 +1967,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) #endif } if (psd != mRootSpan) { - frame->SetRect(pfd->mBounds); + frame->SetRect(&mPresContext, pfd->mBounds); } } pfd = pfd->mNext; @@ -2078,7 +2078,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, nsIFrame* f = pfd->mFrame; f->GetRect(r); r.width -= deltaWidth; - f->SetRect(r); + f->SetRect(&mPresContext, r); } // Adjust the right edge of the span that contains the child span @@ -2130,7 +2130,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd, if (psd != mRootSpan) { // The frame was already placed during psd's // reflow. Update the frames rectangle now. - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); } // Adjust containing span's right edge @@ -2227,7 +2227,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, PRBool aAllowJustify) PerFrameData* pfd = psd->mFirstFrame; while (nsnull != pfd) { pfd->mBounds.x += dx; - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); pfd = pfd->mNext; } aLineBounds.width += dx; @@ -2242,7 +2242,7 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds, PRBool aAllowJustify) PRUint32 maxX = psd->mRightEdge; while (nsnull != pfd) { pfd->mBounds.x = maxX - pfd->mBounds.width; - pfd->mFrame->SetRect(pfd->mBounds); + pfd->mFrame->SetRect(&mPresContext, pfd->mBounds); maxX = pfd->mBounds.x; pfd = pfd->mNext; } @@ -2297,7 +2297,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea) // XXX what about right and bottom? nscoord dx = pfd->mOffsets.left; nscoord dy = pfd->mOffsets.top; - frame->MoveTo(origin.x + dx, origin.y + dy); + frame->MoveTo(&mPresContext, origin.x + dx, origin.y + dy); x += dx; y += dy; } diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index f3229d42f3e..a8da72c75c4 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -206,7 +206,10 @@ public: nsIContent* aChild, nsISupports* aSubContent); //local methods - nsresult CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly); + nsresult CreateWidget(nsIPresContext* aPresContext, + nscoord aWidth, + nscoord aHeight, + PRBool aViewOnly); nsresult GetFullURL(nsIURI*& aFullURL); nsresult GetPluginInstance(nsIPluginInstance*& aPluginInstance); @@ -406,7 +409,10 @@ nsObjectFrame::GetFrameName(nsString& aResult) const } nsresult -nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly) +nsObjectFrame::CreateWidget(nsIPresContext* aPresContext, + nscoord aWidth, + nscoord aHeight, + PRBool aViewOnly) { nsIView* view; @@ -425,8 +431,8 @@ nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly) nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(aPresContext, &parWithView); + parWithView->GetView(aPresContext, &parView); if (NS_OK == parView->GetViewManager(viewMan)) { @@ -474,12 +480,12 @@ nsObjectFrame::CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly) nsIView* parentWithView; nsPoint origin; view->SetVisibility(nsViewVisibility_kShow); - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(aPresContext, origin, &parentWithView); viewMan->ResizeView(view, mRect.width, mRect.height); viewMan->MoveViewTo(view, origin.x, origin.y); } - SetView(view); + SetView(aPresContext, view); exit: NS_IF_RELEASE(viewMan); @@ -953,7 +959,7 @@ nsObjectFrame::InstantiateWidget(nsIPresContext& aPresContext, GetDesiredSize(&aPresContext, aReflowState, aMetrics); nsIView *parentWithView; nsPoint origin; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); // Just make the frigging widget float t2p; @@ -1004,7 +1010,7 @@ nsObjectFrame::InstantiatePlugin(nsIPresContext& aPresContext, mInstanceOwner->GetWindow(window); - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); window->x = NSTwipsToIntPixels(origin.x, t2p); window->y = NSTwipsToIntPixels(origin.y, t2p); window->width = NSTwipsToIntPixels(aMetrics.width, t2p); @@ -1044,7 +1050,7 @@ nsObjectFrame::ReinstantiatePlugin(nsIPresContext& aPresContext, nsHTMLReflowMet mInstanceOwner->GetWindow(window); - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); window->x = NSTwipsToIntPixels(origin.x, t2p); window->y = NSTwipsToIntPixels(origin.y, t2p); window->width = NSTwipsToIntPixels(aMetrics.width, t2p); @@ -1122,7 +1128,7 @@ nsObjectFrame::HandleImage(nsIPresContext& aPresContext, ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState, status); nsRect rect(0, 0, kidDesiredSize.width, kidDesiredSize.height); - child->SetRect(rect); + child->SetRect(&aPresContext, rect); aMetrics.width = kidDesiredSize.width; aMetrics.height = kidDesiredSize.height; @@ -1187,7 +1193,7 @@ nsObjectFrame::DidReflow(nsIPresContext& aPresContext, // positioned then we show it. if (NS_FRAME_REFLOW_FINISHED == aStatus) { nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull != view) { view->SetVisibility(nsViewVisibility_kShow); } @@ -1203,7 +1209,7 @@ nsObjectFrame::DidReflow(nsIPresContext& aPresContext, aPresContext.GetTwipsToPixels(&t2p); nscoord offx, offy; - GetOffsetFromView(origin, &parentWithView); + GetOffsetFromView(&aPresContext, origin, &parentWithView); #if 0 // beard: how do we get this? @@ -1759,7 +1765,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, const char *aTarge if ((nsnull != mOwner) && (nsnull != mContext)) { - rv = mOwner->GetOffsetFromView(origin, &view); + rv = mOwner->GetOffsetFromView(mContext, origin, &view); if (NS_OK == rv) { @@ -2433,7 +2439,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) { // Create view if necessary - mOwner->GetView(&view); + mOwner->GetView(mContext, &view); if (nsnull == view) { @@ -2441,12 +2447,13 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) mInstance->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless); - rv = mOwner->CreateWidget(mPluginWindow.width, + rv = mOwner->CreateWidget(mContext, + mPluginWindow.width, mPluginWindow.height, windowless); if (NS_OK == rv) { - mOwner->GetView(&view); + mOwner->GetView(mContext, &view); view->GetWidget(mWidget); if (PR_TRUE == windowless) diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index edf7391efd0..4afafc251d8 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -85,7 +85,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, } nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); - mFrames.FirstChild()->SetRect(rect); + mFrames.FirstChild()->SetRect(&aPresContext, rect); } else { // Do we have any children? @@ -129,7 +129,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext& aPresContext, // Place and size the child nsRect rect(0, 0, aDesiredSize.width, aDesiredSize.height); - frame->SetRect(rect); + frame->SetRect(&aPresContext, rect); // XXX Should we be sending the DidReflow? htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index 8e0b315f4f9..67ac3064f3a 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -95,12 +95,12 @@ nsPlaceholderFrame::GetFrameName(nsString& aResult) const } NS_IMETHODIMP -nsPlaceholderFrame::List(FILE* out, PRInt32 aIndent) const +nsPlaceholderFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.h b/mozilla/layout/html/base/src/nsPlaceholderFrame.h index 5384c965c5c..f8b888a22f6 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.h +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.h @@ -46,7 +46,7 @@ public: nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; /** * Get the "type" of the frame diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index a85f1fa5a52..7d8f825ded5 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -830,7 +830,7 @@ PresShell::RepaintSelection(SelectionType aType) if (!mSelection) return NS_ERROR_NULL_POINTER; - return mSelection->RepaintSelection(aType); + return mSelection->RepaintSelection(mPresContext, aType); } NS_IMETHODIMP @@ -949,7 +949,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) if (NS_OK == rootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(desiredSize.width, desiredSize.height); + rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height)); #ifdef NS_DEBUG @@ -1029,7 +1029,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) if (NS_OK == rootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(desiredSize.width, desiredSize.height); + rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG if (nsIFrame::GetVerifyTreeEnable()) { rootFrame->VerifyTree(); @@ -1209,7 +1209,7 @@ PresShell::StyleChangeReflow() if (NS_OK == rootFrame->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) { htmlReflow->Reflow(*mPresContext, desiredSize, reflowState, status); - rootFrame->SizeTo(desiredSize.width, desiredSize.height); + rootFrame->SizeTo(mPresContext, desiredSize.width, desiredSize.height); #ifdef NS_DEBUG if (nsIFrame::GetVerifyTreeEnable()) { rootFrame->VerifyTree(); @@ -1505,10 +1505,10 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame, nsPoint pt; nsresult rv; - aFrame->GetView(&view); + aFrame->GetView(mPresContext, &view); if (nsnull == view) - aFrame->GetOffsetFromView(pt, &view); + aFrame->GetOffsetFromView(mPresContext, pt, &view); while (nsnull != view) { @@ -1614,7 +1614,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, // Determine the offset from aFrame to the scrolled view. We do that by // getting the offset from its closest view and then walking up scrollingView->GetScrolledView(scrolledView); - aFrame->GetOffsetFromView(offset, &closestView); + aFrame->GetOffsetFromView(mPresContext, offset, &closestView); // XXX Deal with the case where there is a scrolled element, e.g., a // DIV in the middle... @@ -1784,7 +1784,7 @@ PresShell::GetHistoryState(nsILayoutHistoryState** aState) rv = GetRootFrame(&rootFrame); if (NS_FAILED(rv) || nsnull == rootFrame) return rv; - rv = mFrameManager->CaptureFrameState(rootFrame, *aState); + rv = mFrameManager->CaptureFrameState(mPresContext, rootFrame, *aState); return rv; } @@ -1855,7 +1855,7 @@ PresShell::ContentAppended(nsIDocument *aDocument, nsIFrame* frame; rv = GetPrimaryFrameFor(aContainer, &frame); if (NS_SUCCEEDED(rv) && nsnull != frame) - mFrameManager->RestoreFrameState(frame, mHistoryState); + mFrameManager->RestoreFrameState(mPresContext, frame, mHistoryState); } RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: Frame Creation: PresShell::ContentAppended(), this=%p\n", this)); @@ -2149,7 +2149,7 @@ PresShell::HandleEvent(nsIView *aView, if (mSelection && aEvent->eventStructType == NS_KEY_EVENT) {//KEY HANDLERS WILL GET RID OF THIS - if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(aEvent))) + if (mDisplayNonTextSelection && NS_SUCCEEDED(mSelection->HandleKeyEvent(mPresContext, aEvent))) { return NS_OK; } @@ -2176,10 +2176,10 @@ PresShell::HandleEvent(nsIView *aView, manager->GetFocusedContent(&focusContent); if (focusContent) GetPrimaryFrameFor(focusContent, &mCurrentEventFrame); - else frame->GetFrameForPoint(aEvent->point, &mCurrentEventFrame); + else frame->GetFrameForPoint(mPresContext, aEvent->point, &mCurrentEventFrame); } else { - frame->GetFrameForPoint(aEvent->point, &mCurrentEventFrame); + frame->GetFrameForPoint(mPresContext, aEvent->point, &mCurrentEventFrame); } NS_IF_RELEASE(mCurrentEventContent); if (GetCurrentEventFrame() || focusContent) { @@ -2316,7 +2316,7 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg, } static PRBool -CompareTrees(nsIFrame* aA, nsIFrame* aB) +CompareTrees(nsIPresContext* aPresContext, nsIFrame* aA, nsIFrame* aB) { PRBool ok = PR_TRUE; nsIAtom* listName = nsnull; @@ -2359,8 +2359,8 @@ CompareTrees(nsIFrame* aA, nsIFrame* aB) // do have views, make sure the views are the same size. If the // views have widgets, make sure they both do or neither does. If // they do, make sure the widgets are the same size. - k1->GetView(&v1); - k2->GetView(&v2); + k1->GetView(aPresContext, &v1); + k2->GetView(aPresContext, &v2); if (((nsnull == v1) && (nsnull != v2)) || ((nsnull != v1) && (nsnull == v2))) { ok = PR_FALSE; @@ -2393,7 +2393,7 @@ CompareTrees(nsIFrame* aA, nsIFrame* aB) } // Compare the sub-trees too - if (!CompareTrees(k1, k2)) { + if (!CompareTrees(aPresContext, k1, k2)) { ok = PR_FALSE; if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) { break; @@ -2640,12 +2640,12 @@ PresShell::VerifyIncrementalReflow() root1 = FindTopFrame(root1); root2 = FindTopFrame(root2); #endif - PRBool ok = CompareTrees(root1, root2); + PRBool ok = CompareTrees(mPresContext, root1, root2); if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) { printf("Verify reflow failed, primary tree:\n"); - root1->List(stdout, 0); + root1->List(mPresContext, stdout, 0); printf("Verification tree:\n"); - root2->List(stdout, 0); + root2->List(mPresContext, stdout, 0); } // printf("Incremental reflow doomed view tree:\n"); diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index 94834fe7741..d72266e016d 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -104,7 +104,7 @@ nsScrollFrame::SetInitialChildList(nsIPresContext& aPresContext, #ifdef NS_DEBUG // Verify that the scrolled frame has a view nsIView* scrolledView; - frame->GetView(&scrolledView); + frame->GetView(&aPresContext, &scrolledView); NS_ASSERTION(nsnull != scrolledView, "no view"); #endif @@ -173,7 +173,7 @@ nsScrollFrame::DidReflow(nsIPresContext& aPresContext, nsIView* scrolledView; frame->GetSize(size); - frame->GetView(&scrolledView); + frame->GetView(&aPresContext, &scrolledView); scrolledView->GetViewManager(vm); vm->ResizeView(scrolledView, size.width, size.height); NS_RELEASE(vm); @@ -181,7 +181,7 @@ nsScrollFrame::DidReflow(nsIPresContext& aPresContext, // Have the scrolling view layout nsIScrollableView* scrollingView; nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (NS_SUCCEEDED(view->QueryInterface(kScrollViewIID, (void**)&scrollingView))) { scrollingView->ComputeScrollOffsets(PR_TRUE); } @@ -203,9 +203,11 @@ nsScrollFrame::CreateScrollingViewWidget(nsIView* aView, const nsStylePosition* } nsresult -nsScrollFrame::GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView) +nsScrollFrame::GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView) { - nsresult rv = aParent->GetView(aParentView); + nsresult rv = aParent->GetView(aPresContext, aParentView); NS_ASSERTION(aParentView, "GetParentWithView failed"); return(rv); } @@ -217,12 +219,12 @@ nsScrollFrame::CreateScrollingView(nsIPresContext& aPresContext) //Get parent frame nsIFrame* parent; - GetParentWithView(&parent); + GetParentWithView(&aPresContext, &parent); NS_ASSERTION(parent, "GetParentWithView failed"); // Get parent view nsIView* parentView = nsnull; - GetScrollingParentView(parent, &parentView); + GetScrollingParentView(&aPresContext, parent, &parentView); // Get the view manager nsIViewManager* viewManager; @@ -319,7 +321,7 @@ nsScrollFrame::CreateScrollingView(nsIPresContext& aPresContext) scrollingView->SetControlInsets(border); // Remember our view - SetView(view); + SetView(&aPresContext, view); } NS_RELEASE(viewManager); @@ -412,7 +414,7 @@ nsScrollFrame::CalculateScrollAreaSize(nsIPresContext& aPresContext, // but also nsIScrollableView* scrollingView; nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (NS_SUCCEEDED(view->QueryInterface(kScrollViewIID, (void**)&scrollingView))) { PRBool unused; scrollingView->GetScrollbarVisibility(aRoomForVerticalScrollbar, &unused); @@ -557,7 +559,7 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, // nsIView *view = 0; - GetView(&view); + GetView(&aPresContext, &view); if (view) { nsresult rv = NS_OK; @@ -697,7 +699,7 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext, nscoord x = border.left; nscoord y = border.top; nsRect rect(x, y, kidDesiredSize.width, kidDesiredSize.height); - kidFrame->SetRect(rect); + kidFrame->SetRect(&aPresContext, rect); // Compute our desired size aDesiredSize.width = scrollAreaSize.width; diff --git a/mozilla/layout/html/base/src/nsScrollFrame.h b/mozilla/layout/html/base/src/nsScrollFrame.h index cf7c6fb5d40..b677f455b2b 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.h +++ b/mozilla/layout/html/base/src/nsScrollFrame.h @@ -98,7 +98,9 @@ protected: // that sub-classes may control widget creation. virtual nsresult CreateScrollingViewWidget(nsIView* aView,const nsStylePosition* aPosition); // Getting the view for scollframe may be overriden to provide a parent view for te scroll frame - virtual nsresult GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView); + virtual nsresult GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView); private: nsresult CreateScrollingView(nsIPresContext& aPresContext); diff --git a/mozilla/layout/html/base/src/nsScrollPortFrame.cpp b/mozilla/layout/html/base/src/nsScrollPortFrame.cpp index 69fbece304b..59d0d784e9e 100644 --- a/mozilla/layout/html/base/src/nsScrollPortFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollPortFrame.cpp @@ -114,7 +114,7 @@ nsScrollPortFrame::SetInitialChildList(nsIPresContext& aPresContext, #ifdef NS_DEBUG // Verify that the scrolled frame has a view nsIView* scrolledView; - frame->GetView(&scrolledView); + frame->GetView(&aPresContext, &scrolledView); NS_ASSERTION(nsnull != scrolledView, "no view"); #endif @@ -184,7 +184,7 @@ nsScrollPortFrame::DidReflow(nsIPresContext& aPresContext, nsIView* scrolledView; frame->GetSize(size); - frame->GetView(&scrolledView); + frame->GetView(&aPresContext, &scrolledView); scrolledView->GetBounds(bounds); // only resize the view if things changed. @@ -197,7 +197,7 @@ nsScrollPortFrame::DidReflow(nsIPresContext& aPresContext, // Have the scrolling view layout nsIScrollableView* scrollingView; nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (NS_SUCCEEDED(view->QueryInterface(kScrollViewIID, (void**)&scrollingView))) { scrollingView->ComputeScrollOffsets(PR_TRUE); } @@ -221,9 +221,11 @@ nsScrollPortFrame::CreateScrollingViewWidget(nsIView* aView, const nsStylePositi } nsresult -nsScrollPortFrame::GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView) +nsScrollPortFrame::GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView) { - nsresult rv = aParent->GetView(aParentView); + nsresult rv = aParent->GetView(aPresContext, aParentView); NS_ASSERTION(aParentView, "GetParentWithView failed"); return(rv); } @@ -235,12 +237,12 @@ nsScrollPortFrame::CreateScrollingView(nsIPresContext& aPresContext) //Get parent frame nsIFrame* parent; - GetParentWithView(&parent); + GetParentWithView(&aPresContext, &parent); NS_ASSERTION(parent, "GetParentWithView failed"); // Get parent view nsIView* parentView = nsnull; - GetScrollingParentView(parent, &parentView); + GetScrollingParentView(&aPresContext, parent, &parentView); // Get the view manager nsIViewManager* viewManager; @@ -310,7 +312,7 @@ nsScrollPortFrame::CreateScrollingView(nsIPresContext& aPresContext) scrollingView->SetControlInsets(border); // Remember our view - SetView(view); + SetView(&aPresContext, view); } NS_RELEASE(viewManager); @@ -468,7 +470,7 @@ nsScrollPortFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.height += border.top + border.bottom; nsRect rect(x, y, kidDesiredSize.width, kidDesiredSize.height); - kidFrame->SetRect(rect); + kidFrame->SetRect(&aPresContext, rect); //printf("width=%d, height=%d\n", kidDesiredSize.width, kidDesiredSize.height); diff --git a/mozilla/layout/html/base/src/nsScrollPortFrame.h b/mozilla/layout/html/base/src/nsScrollPortFrame.h index 347b1f5efd3..6f3364a33c6 100644 --- a/mozilla/layout/html/base/src/nsScrollPortFrame.h +++ b/mozilla/layout/html/base/src/nsScrollPortFrame.h @@ -103,7 +103,9 @@ protected: // that sub-classes may control widget creation. virtual nsresult CreateScrollingViewWidget(nsIView* aView,const nsStylePosition* aPosition); // Getting the view for scollframe may be overriden to provide a parent view for te scroll frame - virtual nsresult GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView); + virtual nsresult GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView); private: nsresult CreateScrollingView(nsIPresContext& aPresContext); diff --git a/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp b/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp index 8e17b7536f6..00f42b51a61 100644 --- a/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp +++ b/mozilla/layout/html/base/src/nsSelectsAreaFrame.cpp @@ -86,9 +86,11 @@ nsSelectsAreaFrame::IsOptionElementFrame(nsIFrame *aFrame) //--------------------------------------------------------- NS_IMETHODIMP -nsSelectsAreaFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsSelectsAreaFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsAreaFrame::GetFrameForPoint(aPoint, aFrame); + nsAreaFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); nsIFrame* selectedFrame = *aFrame; diff --git a/mozilla/layout/html/base/src/nsSelectsAreaFrame.h b/mozilla/layout/html/base/src/nsSelectsAreaFrame.h index 22547370761..311a3de06a8 100644 --- a/mozilla/layout/html/base/src/nsSelectsAreaFrame.h +++ b/mozilla/layout/html/base/src/nsSelectsAreaFrame.h @@ -35,7 +35,7 @@ public: // nsISupports //NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); protected: PRBool IsOptionElement(nsIContent* aContent); diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index ea0d83386c9..a97518238b3 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -127,7 +127,7 @@ nsSimplePageSequenceFrame::IncrementalReflow(nsIPresContext& aPresConte // Place and size the page. If the page is narrower than our max width, then // center it horizontally nsRect rect(aX, aY, kidSize.width, kidSize.height); - nextFrame->SetRect(rect); + nextFrame->SetRect(&aPresContext, rect); aY += kidSize.height + PAGE_SPACING_TWIPS; // Check if the page is complete... @@ -166,7 +166,7 @@ nsSimplePageSequenceFrame::IncrementalReflow(nsIPresContext& aPresConte // max width then center it horizontally ReflowChild(kidFrame, aPresContext, childSize, childReflowState, status); - kidFrame->SetRect(nsRect(aX, aY, childSize.width, childSize.height)); + kidFrame->SetRect(&aPresContext, nsRect(aX, aY, childSize.width, childSize.height)); aY += childSize.height; // Leave a slight gap between the pages @@ -239,7 +239,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext& aPresContext, // Place and size the page. If the page is narrower than our // max width then center it horizontally ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, status); - kidFrame->SetRect(nsRect(x, y, kidSize.width, kidSize.height)); + kidFrame->SetRect(&aPresContext, nsRect(x, y, kidSize.width, kidSize.height)); y += kidSize.height; // Leave a slight gap between the pages @@ -419,7 +419,7 @@ nsSimplePageSequenceFrame::Print(nsIPresContext& aPresContext, // Print the page nsIView* view; - page->GetView(&view); + page->GetView(&aPresContext, &view); NS_ASSERTION(nsnull != view, "no page view"); vm->Display(view); diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index e5e7f056bc8..f3d8974d4be 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -144,7 +144,7 @@ public: NS_DECL_ISUPPORTS - void AddFrame(nsIFrame* aFrame); + void AddFrame(nsIPresContext* aPresContext, nsIFrame* aFrame); PRBool RemoveFrame(nsIFrame* aFrame); @@ -156,8 +156,19 @@ public: virtual void Notify(nsITimer *timer); + struct FrameData { + nsIPresContext* mPresContext; // pres context associated with the frame + nsIFrame* mFrame; + + + FrameData(nsIPresContext* aPresContext, + nsIFrame* aFrame) + : mPresContext(aPresContext), mFrame(aFrame) {} + }; + nsITimer* mTimer; nsVoidArray mFrames; + nsIPresContext* mPresContext; }; static PRBool gBlinkTextOff; @@ -196,15 +207,27 @@ void nsBlinkTimer::Stop() static NS_DEFINE_IID(kITimerCallbackIID, NS_ITIMERCALLBACK_IID); NS_IMPL_ISUPPORTS(nsBlinkTimer, kITimerCallbackIID); -void nsBlinkTimer::AddFrame(nsIFrame* aFrame) { - mFrames.AppendElement(aFrame); +void nsBlinkTimer::AddFrame(nsIPresContext* aPresContext, nsIFrame* aFrame) { + FrameData* frameData = new FrameData(aPresContext, aFrame); + mFrames.AppendElement(frameData); if (1 == mFrames.Count()) { Start(); } } PRBool nsBlinkTimer::RemoveFrame(nsIFrame* aFrame) { - PRBool rv = mFrames.RemoveElement(aFrame); + PRInt32 i, n = mFrames.Count(); + PRBool rv = PR_FALSE; + for (i = 0; i < n; i++) { + FrameData* frameData = (FrameData*) mFrames.ElementAt(i); + + if (frameData->mFrame == aFrame) { + rv = mFrames.RemoveElementAt(i); + delete frameData; + break; + } + } + if (0 == mFrames.Count()) { Stop(); } @@ -239,14 +262,14 @@ void nsBlinkTimer::Notify(nsITimer *timer) PRInt32 i, n = mFrames.Count(); for (i = 0; i < n; i++) { - nsIFrame* text = (nsIFrame*) mFrames.ElementAt(i); + FrameData* frameData = (FrameData*) mFrames.ElementAt(i); // Determine damaged area and tell view manager to redraw it nsPoint offset; nsRect bounds; - text->GetRect(bounds); + frameData->mFrame->GetRect(bounds); nsIView* view; - text->GetOffsetFromView(offset, &view); + frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view); nsIViewManager* vm; view->GetViewManager(vm); bounds.x = offset.x; @@ -290,7 +313,7 @@ public: return NS_OK; } - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; /** * Get the "type" of the frame @@ -325,9 +348,12 @@ public: PRInt32& aOffset); - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread); - NS_IMETHOD PeekOffset(nsPeekOffsetStruct *aPos); + NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos); NS_IMETHOD HandleMultiplePress(nsIPresContext& aPresContext, nsGUIEvent * aEvent, @@ -1281,8 +1307,8 @@ nsTextFrame::GetPositionSlowly(nsIPresContext& aPresContext, } nsIView * view; nsPoint origin; - GetView(&view); - GetOffsetFromView(origin, &view); + GetView(&aPresContext, &view); + GetOffsetFromView(&aPresContext, origin, &view); if (aXCoord - origin.x <0) { @@ -1912,7 +1938,7 @@ nsTextFrame::GetPosition(nsIPresContext& aCX, PRUnichar* text = paintBuffer.mBuffer; nsPoint origin; nsIView * view; - GetOffsetFromView(origin, &view); + GetOffsetFromView(&aCX, origin, &view); PRBool found = BinarySearchForPosition(acx, text, origin.x, 0, 0, PRInt32(textLength), PRInt32(aXCoord) , //go to local coordinates @@ -1970,7 +1996,10 @@ void ForceDrawFrame(nsFrame * aFrame); //null range means the whole thing NS_IMETHODIMP -nsTextFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) +nsTextFrame::SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread) { nsresult result; if (aSelected && ParentDisablesSelection()) @@ -2046,7 +2075,7 @@ nsTextFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) nsRect frameRect; GetRect(frameRect); nsRect rect(0, 0, frameRect.width, frameRect.height); - Invalidate(rect, PR_FALSE); + Invalidate(aPresContext, rect, PR_FALSE); // ForceDrawFrame(this); } if (aSpread == eSpreadDown) @@ -2054,14 +2083,14 @@ nsTextFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) nsIFrame *frame; GetPrevInFlow(&frame); while(frame){ - frame->SetSelected(aRange,aSelected,eSpreadNone); + frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); result = frame->GetPrevInFlow(&frame); if (NS_FAILED(result)) break; } GetNextInFlow(&frame); while (frame){ - frame->SetSelected(aRange,aSelected,eSpreadNone); + frame->SetSelected(aPresContext, aRange,aSelected,eSpreadNone); result = frame->GetNextInFlow(&frame); if (NS_FAILED(result)) break; @@ -2181,7 +2210,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset, NS_IMETHODIMP -nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) +nsTextFrame::PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) { if (!aPos || !mContent) @@ -2198,13 +2227,13 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) NS_ASSERTION(PR_FALSE,"nsTextFrame::PeekOffset no more flow \n"); return NS_ERROR_INVALID_ARG; } - return nextInFlow->PeekOffset(aPos); + return nextInFlow->PeekOffset(aPresContext, aPos); } if (aPos->mAmount == eSelectLine || aPos->mAmount == eSelectBeginLine || aPos->mAmount == eSelectEndLine) { - return nsFrame::PeekOffset(aPos); + return nsFrame::PeekOffset(aPresContext, aPos); } nsAutoTextBuffer paintBuffer; @@ -2242,7 +2271,7 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) else { aPos->mAmount = eSelectDir;//go to "next" or previous frame based on direction not THIS frame - return nsFrame::PeekOffset(aPos);//no matter what this is not a valid frame to end up on + return nsFrame::PeekOffset(aPresContext, aPos);//no matter what this is not a valid frame to end up on } } break; @@ -2305,7 +2334,7 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) { result = GetFrameFromDirection(aPos); if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this) - result = aPos->mResultFrame->PeekOffset(aPos); + result = aPos->mResultFrame->PeekOffset(aPresContext, aPos); } else aPos->mResultContent = mContent; @@ -2425,7 +2454,7 @@ nsTextFrame::PeekOffset(nsPeekOffsetStruct *aPos) result = GetFrameFromDirection(aPos); if (NS_SUCCEEDED(result) && aPos->mResultFrame && aPos->mResultFrame!= this) { - if (NS_SUCCEEDED(result = aPos->mResultFrame->PeekOffset(aPos))) + if (NS_SUCCEEDED(result = aPos->mResultFrame->PeekOffset(aPresContext, aPos))) return NS_OK;//else fall through } else @@ -2569,7 +2598,7 @@ nsTextFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_TRUE, PR_FALSE); - rv = PeekOffset(&startpos); + rv = PeekOffset(&aPresContext, &startpos); if (NS_FAILED(rv)) return rv; nsPeekOffsetStruct endpos; @@ -2581,7 +2610,7 @@ nsTextFrame::HandleMultiplePress(nsIPresContext& aPresContext, PR_FALSE, PR_FALSE, PR_FALSE); - rv = PeekOffset(&endpos); + rv = PeekOffset(&aPresContext, &endpos); if (NS_FAILED(rv)) return rv; @@ -2673,7 +2702,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, if (ts.mFont->mFont.decorations & NS_STYLE_TEXT_DECORATION_BLINK) { if (0 == (mState & TEXT_BLINK_ON)) { mState |= TEXT_BLINK_ON; - gTextBlinker->AddFrame(this); + gTextBlinker->AddFrame(&aPresContext, this); } } else { @@ -3049,7 +3078,7 @@ nsTextFrame::Reflow(nsIPresContext& aPresContext, // XXX We need a finer granularity than this, but it isn't clear what // has actually changed... if (eReflowReason_Incremental == aReflowState.reason) { - Invalidate(mRect); + Invalidate(&aPresContext, mRect); } nsReflowStatus rs = (offset == contentLength) @@ -3372,13 +3401,13 @@ nsTextFrame::GetFrameName(nsString& aResult) const } NS_IMETHODIMP -nsTextFrame::List(FILE* out, PRInt32 aIndent) const +nsTextFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { // Output the tag IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index a80208b820e..4b981bedc44 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -292,7 +292,7 @@ ViewportFrame::CalculateFixedContainingBlockSize(nsIPresContext& aPresC nsIFrame* kidFrame = mFrames.FirstChild(); nsIView* kidView; - kidFrame->GetView(&kidView); + kidFrame->GetView(&aPresContext, &kidView); if (nsnull != kidView) { nsIScrollableView* scrollingView; @@ -359,7 +359,7 @@ ViewportFrame::ReflowFixedFrame(nsIPresContext& aPresContext, nsRect rect(kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left, kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top, kidDesiredSize.width, kidDesiredSize.height); - aKidFrame->SetRect(rect); + aKidFrame->SetRect(&aPresContext, rect); htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); } @@ -514,7 +514,7 @@ ViewportFrame::Reflow(nsIPresContext& aPresContext, aStatus); nsRect rect(0, 0, kidDesiredSize.width, kidDesiredSize.height); - kidFrame->SetRect(rect); + kidFrame->SetRect(&aPresContext, rect); kidRect = rect; // XXX We should resolve the details of who/when DidReflow() @@ -554,7 +554,7 @@ ViewportFrame::Reflow(nsIPresContext& aPresContext, if ((eReflowReason_Initial == aReflowState.reason) || (eReflowReason_Resize == aReflowState.reason)) { nsRect damageRect(0, 0, aDesiredSize.width, aDesiredSize.height); - Invalidate(damageRect, PR_FALSE); + Invalidate(&aPresContext, damageRect, PR_FALSE); } NS_FRAME_TRACE_REFLOW_OUT("ViewportFrame::Reflow", aStatus); diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index a56bdc117fb..b0dccec25e3 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -1608,6 +1608,29 @@ nsGenericHTMLElement::GetPrimaryFrame(nsIHTMLContent* aContent, return res; } + +// XXX This creates a dependency between content and frames +nsresult +nsGenericHTMLElement::GetPresContext(nsIHTMLContent* aContent, + nsIPresContext** aPresContext) +{ + nsIDocument* doc = nsnull; + nsresult res = NS_NOINTERFACE; + // Get the document + if (NS_OK == aContent->GetDocument(doc)) { + if (nsnull != doc) { + // Get presentation shell 0 + nsIPresShell* presShell = doc->GetShellAt(0); + if (nsnull != presShell) { + res = presShell->GetPresContext(aPresContext); + NS_RELEASE(presShell); + } + NS_RELEASE(doc); + } + } + + return res; +} // XXX check all mappings against ebina's usage static nsGenericHTMLElement::EnumTable kAlignTable[] = { diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.h b/mozilla/layout/html/content/src/nsGenericHTMLElement.h index c8eb19e7962..0bbd6b2954c 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.h @@ -277,9 +277,10 @@ public: static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute, PRInt32& aHint); - //XXX This creates a dependency between content and frames + //XXX These two creates a dependency between content and frames static nsresult GetPrimaryFrame(nsIHTMLContent* aContent, nsIFormControlFrame *&aFormControlFrame); + static nsresult GetPresContext(nsIHTMLContent* aContent, nsIPresContext** aPresContext); static nsresult GetBaseURL(const nsHTMLValue& aBaseHref, nsIDocument* aDocument, diff --git a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp index ab27e876903..f5b52c4d181 100644 --- a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp @@ -341,7 +341,10 @@ nsHTMLFormElement::Reset() nsIFormManager* formMan = nsnull; res = frame->QueryInterface(kIFormManagerIID, (void**)&formMan); if (NS_SUCCEEDED(res) && formMan) { - res = formMan->OnReset(); + nsCOMPtr presContext; + shell->GetPresContext(getter_AddRefs(presContext)); + + res = formMan->OnReset(presContext); } } NS_RELEASE(shell); diff --git a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp index a077b96975c..c96706d4b79 100644 --- a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp @@ -358,7 +358,10 @@ nsHTMLInputElement::SetValue(const nsString& aValue) nsIFormControlFrame* formControlFrame = nsnull; if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::value, aValue); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue); + NS_IF_RELEASE(presContext); } return NS_OK; } @@ -396,7 +399,10 @@ nsHTMLInputElement::SetAutocomplete(const nsString& aAutocomplete) nsIFormControlFrame* formControlFrame = nsnull; if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::autocomplete, aAutocomplete); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::autocomplete, aAutocomplete); + NS_IF_RELEASE(presContext); } } } @@ -426,12 +432,15 @@ nsHTMLInputElement::SetChecked(PRBool aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); if (PR_TRUE == aValue) { - formControlFrame->SetProperty(nsHTMLAtoms::checked, "1"); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, "1"); } else { - formControlFrame->SetProperty(nsHTMLAtoms::checked, "0"); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, "0"); } + NS_IF_RELEASE(presContext); } return NS_OK; } @@ -518,7 +527,10 @@ nsHTMLInputElement::Select() nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame); if (NS_SUCCEEDED(rv)) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::select, ""); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); + NS_IF_RELEASE(presContext); return NS_OK; } } diff --git a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp index 478f5747255..cc2fd21caa8 100644 --- a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp @@ -485,7 +485,10 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aValue) if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { nsString value; value.Append(aValue, 10); - formControlFrame->SetProperty(nsHTMLAtoms::selectedindex, value); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value); + NS_IF_RELEASE(presContext); } return NS_OK; } @@ -654,7 +657,10 @@ nsHTMLSelectElement::AddOption(nsIContent* aContent) nsISelectControlFrame* selectFrame = nsnull; result = fcFrame->QueryInterface(nsISelectControlFrame::GetIID(),(void **) &selectFrame); if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) { - result = selectFrame->AddOption(mOptions->IndexOf(aContent)); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + result = selectFrame->AddOption(presContext, mOptions->IndexOf(aContent)); + NS_IF_RELEASE(presContext); } } @@ -683,7 +689,10 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent) // We can't get our index if we've already been replaced in the OptionList. // If we couldn't get our index, pass -1, remove all options and recreate // Coincidentally, IndexOf returns -1 if the option isn't found in the list - result = selectFrame->RemoveOption(oldIndex); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + result = selectFrame->RemoveOption(presContext, oldIndex); + NS_IF_RELEASE(presContext); } } diff --git a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp index 446b58e700c..783fb2b552e 100644 --- a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -291,7 +291,10 @@ nsHTMLTextAreaElement::Select() nsresult rv = nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame); if (NS_SUCCEEDED(rv)) { if (nsnull != formControlFrame ) { - formControlFrame->SetProperty(nsHTMLAtoms::select, ""); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); + NS_IF_RELEASE(presContext); return NS_OK; } } @@ -332,7 +335,10 @@ nsHTMLTextAreaElement::SetValue(const nsString& aValue) { nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { - formControlFrame->SetProperty(nsHTMLAtoms::value, aValue); + nsIPresContext* presContext; + nsGenericHTMLElement::GetPresContext(this, &presContext); + formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue); + NS_IF_RELEASE(presContext); } return NS_OK; } diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 2eadeb20c71..44d69defcdf 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -158,9 +158,6 @@ public: NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); - NS_IMETHOD SizeTo(nscoord aWidth, nscoord aHeight); - NS_IMETHOD GetParentContent(nsIContent*& aContent); PRBool GetURL(nsIContent* aContent, nsString& aResult); PRBool GetName(nsIContent* aContent, nsString& aResult); @@ -361,7 +358,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext& aPresContext, // Place and size the child nsRect rect(offset.x, offset.y, innerSize.width, innerSize.height); - firstChild->SetRect(rect); + firstChild->SetRect(&aPresContext, rect); } // XXX what should the max-element-size of an iframe be? Shouldn't @@ -587,18 +584,6 @@ nsHTMLFrameInnerFrame::GetFrameType(nsIAtom** aType) const return NS_OK; } -NS_METHOD -nsHTMLFrameInnerFrame::MoveTo(nscoord aX, nscoord aY) -{ - return nsLeafFrame::MoveTo(aX, aY); -} - -NS_METHOD -nsHTMLFrameInnerFrame::SizeTo(nscoord aWidth, nscoord aHeight) -{ - return nsLeafFrame::SizeTo(aWidth, aHeight); -} - NS_IMETHODIMP nsHTMLFrameInnerFrame::Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -668,7 +653,7 @@ nsHTMLFrameInnerFrame::DidReflow(nsIPresContext& aPresContext, // positioned then we show it. if (NS_FRAME_REFLOW_FINISHED == aStatus) { nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (view) { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); @@ -811,7 +796,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext, nsIView* parView; nsPoint origin; - GetOffsetFromView(origin, &parView); + GetOffsetFromView(&aPresContext, origin, &parView); nsRect viewBounds(origin.x, origin.y, aSize.width, aSize.height); nsCOMPtr viewMan; @@ -819,7 +804,7 @@ nsHTMLFrameInnerFrame::CreateWebShell(nsIPresContext& aPresContext, rv = view->Init(viewMan, viewBounds, parView); viewMan->InsertChild(parView, view, 0); rv = view->CreateWidget(kCChildCID); - SetView(view); + SetView(&aPresContext, view); // if the visibility is hidden, reflect that in the view const nsStyleDisplay* display; diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index 5931ed9bba0..85e022b83e6 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -108,7 +108,8 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD GetCursor(nsIPresContext& aPresContext, @@ -152,7 +153,7 @@ protected: class nsHTMLFramesetBlankFrame : public nsLeafFrame { public: - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out = stdout, PRInt32 aIndent = 0) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -546,7 +547,7 @@ NS_METHOD nsHTMLFramesetFrame::HandleEvent(nsIPresContext& aPresContext, MouseDrag(aPresContext, aEvent); break; case NS_MOUSE_LEFT_BUTTON_UP: - EndMouseDrag(); + EndMouseDrag(&aPresContext); break; } aEventStatus = nsEventStatus_eConsumeNoDefault; @@ -594,7 +595,8 @@ nsHTMLFramesetFrame::GetCursor(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, +nsHTMLFramesetFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) { //XXX Temporary to deal with event handling in both this and FramsetBorderFrame @@ -602,7 +604,7 @@ nsHTMLFramesetFrame::GetFrameForPoint(const nsPoint& aPoint, *aFrame = this; return NS_OK; } else { - return nsContainerFrame::GetFrameForPoint(aPoint, aFrame); + return nsContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); } } @@ -782,7 +784,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, // Place and size the child nsRect rect(aOffset.x, aOffset.y, aSize.width, aSize.height); - aChild->SetRect(rect); + aChild->SetRect(&aPresContext, rect); htmlReflow->DidReflow(aPresContext, NS_FRAME_REFLOW_FINISHED); // this call is needed } } @@ -923,12 +925,12 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(&aPresContext, &parWithView); + parWithView->GetView(&aPresContext, &parView); nsRect boundBox(0, 0, aDesiredSize.width, aDesiredSize.height); result = view->Init(viewMan, boundBox, parView, nsnull); viewMan->InsertChild(parView, view, 0); - SetView(view); + SetView(&aPresContext, view); // parse the rows= cols= data ParseRowCol(nsHTMLAtoms::rows, mNumRows, &mRowSpecs); @@ -1417,7 +1419,7 @@ nsHTMLFramesetFrame::StartMouseDrag(nsIPresContext& aPresContext, NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger"); #endif nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (view) { nsIViewManager* viewMan; view->GetViewManager(viewMan); @@ -1491,10 +1493,10 @@ nsHTMLFramesetFrame::MouseDrag(nsIPresContext& aPresContext, } void -nsHTMLFramesetFrame::EndMouseDrag() +nsHTMLFramesetFrame::EndMouseDrag(nsIPresContext* aPresContext) { nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (view) { nsIViewManager* viewMan; view->GetViewManager(viewMan); @@ -1693,7 +1695,8 @@ nsHTMLFramesetBorderFrame::HandleEvent(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsHTMLFramesetBorderFrame::GetFrameForPoint(const nsPoint& aPoint, +nsHTMLFramesetBorderFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame) { *aFrame = this; @@ -1781,11 +1784,12 @@ nsHTMLFramesetBlankFrame::Paint(nsIPresContext& aPresContext, } -NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(FILE* out, +NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(nsIPresContext* aPresContext, + FILE* out, PRInt32 aIndent) const { for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); // Indent fprintf(out, "%p BLANK \n", this); - return nsLeafFrame::List(out, aIndent); + return nsLeafFrame::List(aPresContext, out, aIndent); } diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.h b/mozilla/layout/html/document/src/nsFrameSetFrame.h index d3c9715779d..41f9cad7057 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.h +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.h @@ -123,7 +123,8 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD GetCursor(nsIPresContext& aPresContext, @@ -149,7 +150,7 @@ public: void MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent); - void EndMouseDrag(); + void EndMouseDrag(nsIPresContext* aPresContext); nsFrameborder GetParentFrameborder() { return mParentFrameborder; } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index ab7f05a93d2..5cc16154139 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -2552,7 +2552,9 @@ HTMLContentSink::ScrollToRef() // coordinates that are relative to that. nsPoint offset; nsIView* view; - frame->GetOffsetFromView(offset, &view); + nsCOMPtr presContext; + shell->GetPresContext(getter_AddRefs(presContext)); + frame->GetOffsetFromView(presContext, offset, &view); nscoord x = 0; nscoord y = offset.y; sview->SetScrollPreference(mOriginalScrollPreference); diff --git a/mozilla/layout/html/forms/public/nsIFormControlFrame.h b/mozilla/layout/html/forms/public/nsIFormControlFrame.h index 30f1ddde829..41f799bc974 100644 --- a/mozilla/layout/html/forms/public/nsIFormControlFrame.h +++ b/mozilla/layout/html/forms/public/nsIFormControlFrame.h @@ -52,7 +52,7 @@ public: virtual void MouseClicked(nsIPresContext* aPresContext) = 0; - virtual void Reset() = 0; + virtual void Reset(nsIPresContext* aPresContext) = 0; virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter) = 0; @@ -118,7 +118,7 @@ public: * @returns NS_OK if the property name is valid, otherwise an error code */ - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue) = 0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) = 0; /** * Get a property from the form control frame diff --git a/mozilla/layout/html/forms/public/nsIFormManager.h b/mozilla/layout/html/forms/public/nsIFormManager.h index 3a33bde8362..0e6a62939c0 100644 --- a/mozilla/layout/html/forms/public/nsIFormManager.h +++ b/mozilla/layout/html/forms/public/nsIFormManager.h @@ -38,7 +38,7 @@ public: * Reset the values of all of this manager's controls back to their * initial values. This is in response to a reset button being pushed. */ - NS_IMETHOD OnReset() = 0; + NS_IMETHOD OnReset(nsIPresContext* aPresContext) = 0; /** * Submit the values of this manager's controls depending on its action, diff --git a/mozilla/layout/html/forms/public/nsIListControlFrame.h b/mozilla/layout/html/forms/public/nsIListControlFrame.h index e9c877d6cd9..a373c539fa6 100644 --- a/mozilla/layout/html/forms/public/nsIListControlFrame.h +++ b/mozilla/layout/html/forms/public/nsIListControlFrame.h @@ -62,7 +62,7 @@ public: * Initiates mouse capture for the listbox * */ - NS_IMETHOD CaptureMouseEvents(PRBool aGrabMouseEvents) = 0; + NS_IMETHOD CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) = 0; /** * Returns the maximum width and height of an item in the listbox @@ -79,7 +79,7 @@ public: /** * */ - NS_IMETHOD SyncViewWithFrame() = 0; + NS_IMETHOD SyncViewWithFrame(nsIPresContext* aPresContext) = 0; /** * diff --git a/mozilla/layout/html/forms/public/nsISelectControlFrame.h b/mozilla/layout/html/forms/public/nsISelectControlFrame.h index 8027a679e95..e9606a1a258 100644 --- a/mozilla/layout/html/forms/public/nsISelectControlFrame.h +++ b/mozilla/layout/html/forms/public/nsISelectControlFrame.h @@ -39,13 +39,13 @@ public: * Adds an option to the list at index */ - NS_IMETHOD AddOption(PRInt32 index) = 0; + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 index) = 0; /** * Removes the option at index */ - NS_IMETHOD RemoveOption(PRInt32 index) = 0; + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 index) = 0; /** * Sets the select state of the option at index diff --git a/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp index 67f18f36e9d..bb0b88420c4 100644 --- a/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsButtonControlFrame.cpp @@ -194,7 +194,7 @@ nsButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) formContent->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); } if (nsEventStatus_eConsumeNoDefault != status) { - mFormFrame->OnReset(); + mFormFrame->OnReset(aPresContext); } break; case NS_FORM_INPUT_SUBMIT: @@ -324,9 +324,9 @@ nsButtonControlFrame::SetFocus(PRBool aOn, PRBool aRepaint) } void -nsButtonControlFrame::Redraw() +nsButtonControlFrame::Redraw(nsIPresContext* aPresContext) { nsRect rect(0, 0, mRect.width, mRect.height); - Invalidate(rect, PR_FALSE); + Invalidate(aPresContext, rect, PR_FALSE); } diff --git a/mozilla/layout/html/forms/src/nsButtonControlFrame.h b/mozilla/layout/html/forms/src/nsButtonControlFrame.h index feaf8189110..035ec92e7cb 100644 --- a/mozilla/layout/html/forms/src/nsButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsButtonControlFrame.h @@ -76,7 +76,7 @@ protected: - virtual void Redraw(); + virtual void Redraw(nsIPresContext* aPresContext); virtual void SetFocus(PRBool aOn, PRBool aRepaint); diff --git a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp index 85f6af666d1..7cc4d3497f7 100644 --- a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp @@ -95,13 +95,13 @@ nsButtonFrameRenderer::isDisabled() } void -nsButtonFrameRenderer::Redraw() +nsButtonFrameRenderer::Redraw(nsIPresContext* aPresContext) { nsRect rect; mFrame->GetRect(rect); rect.x = 0; rect.y = 0; - mFrame->Invalidate(rect, PR_FALSE); + mFrame->Invalidate(aPresContext, rect, PR_FALSE); } void diff --git a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.h b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.h index 401cf0944cf..2aaddbaa9f3 100644 --- a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.h +++ b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.h @@ -87,7 +87,7 @@ public: virtual nsresult SetStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); virtual void ReResolveStyles(nsIPresContext& aPresContext); - virtual void Redraw(); + virtual void Redraw(nsIPresContext* aPresContext); virtual nsIFrame* GetFrame(); virtual PRInt32 GetNameSpace(); diff --git a/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp index c0c441a2ff9..8ff571614d6 100644 --- a/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsCheckboxControlFrame.cpp @@ -144,7 +144,7 @@ nsCheckboxControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nscoord& PRBool checked = PR_FALSE; nsresult result = GetDefaultCheckState(&checked); if (NS_CONTENT_ATTR_HAS_VALUE == result) - SetCheckboxState ( checked ? eOn : eOff ); + SetCheckboxState (aPresContext, checked ? eOn : eOff ); } @@ -171,7 +171,7 @@ nsCheckboxControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsresult res = mContent->GetAttribute ( kNameSpaceID_None, GetTristateAtom(), value ); PRBool isNowTristate = (res == NS_CONTENT_ATTR_HAS_VALUE); if ( isNowTristate != mIsTristate ) - SwitchModesWithEmergencyBrake(isNowTristate); + SwitchModesWithEmergencyBrake(aPresContext, isNowTristate); } else if ( aAttribute == GetTristateValueAtom() ) { // ignore this change if we're not a tri-state checkbox @@ -179,7 +179,7 @@ nsCheckboxControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsAutoString value; nsresult res = mContent->GetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), value ); if ( res == NS_CONTENT_ATTR_HAS_VALUE ) - SetCheckboxControlFrameState(value); + SetCheckboxControlFrameState(aPresContext, value); } } else @@ -207,7 +207,7 @@ nsCheckboxControlFrame::MouseUp(nsIPresContext* aPresContext) newState = eMixed; break; } - SetCheckboxState(newState); + SetCheckboxState(aPresContext, newState); // Keep the tri-state stuff on the content node current. No need to force an // attribute changed event since we just set the state of the checkbox ourselves. @@ -217,7 +217,7 @@ nsCheckboxControlFrame::MouseUp(nsIPresContext* aPresContext) } else { CheckState newState = GetCheckboxState() == eOn ? eOff : eOn; - SetCheckboxState(newState); + SetCheckboxState(aPresContext, newState); } } @@ -260,11 +260,11 @@ nsCheckboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue } void -nsCheckboxControlFrame::Reset() +nsCheckboxControlFrame::Reset(nsIPresContext* aPresContext) { PRBool checked; GetDefaultCheckState(&checked); - SetCheckboxState ( checked ? eOn : eOff ); + SetCheckboxState (aPresContext, checked ? eOn : eOff ); } NS_METHOD nsCheckboxControlFrame::HandleEvent(nsIPresContext& aPresContext, @@ -291,18 +291,21 @@ void nsCheckboxControlFrame::GetCheckboxControlFrameState(nsString& aValue) } -void nsCheckboxControlFrame::SetCheckboxControlFrameState(const nsString& aValue) +void nsCheckboxControlFrame::SetCheckboxControlFrameState(nsIPresContext* aPresContext, + const nsString& aValue) { CheckState state = StringToCheckState(aValue); - SetCheckboxState(state); + SetCheckboxState(aPresContext, state); } -NS_IMETHODIMP nsCheckboxControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsCheckboxControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, + const nsString& aValue) { if (nsHTMLAtoms::checked == aName) - SetCheckboxControlFrameState(aValue); + SetCheckboxControlFrameState(aPresContext, aValue); else - return nsNativeFormControlFrame::SetProperty(aName, aValue); + return nsNativeFormControlFrame::SetProperty(aPresContext, aName, aValue); return NS_OK; } @@ -376,7 +379,8 @@ nsCheckboxControlFrame :: StringToCheckState ( const nsString & aStateAsString ) // on the mode, we have to convert from one to the other. // void -nsCheckboxControlFrame :: SwitchModesWithEmergencyBrake ( PRBool inIsNowTristate ) +nsCheckboxControlFrame :: SwitchModesWithEmergencyBrake ( nsIPresContext* aPresContext, + PRBool inIsNowTristate ) { if ( inIsNowTristate ) { // we were a normal checkbox, and now we're a tristate. That means that the @@ -392,7 +396,7 @@ nsCheckboxControlFrame :: SwitchModesWithEmergencyBrake ( PRBool inIsNowTristate // to make sure it's not mixed. If it is, just set it to checked. Remove our // parallel attribute so that we're nice and HTML4 compliant. if ( GetCheckboxState() == eMixed ) - SetCheckboxState(eOn); + SetCheckboxState(aPresContext, eOn); mContent->UnsetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), PR_FALSE ); } @@ -404,13 +408,15 @@ nsCheckboxControlFrame :: SwitchModesWithEmergencyBrake ( PRBool inIsNowTristate //---------------------------------------------------------------------- // nsIStatefulFrame //---------------------------------------------------------------------- -NS_IMETHODIMP nsCheckboxControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +NS_IMETHODIMP nsCheckboxControlFrame::GetStateType(nsIPresContext* aPresContext, + nsIStatefulFrame::StateType* aStateType) { *aStateType=nsIStatefulFrame::eCheckboxType; return NS_OK; } -NS_IMETHODIMP nsCheckboxControlFrame::SaveState(nsISupports** aState) +NS_IMETHODIMP nsCheckboxControlFrame::SaveState(nsIPresContext* aPresContext, + nsISupports** aState) { nsISupportsString* value = nsnull; nsresult res = NS_OK; @@ -431,13 +437,14 @@ NS_IMETHODIMP nsCheckboxControlFrame::SaveState(nsISupports** aState) return res; } -NS_IMETHODIMP nsCheckboxControlFrame::RestoreState(nsISupports* aState) +NS_IMETHODIMP nsCheckboxControlFrame::RestoreState(nsIPresContext* aPresContext, + nsISupports* aState) { char* chars = nsnull; nsresult res = ((nsISupportsString*)aState)->GetData(&chars); if (NS_SUCCEEDED(res) && chars) { nsAutoString string(chars); - SetCheckboxControlFrameState(string); + SetCheckboxControlFrameState(aPresContext, string); nsCRT::free(chars); } return res; diff --git a/mozilla/layout/html/forms/src/nsCheckboxControlFrame.h b/mozilla/layout/html/forms/src/nsCheckboxControlFrame.h index 0a9d2e16172..3cc2b3627e0 100644 --- a/mozilla/layout/html/forms/src/nsCheckboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsCheckboxControlFrame.h @@ -65,9 +65,9 @@ public: virtual const nsIID& GetIID(); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); @@ -89,19 +89,20 @@ public: enum CheckState { eOff, eOn, eMixed } ; // nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); protected: // native/gfx implementations need to implement needs. virtual CheckState GetCheckboxState() = 0; - virtual void SetCheckboxState(CheckState aValue) = 0; + virtual void SetCheckboxState(nsIPresContext* aPresContext, CheckState aValue) = 0; // Utility methods for implementing SetProperty/GetProperty - void SetCheckboxControlFrameState(const nsString& aValue); + void SetCheckboxControlFrameState(nsIPresContext* aPresContext, + const nsString& aValue); void GetCheckboxControlFrameState(nsString& aValue); // utility routine for converting from DOM values to internal enum @@ -113,7 +114,8 @@ protected: // we just became a tri-state, or we just lost tri-state status. fix up // the attributes for the new mode. - void SwitchModesWithEmergencyBrake ( PRBool inIsNowTristate ) ; + void SwitchModesWithEmergencyBrake ( nsIPresContext* aPresContext, + PRBool inIsNowTristate ) ; // for tri-state checkbox. meaningless for normal HTML PRBool mIsTristate; diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index d63cbbfff70..cd6264f4361 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -189,7 +189,7 @@ nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter) // This is a UI decision that goes against the HTML 4 spec. // See bugzilla bug 15841 for justification of this deviation. nsresult -nsComboboxControlFrame::MakeSureSomethingIsSelected() +nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); @@ -203,7 +203,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected() mListControlFrame->GetNumberOfOptions(&length); if (length > 0) { // Set listbox selection to first item in the list box - rv = fcFrame->SetProperty(nsHTMLAtoms::selectedindex, "0"); + rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0"); mSelectedIndex = 0; } UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option @@ -217,9 +217,9 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected() // Initialize the text string in the combobox using either the current // selection in the list box or the first item item in the list box. void -nsComboboxControlFrame::InitTextStr(PRBool aUpdate) +nsComboboxControlFrame::InitTextStr(nsIPresContext* aPresContext, PRBool aUpdate) { - MakeSureSomethingIsSelected(); + MakeSureSomethingIsSelected(aPresContext); // Update the selected text string mListControlFrame->GetSelectedItem(mTextStr); @@ -235,18 +235,18 @@ nsComboboxControlFrame::InitTextStr(PRBool aUpdate) // Reset the combo box back to it original state. void -nsComboboxControlFrame::Reset() +nsComboboxControlFrame::Reset(nsIPresContext* aPresContext) { // Reset the dropdown list to its original state nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame); if ((NS_OK == result) && (nsnull != fcFrame)) { - fcFrame->Reset(); + fcFrame->Reset(aPresContext); } // Update the combobox using the text string returned from the dropdown list - InitTextStr(PR_TRUE); + InitTextStr(aPresContext, PR_TRUE); } void @@ -254,7 +254,7 @@ nsComboboxControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nscoord& aWidth, nscoord& aHeight) { - Reset(); + Reset(aPresContext); } //-------------------------------------------------------------- @@ -370,7 +370,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) nsIFrame * listFrame; if (NS_OK == mListControlFrame->QueryInterface(kIFrameIID, (void **)&listFrame)) { nsIView * view = nsnull; - listFrame->GetView(&view); + listFrame->GetView(aPresContext, &view); NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null"); view->GetWidget(widget); if (nsnull != widget) { @@ -385,7 +385,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) // The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected // which will stop the capture. mListControlFrame->AboutToDropDown(); - mListControlFrame->CaptureMouseEvents(PR_TRUE); + mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE); } else { ShowPopup(PR_FALSE); mDroppedDown = PR_FALSE; @@ -427,7 +427,7 @@ nsComboboxControlFrame::ReflowComboChildFrame(nsIFrame* aFrame, aFrame->GetRect(rect); rect.width = aDesiredSize.width; rect.height = aDesiredSize.height; - aFrame->SetRect(rect); + aFrame->SetRect(&aPresContext, rect); return rv; } @@ -557,7 +557,7 @@ nsComboboxControlFrame::PositionDropdown(nsIPresContext& aPresContext, dropdownFrame->GetRect(currentRect); //if (currentRect != dropdownRect) { - dropdownFrame->SetRect(dropdownRect); + dropdownFrame->SetRect(&aPresContext, dropdownRect); #ifdef DEBUG_rodsXXX printf("%d Position Dropdown at: %d %d %d %d\n", counter++, dropdownRect.x, dropdownRect.y, dropdownRect.width, dropdownRect.height); #endif @@ -593,7 +593,7 @@ nsComboboxControlFrame::GetAbsoluteFramePosition(nsIPresContext& aPresContext, // Add in frame's offset from it it's containing view nsIView *containingView = nsnull; nsPoint offset; - rv = aFrame->GetOffsetFromView(offset, &containingView); + rv = aFrame->GetOffsetFromView(&aPresContext, offset, &containingView); if (NS_SUCCEEDED(rv) && (nsnull != containingView)) { aAbsoluteTwipsRect.x += offset.x; aAbsoluteTwipsRect.y += offset.y; @@ -760,7 +760,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext& aPresContext, buttonFrame->GetRect(buttonRect); buttonRect.y = displayRect.y; buttonRect.height = displayRect.height; - buttonFrame->SetRect(buttonRect); + buttonFrame->SetRect(&aPresContext, buttonRect); // Reflow the dropdown list to match the width of the display + button ReflowComboChildFrame(dropdownFrame, aPresContext, dropdownDesiredSize, firstPassState, aStatus, aDesiredSize.width, NS_UNCONSTRAINEDSIZE); @@ -871,13 +871,15 @@ nsComboboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue } NS_IMETHODIMP -nsComboboxControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsComboboxControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { if (nsFormFrame::GetDisabled(this)) { *aFrame = this; return NS_OK; } else { - return nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame); + return nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); } return NS_OK; } @@ -921,7 +923,7 @@ nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown) if (!mDroppedDown && aDoDropDown) { if (mListControlFrame) { - mListControlFrame->SyncViewWithFrame(); + mListControlFrame->SyncViewWithFrame(mPresContext); } ToggleList(mPresContext); return NS_OK; @@ -964,7 +966,7 @@ nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext) aPresContext = mPresContext; } ShowList(aPresContext, PR_FALSE); - mListControlFrame->CaptureMouseEvents(PR_FALSE); + mListControlFrame->CaptureMouseEvents(aPresContext, PR_FALSE); PRInt32 indx; mListControlFrame->GetSelectedIndex(&indx); @@ -1059,36 +1061,36 @@ nsComboboxControlFrame::SelectionChanged() //---------------------------------------------------------------------- NS_IMETHODIMP -nsComboboxControlFrame::AddOption(PRInt32 aIndex) +nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { nsISelectControlFrame* listFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame), (void**)&listFrame); if (NS_SUCCEEDED(rv) && listFrame) { - rv = listFrame->AddOption(aIndex); + rv = listFrame->AddOption(aPresContext, aIndex); NS_RELEASE(listFrame); } // If we added the first option, we might need to select it. - MakeSureSomethingIsSelected(); + MakeSureSomethingIsSelected(aPresContext); return rv; } NS_IMETHODIMP -nsComboboxControlFrame::RemoveOption(PRInt32 aIndex) +nsComboboxControlFrame::RemoveOption(nsIPresContext* aPresContext, PRInt32 aIndex) { nsISelectControlFrame* listFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult rv = dropdownFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame), (void**)&listFrame); if (NS_SUCCEEDED(rv) && listFrame) { - rv = listFrame->RemoveOption(aIndex); + rv = listFrame->RemoveOption(aPresContext, aIndex); NS_RELEASE(listFrame); } // If we removed the selected option, nothing is selected any more. // Restore selection to option 0 if there are options left. - MakeSureSomethingIsSelected(); + MakeSureSomethingIsSelected(aPresContext); return rv; } @@ -1145,13 +1147,13 @@ nsComboboxControlFrame::RequiresWidget(PRBool& aRequiresWidget) NS_IMETHODIMP -nsComboboxControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsComboboxControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { nsIFormControlFrame* fcFrame = nsnull; nsIFrame* dropdownFrame = GetDropdownFrame(); nsresult result = dropdownFrame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame); if ((NS_SUCCEEDED(result)) && (nsnull != fcFrame)) { - return fcFrame->SetProperty(aName, aValue); + return fcFrame->SetProperty(aPresContext, aName, aValue); } return result; } @@ -1269,7 +1271,7 @@ nsComboboxControlFrame::SetInitialChildList(nsIPresContext& aPresContext, mPopupFrames.SetFrames(aChildList); } else { rv = nsAreaFrame::SetInitialChildList(aPresContext, aListName, aChildList); - InitTextStr(PR_FALSE); + InitTextStr(&aPresContext, PR_FALSE); } return rv; } @@ -1319,7 +1321,7 @@ nsComboboxControlFrame::Rollup() if (mDroppedDown) { mListControlFrame->AboutToRollup(); ShowDropDown(PR_FALSE); - mListControlFrame->CaptureMouseEvents(PR_FALSE); + mListControlFrame->CaptureMouseEvents(mPresContext, PR_FALSE); } return NS_OK; } @@ -1330,35 +1332,36 @@ nsComboboxControlFrame::Rollup() // the ListControlFrame, our child... //---------------------------------------------------------------------- NS_IMETHODIMP -nsComboboxControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsComboboxControlFrame::GetStateType(nsIPresContext* aPresContext, + nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eSelectType; return NS_OK; } NS_IMETHODIMP -nsComboboxControlFrame::SaveState(nsISupports** aState) +nsComboboxControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { if (!mListControlFrame) return NS_ERROR_UNEXPECTED; nsIStatefulFrame* sFrame = nsnull; nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame), (void**)&sFrame); if (NS_SUCCEEDED(res) && sFrame) { - res = sFrame->SaveState(aState); + res = sFrame->SaveState(aPresContext, aState); NS_RELEASE(sFrame); } return res; } NS_IMETHODIMP -nsComboboxControlFrame::RestoreState(nsISupports* aState) +nsComboboxControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { if (!mListControlFrame) return NS_ERROR_UNEXPECTED; nsIStatefulFrame* sFrame = nsnull; nsresult res = mListControlFrame->QueryInterface(NS_GET_IID(nsIStatefulFrame), (void**)&sFrame); if (NS_SUCCEEDED(res) && sFrame) { - res = sFrame->RestoreState(aState); + res = sFrame->RestoreState(aPresContext, aState); NS_RELEASE(sFrame); } return res; diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index 0b3b83f7dc0..177f7da526d 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -88,13 +88,13 @@ public: NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); // nsIFormControlFrame NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetName(nsString* aName); NS_IMETHOD GetType(PRInt32* aType) const; - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); @@ -103,7 +103,7 @@ public: nscoord& aHeight); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); @@ -139,8 +139,8 @@ public: NS_IMETHOD GetAbsoluteRect(nsRect* aRect); // nsISelectControlFrame - NS_IMETHOD AddOption(PRInt32 index); - NS_IMETHOD RemoveOption(PRInt32 index); + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 index); + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 index); NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue); NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue); @@ -154,9 +154,9 @@ public: virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); //nsIRollupListener NS_IMETHOD Rollup(); @@ -191,12 +191,12 @@ protected: void ShowPopup(PRBool aShowPopup); void ShowList(nsIPresContext* aPresContext, PRBool aShowList); void SetChildFrameSize(nsIFrame* aFrame, nscoord aWidth, nscoord aHeight); - void InitTextStr(PRBool aUpdate); + void InitTextStr(nsIPresContext* aPresContext, PRBool aUpdate); nsresult GetPrimaryComboFrame(nsIPresContext& aPresContext, nsIContent* aContent, nsIFrame** aFrame); nsIFrame* GetButtonFrame(nsIPresContext& aPresContext); nsIFrame* GetDropdownFrame(); NS_IMETHOD ToggleList(nsIPresContext* aPresContext); - nsresult MakeSureSomethingIsSelected(); // Default to option 0 + nsresult MakeSureSomethingIsSelected(nsIPresContext* aPresContext); // Default to option 0 nsFrameList mPopupFrames; // additional named child list nsIPresContext* mPresContext; // XXX: Remove the need to cache the pres context. diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index faf511e30d7..6cffb3ba1cc 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -271,7 +271,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext, if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull != view) { aRenderingContext.SetColor(NS_RGB(0,0,255)); } @@ -359,7 +359,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nsRect contentRect(borderPadding.left,borderPadding.top + mLegendSpace,aDesiredSize.width ,aDesiredSize.height); // Place the content area frame. - mContentFrame->SetRect(contentRect); + mContentFrame->SetRect(&aPresContext, contentRect); if (mLegendFrame) { @@ -376,7 +376,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, // place the legend nsRect actualLegendRect(mLegendRect); actualLegendRect.Deflate(legendMargin); - mLegendFrame->SetRect(actualLegendRect); + mLegendFrame->SetRect(&aPresContext, actualLegendRect); } // Return our size and our result diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index fb8a0850a11..75d7afc6970 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -161,7 +161,7 @@ nsFileControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter) } void -nsFileControlFrame::Reset() +nsFileControlFrame::Reset(nsIPresContext* aPresContext) { if (mTextFrame) { mTextFrame->Reset(); @@ -221,7 +221,7 @@ nsresult nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) { nsIView* textView; - mTextFrame->GetView(&textView); + mTextFrame->GetView(mPresContext, &textView); if (nsnull == textView) { return NS_OK; } @@ -249,7 +249,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) fileWidget->GetFile(fileSpec); char* leafName = fileSpec.GetLeafName(); if (leafName) { - mTextFrame->SetProperty(nsHTMLAtoms::value,leafName); + mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value,leafName); nsCRT::free(leafName); } } @@ -272,7 +272,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext& aPresContext, mTextFrame = GetTextControlFrame(this); if (!mTextFrame) return NS_ERROR_UNEXPECTED; if (mCachedState) { - mTextFrame->SetProperty(nsHTMLAtoms::value, *mCachedState); + mTextFrame->SetProperty(&aPresContext, nsHTMLAtoms::value, *mCachedState); delete mCachedState; mCachedState = nsnull; } @@ -414,13 +414,15 @@ nsFileControlFrame::AttributeChanged(nsIPresContext* aPresContext, } NS_IMETHODIMP -nsFileControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsFileControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { if (nsFormFrame::GetDisabled(this)) { *aFrame = this; return NS_OK; } else { - return nsAreaFrame::GetFrameForPoint(aPoint, aFrame); + return nsAreaFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); } return NS_OK; } @@ -473,7 +475,9 @@ nsresult nsFileControlFrame::RequiresWidget(PRBool& aRequiresWidget) } -NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, + const nsString& aValue) { nsresult rv = NS_OK; if (nsHTMLAtoms::value == aName) { @@ -516,14 +520,14 @@ nsFileControlFrame::Paint(nsIPresContext& aPresContext, // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsFileControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsFileControlFrame::GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eFileType; return NS_OK; } NS_IMETHODIMP -nsFileControlFrame::SaveState(nsISupports** aState) +nsFileControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { nsISupportsString* value = nsnull; nsAutoString string; @@ -546,13 +550,13 @@ nsFileControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsFileControlFrame::RestoreState(nsISupports* aState) +nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { char* chars = nsnull; nsresult res = ((nsISupportsString*)aState)->GetData(&chars); if (NS_SUCCEEDED(res) && chars) { nsAutoString value(chars); - SetProperty(nsHTMLAtoms::value, value); + SetProperty(aPresContext, nsHTMLAtoms::value, value); nsCRT::free(chars); } return res; diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.h b/mozilla/layout/html/forms/src/nsFileControlFrame.h index 6d4945fc382..4f9cb9cb06f 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.h @@ -42,6 +42,16 @@ public: nsFileControlFrame(); virtual ~nsFileControlFrame(); + // XXX Hack so we can squirrel away the pres context pointer + NS_IMETHOD Init(nsIPresContext& aPresContext, + nsIContent* aContent, + nsIFrame* aParent, + nsIStyleContext* aContext, + nsIFrame* aPrevInFlow) { + mPresContext = &aPresContext; + return nsAreaFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); + } + virtual void MouseClicked(nsIPresContext* aPresContext) {} virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } virtual nsFormFrame* GetFromFrame() { return mFormFrame; } @@ -52,7 +62,7 @@ public: nsFramePaintLayer aWhichLayer); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); @@ -63,7 +73,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight) { return NS_OK; }; - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, @@ -77,7 +87,7 @@ public: NS_IMETHOD GetName(nsString* aName); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); NS_IMETHOD GetType(PRInt32* aType) const; void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); @@ -149,9 +159,9 @@ public: virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; } //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); protected: nsIWidget* GetWindowTemp(nsIView *aView); // XXX temporary @@ -162,6 +172,8 @@ protected: nsFormFrame* mFormFrame; nsIHTMLContent* mTextContent; nsString* mCachedState; + // XXX Hack: pres context needed by function MouseClick() + nsIPresContext* mPresContext; // weak reference private: nsTextControlFrame* GetTextControlFrame(nsIFrame* aStart); diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index 52fe6a81128..04a57fe6d3b 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -199,7 +199,7 @@ nsFormControlFrame::DidReflow(nsIPresContext& aPresContext, // positioned then we show it. if (NS_FRAME_REFLOW_FINISHED == aStatus) { nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (view) { const nsStyleDisplay* display; GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)display)); @@ -462,7 +462,7 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext, } void -nsFormControlFrame::Reset() +nsFormControlFrame::Reset(nsIPresContext* aPresContext) { } @@ -533,7 +533,7 @@ nsFormControlFrame::SetCurrentCheckState(PRBool aState) } NS_IMETHODIMP -nsFormControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsFormControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.h b/mozilla/layout/html/forms/src/nsFormControlFrame.h index 1ddd228ed48..d06ddee3f3f 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.h +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.h @@ -156,7 +156,7 @@ public: virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); virtual void ScrollIntoView(nsIPresContext* aPresContext); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); /** @@ -203,7 +203,7 @@ public: nsSize& aSize); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); protected: diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp index 2c77d467436..ecd76fdfb4a 100644 --- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp @@ -78,7 +78,7 @@ nsFormControlHelper::~nsFormControlHelper() MOZ_COUNT_DTOR(nsFormControlHelper); } -void nsFormControlHelper::ForceDrawFrame(nsIFrame * aFrame) +void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame) { if (aFrame == nsnull) { return; @@ -86,7 +86,7 @@ void nsFormControlHelper::ForceDrawFrame(nsIFrame * aFrame) nsRect rect; nsIView * view; nsPoint pnt; - aFrame->GetOffsetFromView(pnt, &view); + aFrame->GetOffsetFromView(aPresContext, pnt, &view); aFrame->GetRect(rect); rect.x = pnt.x; rect.y = pnt.y; diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.h b/mozilla/layout/html/forms/src/nsFormControlHelper.h index 56a8537964d..dbce3b26107 100644 --- a/mozilla/layout/html/forms/src/nsFormControlHelper.h +++ b/mozilla/layout/html/forms/src/nsFormControlHelper.h @@ -126,7 +126,7 @@ public: nsInputDimensionSpec& aSpec, nsSize& aSize); - static void ForceDrawFrame(nsIFrame * aFrame); + static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame); static nsresult GetValue(nsIContent* aContent, nsString* aResult); static nsresult GetName(nsIContent* aContent, nsString* aResult); diff --git a/mozilla/layout/html/forms/src/nsFormFrame.cpp b/mozilla/layout/html/forms/src/nsFormFrame.cpp index 97cc16c4784..e7af8638d4f 100644 --- a/mozilla/layout/html/forms/src/nsFormFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormFrame.cpp @@ -251,12 +251,12 @@ nsFormFrame::GetEnctype(PRInt32* aEnctype) } NS_IMETHODIMP -nsFormFrame::OnReset() +nsFormFrame::OnReset(nsIPresContext* aPresContext) { PRInt32 numControls = mFormControls.Count(); for (int i = 0; i < numControls; i++) { nsIFormControlFrame* fcFrame = (nsIFormControlFrame*) mFormControls.ElementAt(i); - fcFrame->Reset(); + fcFrame->Reset(aPresContext); } return NS_OK; } @@ -297,7 +297,7 @@ void nsFormFrame::AddFormControlFrame(nsIPresContext& aPresContext, nsIFrame& aF nsFormFrame* formFrame = nsnull; result = presShell->GetPrimaryFrameFor(formContent, (nsIFrame**)&formFrame); if (NS_SUCCEEDED(result) && formFrame) { - formFrame->AddFormControlFrame(*fcFrame); + formFrame->AddFormControlFrame(&aPresContext, *fcFrame); fcFrame->SetFormFrame(formFrame); } NS_RELEASE(formContent); @@ -308,7 +308,7 @@ void nsFormFrame::AddFormControlFrame(nsIPresContext& aPresContext, nsIFrame& aF } } -void nsFormFrame::AddFormControlFrame(nsIFormControlFrame& aFrame) +void nsFormFrame::AddFormControlFrame(nsIPresContext* aPresContext, nsIFormControlFrame& aFrame) { mFormControls.AppendElement(&aFrame); @@ -354,14 +354,14 @@ void nsFormFrame::AddFormControlFrame(nsIFormControlFrame& aFrame) if (nsnull == group->GetCheckedRadio()) { group->SetCheckedRadio(radioFrame); } else { - radioFrame->SetChecked(PR_FALSE, PR_TRUE); + radioFrame->SetChecked(aPresContext, PR_FALSE, PR_TRUE); } } } } void -nsFormFrame::OnRadioChecked(nsRadioControlFrame& aControl, PRBool aChecked) +nsFormFrame::OnRadioChecked(nsIPresContext* aPresContext, nsRadioControlFrame& aControl, PRBool aChecked) { nsString radioName; aControl.GetName(&radioName); @@ -380,12 +380,12 @@ nsFormFrame::OnRadioChecked(nsRadioControlFrame& aControl, PRBool aChecked) if (aChecked) { if (&aControl != checkedRadio) { if (checkedRadio) { - checkedRadio->SetChecked(PR_FALSE, PR_FALSE); + checkedRadio->SetChecked(aPresContext, PR_FALSE, PR_FALSE); } group->SetCheckedRadio(&aControl); } } else if (&aControl == checkedRadio) { - checkedRadio->SetChecked(PR_FALSE, PR_FALSE); + checkedRadio->SetChecked(aPresContext, PR_FALSE, PR_FALSE); } } } diff --git a/mozilla/layout/html/forms/src/nsFormFrame.h b/mozilla/layout/html/forms/src/nsFormFrame.h index 325e19d30c4..c7501b384ef 100644 --- a/mozilla/layout/html/forms/src/nsFormFrame.h +++ b/mozilla/layout/html/forms/src/nsFormFrame.h @@ -49,15 +49,15 @@ public: // nsIFormManager - NS_IMETHOD OnReset(); + NS_IMETHOD OnReset(nsIPresContext* aPresContext); NS_IMETHOD OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame); // other methods - void OnRadioChecked(nsRadioControlFrame& aRadio, PRBool aChecked = PR_TRUE); + void OnRadioChecked(nsIPresContext* aPresContext, nsRadioControlFrame& aRadio, PRBool aChecked = PR_TRUE); - void AddFormControlFrame(nsIFormControlFrame& aFrame); + void AddFormControlFrame(nsIPresContext* aPresContext, nsIFormControlFrame& aFrame); static void AddFormControlFrame(nsIPresContext& aPresContext, nsIFrame& aFrame); PRBool CanSubmit(nsFormControlFrame& aFrame); diff --git a/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.cpp index e4ccf8994f1..ddd13d204dd 100644 --- a/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.cpp @@ -147,7 +147,9 @@ nsresult nsGfxAutoTextControlFrame::HandleEvent(nsIPresContext& aPresContext, } -nsresult nsGfxAutoTextControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsresult nsGfxAutoTextControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, + const nsString& aValue) { if (nsHTMLAtoms::autocomplete == aName) { @@ -155,7 +157,7 @@ nsresult nsGfxAutoTextControlFrame::SetProperty(nsIAtom* aName, const nsString& //return NS_OK; } - return(Inherited::SetProperty(aName, aValue)); + return(Inherited::SetProperty(aPresContext, aName, aValue)); } diff --git a/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.h b/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.h index 7b0dfcdea19..f9b2899ef76 100644 --- a/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxAutoTextControlFrame.h @@ -50,7 +50,7 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); void ReadAttributes(nsIContent* aContent); diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index 33dc6c6ff0b..6b83c2d7391 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -179,10 +179,11 @@ nsGfxCheckboxControlFrame :: GetCheckboxState ( ) } void -nsGfxCheckboxControlFrame :: SetCheckboxState ( nsCheckboxControlFrame::CheckState aValue ) +nsGfxCheckboxControlFrame :: SetCheckboxState (nsIPresContext* aPresContext, + nsCheckboxControlFrame::CheckState aValue ) { mChecked = aValue; - nsFormControlHelper::ForceDrawFrame(this); + nsFormControlHelper::ForceDrawFrame(aPresContext, this); } #ifdef DEBUG_rods diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.h b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.h index 81f728258a0..7f648c096c9 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.h @@ -45,7 +45,7 @@ public: protected: virtual CheckState GetCheckboxState(); - virtual void SetCheckboxState(CheckState aValue); + virtual void SetCheckboxState(nsIPresContext* aPresContext, CheckState aValue); virtual void PaintCheckBox(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp index 85b31e3ccdc..34ed5f5ddce 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -163,10 +163,10 @@ PRBool nsGfxRadioControlFrame::GetRadioState() return mChecked; } -void nsGfxRadioControlFrame::SetRadioState(PRBool aValue) +void nsGfxRadioControlFrame::SetRadioState(nsIPresContext* aPresContext, PRBool aValue) { mChecked = aValue; - nsFormControlHelper::ForceDrawFrame(this); + nsFormControlHelper::ForceDrawFrame(aPresContext, this); } #ifdef DEBUG_rods diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h index e2b9f73e7ae..e1dcefd60b1 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h @@ -70,7 +70,7 @@ public: protected: virtual PRBool GetRadioState(); - virtual void SetRadioState(PRBool aValue); + virtual void SetRadioState(nsIPresContext* aPresContext, PRBool aValue); //GFX-rendered state variables PRBool mChecked; diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp index f8a58336f44..baef4f1addd 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -696,7 +696,7 @@ void nsGfxTextControlFrame::SetTextControlFrameState(const nsString& aValue) } } -NS_IMETHODIMP nsGfxTextControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsGfxTextControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { if (PR_FALSE==mIsProcessing) { @@ -708,7 +708,7 @@ NS_IMETHODIMP nsGfxTextControlFrame::SetProperty(nsIAtom* aName, const nsString& mEditor->EnableUndo(PR_TRUE); // fire up a new txn stack } else { - return Inherited::SetProperty(aName, aValue); + return Inherited::SetProperty(aPresContext, aName, aValue); } mIsProcessing = PR_FALSE; } @@ -832,7 +832,7 @@ nsGfxTextControlFrame::CreateWebShell(nsIPresContext& aPresContext, nsIView* parView; nsPoint origin; - GetOffsetFromView(origin, &parView); + GetOffsetFromView(&aPresContext, origin, &parView); nsRect viewBounds(origin.x, origin.y, aSize.width, aSize.height); nsCOMPtr viewMan; @@ -840,7 +840,7 @@ nsGfxTextControlFrame::CreateWebShell(nsIPresContext& aPresContext, rv = view->Init(viewMan, viewBounds, parView); viewMan->InsertChild(parView, view, 0); rv = view->CreateWidget(kCChildCID); - SetView(view); + SetView(&aPresContext, view); // if the visibility is hidden, reflect that in the view const nsStyleDisplay* display; @@ -1981,12 +1981,12 @@ void nsGfxTextControlFrame::RemoveNewlines(nsString &aString) } NS_IMETHODIMP -nsGfxTextControlFrame::List(FILE* out, PRInt32 aIndent) const +nsGfxTextControlFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); nsIView* view; - GetView(&view); + GetView(aPresContext, &view); if (nsnull != view) { fprintf(out, " [view=%p]", view); } @@ -2012,7 +2012,7 @@ nsGfxTextControlFrame::List(FILE* out, PRInt32 aIndent) const nsIFrame* rootFrame; shell->GetRootFrame(&rootFrame); if (rootFrame) { - rootFrame->List(out, aIndent + 1); + rootFrame->List(aPresContext, out, aIndent + 1); nsCOMPtr doc; docv->GetDocument(*getter_AddRefs(doc)); if (doc) { diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h index ec3aa50c0e9..0b24fc2d111 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h @@ -303,12 +303,12 @@ public: nsIFrame* aParent, nsIStyleContext* aContext, nsIFrame* aPrevInFlow); - NS_IMETHOD List(FILE* out, PRInt32 aIndent) const; + NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const; NS_IMETHOD InitTextControl(); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index e121fe2c4d3..4488d15939f 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -278,7 +278,7 @@ nsHTMLButtonControlFrame::MouseClicked(nsIPresContext* aPresContext) formContent->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); } if (nsEventStatus_eConsumeNoDefault != status) { - mFormFrame->OnReset(); + mFormFrame->OnReset(aPresContext); } } else if (IsSubmit(type) == PR_TRUE) { @@ -314,11 +314,11 @@ nsHTMLButtonControlFrame::ScrollIntoView(nsIPresContext* aPresContext) } void -nsHTMLButtonControlFrame::GetTranslatedRect(nsRect& aRect) +nsHTMLButtonControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect) { nsIView* view; nsPoint viewOffset(0,0); - GetOffsetFromView(viewOffset, &view); + GetOffsetFromView(aPresContext, viewOffset, &view); while (nsnull != view) { nsPoint tempOffset; view->GetPosition(&tempOffset.x, &tempOffset.y); @@ -353,7 +353,9 @@ nsHTMLButtonControlFrame::HandleEvent(nsIPresContext& aPresContext, NS_IMETHODIMP -nsHTMLButtonControlFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsHTMLButtonControlFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { *aFrame = this; return NS_OK; @@ -530,7 +532,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, // See if it's targeted at us aReflowState.reflowCommand->GetTarget(targetFrame); if (this == targetFrame) { - Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE); + Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE); nsIReflowCommand::ReflowType reflowType; aReflowState.reflowCommand->GetType(reflowType); @@ -552,7 +554,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, // Place the child nsRect rect = nsRect(focusPadding.left + aReflowState.mComputedBorderPadding.left, focusPadding.top + aReflowState.mComputedBorderPadding.top, aDesiredSize.width, aDesiredSize.height); - firstKid->SetRect(rect); + firstKid->SetRect(&aPresContext, rect); // if computed use the computed values. if (aReflowState.mComputedWidth != NS_INTRINSICSIZE && (aDesiredSize.width < aReflowState.mComputedWidth)) @@ -631,7 +633,8 @@ nsresult nsHTMLButtonControlFrame::RequiresWidget(PRBool& aRequiresWidget) } -NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsHTMLButtonControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, const nsString& aValue) { return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h index ea6f1560037..0a654aca52d 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h @@ -75,7 +75,7 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, @@ -108,7 +108,7 @@ public: virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, nsString* aValues, nsString* aNames); virtual void MouseClicked(nsIPresContext* aPresContext); - virtual void Reset() {}; + virtual void Reset(nsIPresContext*) {}; virtual void SetFormFrame(nsFormFrame* aFormFrame) { mFormFrame = aFormFrame; } void SetFocus(PRBool aOn, PRBool aRepaint); @@ -129,7 +129,7 @@ public: void GetDefaultLabel(nsString& aLabel); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); @@ -140,7 +140,7 @@ protected: const nsHTMLReflowState& aSuggestedReflowState); NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); - void GetTranslatedRect(nsRect& aRect); + void GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect); PRIntn GetSkipSides() const; PRBool mInline; diff --git a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp index 9b191955e05..0fe4925a731 100644 --- a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp @@ -97,7 +97,7 @@ public: NS_IMETHOD GetName(nsString* aName); - virtual void Reset() {}; + virtual void Reset(nsIPresContext*) {}; void SetFocus(PRBool aOn, PRBool aRepaint); void ScrollIntoView(nsIPresContext* aPresContext); @@ -117,12 +117,12 @@ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); protected: - void GetTranslatedRect(nsRect& aRect); // XXX this implementation is a copy of nsHTMLButtonControlFrame + void GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect); // XXX this implementation is a copy of nsHTMLButtonControlFrame NS_IMETHOD_(nsrefcnt) AddRef(void); NS_IMETHOD_(nsrefcnt) Release(void); @@ -198,7 +198,7 @@ nsImageControlFrame::Reflow(nsIPresContext& aPresContext, // create our view, we need a view to grab the mouse nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (!view) { nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view); nsCOMPtr presShell; @@ -208,14 +208,14 @@ nsImageControlFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(&aPresContext, &parWithView); + parWithView->GetView(&aPresContext, &parView); // the view's size is not know yet, but its size will be kept in synch with our frame. nsRect boundBox(0, 0, 500, 500); result = view->Init(viewMan, boundBox, parView, nsnull); view->SetContentTransparency(PR_TRUE); viewMan->InsertChild(parView, view, 0); - SetView(view); + SetView(&aPresContext, view); const nsStyleColor* color = (const nsStyleColor*) mStyleContext->GetStyleData(eStyleStruct_Color); // set the opacity @@ -291,11 +291,11 @@ nsImageControlFrame::ScrollIntoView(nsIPresContext* aPresContext) } void -nsImageControlFrame::GetTranslatedRect(nsRect& aRect) +nsImageControlFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect) { nsIView* view; nsPoint viewOffset(0,0); - GetOffsetFromView(viewOffset, &view); + GetOffsetFromView(aPresContext, viewOffset, &view); while (nsnull != view) { nsPoint tempOffset; view->GetPosition(&tempOffset.x, &tempOffset.y); @@ -460,7 +460,8 @@ nsresult nsImageControlFrame::RequiresWidget(PRBool& aRequiresWidget) } -NS_IMETHODIMP nsImageControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsImageControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, const nsString& aValue) { return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index 12051e5e848..c1e0879ae29 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -90,7 +90,7 @@ public: nsGUIEvent* aEvent, nsEventStatus& aEventStatus); - NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); + NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame); NS_IMETHOD GetFor(nsString& aFor); @@ -101,7 +101,7 @@ public: protected: PRBool FindFirstControl(nsIFrame* aParentFrame, nsIFormControlFrame*& aResultFrame); PRBool FindForControl(nsIFormControlFrame*& aResultFrame); - void GetTranslatedRect(nsRect& aRect); + void GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect); PRIntn GetSkipSides() const; PRBool mInline; @@ -141,11 +141,11 @@ nsLabelFrame::nsLabelFrame() } void -nsLabelFrame::GetTranslatedRect(nsRect& aRect) +nsLabelFrame::GetTranslatedRect(nsIPresContext* aPresContext, nsRect& aRect) { nsIView* view; nsPoint viewOffset(0,0); - GetOffsetFromView(viewOffset, &view); + GetOffsetFromView(aPresContext, viewOffset, &view); while (nsnull != view) { nsPoint tempOffset; view->GetPosition(&tempOffset.x, &tempOffset.y); @@ -208,9 +208,11 @@ nsLabelFrame::HandleEvent(nsIPresContext& aPresContext, } NS_IMETHODIMP -nsLabelFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame) +nsLabelFrame::GetFrameForPoint(nsIPresContext* aPresContext, + const nsPoint& aPoint, + nsIFrame** aFrame) { - nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame); + nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame); if (nsnull != *aFrame) { nsCOMPtr controlFrame = do_QueryInterface(*aFrame); if (!controlFrame) { @@ -426,7 +428,7 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext, if (!mDidInit) { // create our view, we need a view to grab the mouse nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (!view) { nsresult result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view); @@ -437,14 +439,14 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(&aPresContext, &parWithView); + parWithView->GetView(&aPresContext, &parView); // the view's size is not know yet, but its size will be kept in synch with our frame. nsRect boundBox(0, 0, 500, 500); result = view->Init(viewMan, boundBox, parView, nsnull); view->SetContentTransparency(PR_TRUE); viewMan->InsertChild(parView, view, 0); - SetView(view); + SetView(&aPresContext, view); } mDidInit = PR_TRUE; } @@ -485,7 +487,7 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext, // Place the child nsRect rect = nsRect(borderPadding.left, borderPadding.top, aDesiredSize.width, aDesiredSize.height); - firstKid->SetRect(rect); + firstKid->SetRect(&aPresContext, rect); // add in our border and padding to the size of the child aDesiredSize.width += borderPadding.left + borderPadding.right; diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 51f2edf8b20..5b7e79d75a1 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -508,14 +508,14 @@ nsListControlFrame::GetSelectableFrame(nsIFrame *aFrame) //--------------------------------------------------------- void -nsListControlFrame::ForceRedraw() +nsListControlFrame::ForceRedraw(nsIPresContext* aPresContext) { //XXX: Hack. This should not be needed. The problem is DisplaySelected //and DisplayDeselected set and unset an attribute on generic HTML content //which does not know that it should repaint as the result of the attribute //being set. This should not be needed once the event state manager handles //selection. - nsFormControlHelper::ForceDrawFrame(this); + nsFormControlHelper::ForceDrawFrame(aPresContext, this); } @@ -803,12 +803,12 @@ nsListControlFrame::HasSameContent(nsIFrame* aFrame1, nsIFrame* aFrame2) //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::CaptureMouseEvents(PRBool aGrabMouseEvents) +nsListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents) { // get its view nsIView* view = nsnull; - GetView(&view); + GetView(aPresContext, &view); nsCOMPtr viewMan; PRBool result; @@ -974,7 +974,7 @@ nsListControlFrame::Init(nsIPresContext& aPresContext, // get the proper style based on attribute selectors which refer to the // selected attribute. if (!mIsInitializedFromContent) { - Reset(); + Reset(&aPresContext); } else { InitSelectionCache(-1); } @@ -1320,7 +1320,7 @@ nsListControlFrame::GetMaxNumValues() // those values as determined by the original HTML //--------------------------------------------------------- void -nsListControlFrame::Reset() +nsListControlFrame::Reset(nsIPresContext* aPresContext) { nsIDOMHTMLCollection* options = GetOptions(mContent); if (!options) { @@ -1604,7 +1604,7 @@ nsListControlFrame::ToggleSelected(PRInt32 aIndex) // nsISelectControlFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::AddOption(PRInt32 aIndex) +nsListControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) { PRInt32 numOptions; GetNumberOfOptions(&numOptions); @@ -1623,7 +1623,7 @@ nsListControlFrame::AddOption(PRInt32 aIndex) } NS_IMETHODIMP -nsListControlFrame::RemoveOption(PRInt32 aIndex) +nsListControlFrame::RemoveOption(nsIPresContext* aPresContext, PRInt32 aIndex) { PRInt32 numOptions; GetNumberOfOptions(&numOptions); @@ -1815,7 +1815,7 @@ nsListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue) //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +nsListControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. @@ -1919,7 +1919,7 @@ nsListControlFrame::GetViewOffset(nsIViewManager* aManager, nsIView* aView, //--------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::SyncViewWithFrame() +nsListControlFrame::SyncViewWithFrame(nsIPresContext* aPresContext) { // Resync the view's position with the frame. // The problem is the dropdown's view is attached directly under @@ -1932,21 +1932,21 @@ nsListControlFrame::SyncViewWithFrame() //Get parent frame nsIFrame* parent; - GetParentWithView(&parent); + GetParentWithView(aPresContext, &parent); NS_ASSERTION(parent, "GetParentWithView failed"); // Get parent view nsIView* parentView = nsnull; - parent->GetView(&parentView); + parent->GetView(aPresContext, &parentView); parentView->GetViewManager(*getter_AddRefs(viewManager)); GetViewOffset(viewManager, parentView, parentPos); nsIView* view = nsnull; - GetView(&view); + GetView(aPresContext, &view); nsIView* containingView = nsnull; nsPoint offset; - GetOffsetFromView(offset, &containingView); + GetOffsetFromView(aPresContext, offset, &containingView); //nsSize size; //GetSize(size); @@ -2001,12 +2001,14 @@ nsListControlFrame::AboutToRollup() //--------------------------------------------------------- nsresult -nsListControlFrame::GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView) +nsListControlFrame::GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView) { if (IsInDropDownMode() == PR_TRUE) { // Use the parent frame to get the view manager nsIView* parentView = nsnull; - nsresult rv = aParent->GetView(&parentView); + nsresult rv = aParent->GetView(aPresContext, &parentView); NS_ASSERTION(parentView, "GetView failed"); nsCOMPtr viewManager; parentView->GetViewManager(*getter_AddRefs(viewManager)); @@ -2022,7 +2024,7 @@ nsListControlFrame::GetScrollingParentView(nsIFrame* aParent, nsIView** aParentV NS_ASSERTION(aParentView, "GetRootView failed"); return rv; } else { - return nsScrollFrame::GetScrollingParentView(aParent, aParentView); + return nsScrollFrame::GetScrollingParentView(aPresContext, aParent, aParentView); } } @@ -2037,25 +2039,25 @@ nsListControlFrame::DidReflow(nsIPresContext& aPresContext, mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; nsresult rv = nsScrollFrame::DidReflow(aPresContext, aStatus); mState |= NS_FRAME_SYNC_FRAME_AND_VIEW; - SyncViewWithFrame(); + SyncViewWithFrame(&aPresContext); return rv; } else { return nsScrollFrame::DidReflow(aPresContext, aStatus); } } -NS_IMETHODIMP nsListControlFrame::MoveTo(nscoord aX, nscoord aY) +NS_IMETHODIMP nsListControlFrame::MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY) { if (PR_TRUE == IsInDropDownMode()) { //SyncViewWithFrame(); mState &= ~NS_FRAME_SYNC_FRAME_AND_VIEW; - nsresult rv = nsScrollFrame::MoveTo(aX, aY); + nsresult rv = nsScrollFrame::MoveTo(aPresContext, aX, aY); mState |= NS_FRAME_SYNC_FRAME_AND_VIEW; //SyncViewWithFrame(); return rv; } else { - return nsScrollFrame::MoveTo(aX, aY); + return nsScrollFrame::MoveTo(aPresContext, aX, aY); } } @@ -2150,7 +2152,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent) } } else { mButtonDown = PR_FALSE; - CaptureMouseEvents(PR_FALSE); + CaptureMouseEvents(mPresContext, PR_FALSE); UpdateSelection(PR_TRUE, PR_FALSE, mContent); } @@ -2227,10 +2229,10 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) // the pop up stole focus away from the webshell // now I am giving it back nsIFrame * parentFrame; - GetParentWithView(&parentFrame); + GetParentWithView(mPresContext, &parentFrame); if (nsnull != parentFrame) { nsIView * pView; - parentFrame->GetView(&pView); + parentFrame->GetView(mPresContext, &pView); if (nsnull != pView) { nsIWidget *window = nsnull; @@ -2257,7 +2259,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) mOldSelectedIndex = oldIndex; // Handle Like List mButtonDown = PR_TRUE; - CaptureMouseEvents(PR_TRUE); + CaptureMouseEvents(mPresContext, PR_TRUE); HandleListSelection(aMouseEvent); } } else { @@ -2291,7 +2293,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) //stateManager->SetContentState(mContent, NS_EVENT_STATE_FOCUS); if (isDroppedDown) { - CaptureMouseEvents(PR_FALSE); + CaptureMouseEvents(mPresContext, PR_FALSE); } NS_RELEASE(stateManager); @@ -2438,14 +2440,16 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent) // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsListControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsListControlFrame::GetStateType(nsIPresContext* aPresContext, + nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eSelectType; return NS_OK; } NS_IMETHODIMP -nsListControlFrame::SaveState(nsISupports** aState) +nsListControlFrame::SaveState(nsIPresContext* aPresContext, + nsISupports** aState) { nsISupportsArray* value = nsnull; nsresult res = NS_NewISupportsArray(&value); @@ -2480,7 +2484,8 @@ nsListControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsListControlFrame::RestoreState(nsISupports* aState) +nsListControlFrame::RestoreState(nsIPresContext* aPresContext, + nsISupports* aState) { nsISupportsArray* value = (nsISupportsArray *)aState; nsresult res = NS_ERROR_NULL_POINTER; diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.h b/mozilla/layout/html/forms/src/nsListControlFrame.h index 781d8736ff0..4d75808dc51 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.h +++ b/mozilla/layout/html/forms/src/nsListControlFrame.h @@ -75,12 +75,12 @@ public: nsIFrame* aPrevInFlow); NS_IMETHOD DidReflow(nsIPresContext& aPresContext, nsDidReflowStatus aStatus); - NS_IMETHOD MoveTo(nscoord aX, nscoord aY); + NS_IMETHOD MoveTo(nsIPresContext* aPresContext, nscoord aX, nscoord aY); // nsIFormControlFrame NS_IMETHOD GetType(PRInt32* aType) const; NS_IMETHOD GetName(nsString* aName); - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD GetMultiple(PRBool* aResult, nsIDOMHTMLSelectElement* aSelect = nsnull); NS_IMETHOD GetFont(nsIPresContext* aPresContext, @@ -90,7 +90,7 @@ public: virtual void SetFocus(PRBool aOn = PR_TRUE, PRBool aRepaint = PR_FALSE); virtual void ScrollIntoView(nsIPresContext* aPresContext); virtual void MouseClicked(nsIPresContext* aPresContext); - virtual void Reset(); + virtual void Reset(nsIPresContext* aPresContext); virtual PRBool IsSuccessful(nsIFormControlFrame* aSubmitter); virtual PRInt32 GetMaxNumValues(); virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues, @@ -112,25 +112,25 @@ public: NS_IMETHOD SetComboboxFrame(nsIFrame* aComboboxFrame); NS_IMETHOD GetSelectedIndex(PRInt32* aIndex); NS_IMETHOD GetSelectedItem(nsString & aStr); - NS_IMETHOD CaptureMouseEvents(PRBool aGrabMouseEvents); + NS_IMETHOD CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents); NS_IMETHOD GetMaximumSize(nsSize &aSize); NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); NS_IMETHOD GetNumberOfOptions(PRInt32* aNumOptions); - NS_IMETHOD SyncViewWithFrame(); + NS_IMETHOD SyncViewWithFrame(nsIPresContext* aPresContext); NS_IMETHOD AboutToDropDown(); NS_IMETHOD AboutToRollup(); NS_IMETHOD UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, nsIContent* aContent); // nsISelectControlFrame - NS_IMETHOD AddOption(PRInt32 index); - NS_IMETHOD RemoveOption(PRInt32 index); + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 index); + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 index); NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue); NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue); //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); //nsIDOMEventListener virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent); @@ -168,7 +168,9 @@ protected: // Override the widget created for the list box so a Borderless top level widget is created // for drop-down lists. virtual nsresult CreateScrollingViewWidget(nsIView* aView,const nsStylePosition* aPosition); - virtual nsresult GetScrollingParentView(nsIFrame* aParent, nsIView** aParentView); + virtual nsresult GetScrollingParentView(nsIPresContext* aPresContext, + nsIFrame* aParent, + nsIView** aParentView); PRInt32 GetNumberOfOptions(); // Utility methods @@ -192,7 +194,7 @@ protected: nsIFrame *GetSelectableFrame(nsIFrame *aFrame); void DisplaySelected(nsIContent* aContent); void DisplayDeselected(nsIContent* aContent); - void ForceRedraw(); + void ForceRedraw(nsIPresContext* aPresContext); PRBool IsOptionGroup(nsIFrame* aFrame); void SingleSelection(); void MultipleSelection(PRBool aIsShift, PRBool aIsControl); diff --git a/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.cpp b/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.cpp index 629513db99e..c912300ad93 100644 --- a/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.cpp +++ b/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.cpp @@ -145,7 +145,7 @@ nsNativeCheckboxControlFrame::GetCheckboxState() } -void nsNativeCheckboxControlFrame::SetCheckboxState(CheckState aValue) +void nsNativeCheckboxControlFrame::SetCheckboxState(nsIPresContext* aPresContext, CheckState aValue) { if (nsnull != mWidget) { nsICheckButton* checkBox = nsnull; diff --git a/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.h b/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.h index 9f56b1cda46..f79d1929998 100644 --- a/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.h +++ b/mozilla/layout/html/forms/src/nsNativeCheckboxControlFram.h @@ -38,7 +38,7 @@ public: protected: virtual CheckState GetCheckboxState(); - virtual void SetCheckboxState(CheckState aValue); + virtual void SetCheckboxState(nsIPresContext* aPresContext, CheckState aValue); virtual nscoord GetCheckboxSize(nsIPresContext* aPresContext, float aPixToTwip) const; virtual void GetDesiredSize(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp index 388b69db5de..582d8d5621f 100644 --- a/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeFormControlFrame.cpp @@ -96,7 +96,7 @@ nsNativeFormControlFrame::Reflow(nsIPresContext& aPresContext, // absolutely positioned controls already have a view but not a widget nsIView* view = nsnull; - GetView(&view); + GetView(&aPresContext, &view); if (nsnull == view) { result = nsComponentManager::CreateInstance(kViewCID, nsnull, kIViewIID, (void **)&view); if (!NS_SUCCEEDED(result)) { @@ -108,8 +108,8 @@ nsNativeFormControlFrame::Reflow(nsIPresContext& aPresContext, nsIFrame* parWithView; nsIView *parView; - GetParentWithView(&parWithView); - parWithView->GetView(&parView); + GetParentWithView(&aPresContext, &parWithView); + parWithView->GetView(&aPresContext, &parView); // initialize the view as hidden since we don't know the (x,y) until Paint result = view->Init(viewMan, boundBox, parView, nsnull, nsViewVisibility_kHide); @@ -120,7 +120,7 @@ nsNativeFormControlFrame::Reflow(nsIPresContext& aPresContext, } viewMan->InsertChild(parView, view, 0); - SetView(view); + SetView(&aPresContext, view); } PRInt32 type; @@ -276,7 +276,7 @@ NS_METHOD nsNativeFormControlFrame::HandleEvent(nsIPresContext& aPresContext, // XXX if there is no view, it could be an image button. Unfortunately, // every image button will get every event. nsIView* view; - GetView(&view); + GetView(&aPresContext, &view); if (view) { if (mWidget != aEvent->widget) { aEventStatus = nsEventStatus_eIgnore; diff --git a/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.cpp index a0bdfdb190e..07da2826564 100644 --- a/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.cpp @@ -133,7 +133,7 @@ nsNativeRadioControlFrame::AttributeChanged(nsIPresContext* aPresContext, button->GetState(checkedPrevState); if (checkedAttr != checkedPrevState) { button->SetState(checkedAttr); - mFormFrame->OnRadioChecked(*this, checkedAttr); + mFormFrame->OnRadioChecked(aPresContext, *this, checkedAttr); } NS_RELEASE(button); } @@ -162,7 +162,7 @@ PRBool nsNativeRadioControlFrame::GetRadioState() } -void nsNativeRadioControlFrame::SetRadioState(PRBool aValue) +void nsNativeRadioControlFrame::SetRadioState(nsIPresContext* aPresContext, PRBool aValue) { if (nsnull != mWidget) { nsIRadioButton* radio = nsnull; diff --git a/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.h b/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.h index ed3d3fd50a7..26493adcf28 100644 --- a/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.h +++ b/mozilla/layout/html/forms/src/nsNativeRadioControlFrame.h @@ -48,7 +48,7 @@ public: protected: virtual PRBool GetRadioState(); - virtual void SetRadioState(PRBool aValue); + virtual void SetRadioState(nsIPresContext* aPresContetx, PRBool aValue); virtual nscoord GetRadioboxSize(nsIPresContext* aPresContext, float aPixToTwip) const; virtual void GetDesiredSize(nsIPresContext* aPresContext, diff --git a/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp index be4f8019a0e..6dd71c2d124 100644 --- a/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeSelectControlFrame.cpp @@ -137,7 +137,7 @@ public: virtual void ControlChanged(nsIPresContext* aPresContext); // nsIFormControLFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, @@ -147,15 +147,15 @@ public: PRInt32 aHint); // nsISelectControlFrame - NS_IMETHOD AddOption(PRInt32 aIndex); - NS_IMETHOD RemoveOption(PRInt32 aIndex); + NS_IMETHOD AddOption(nsIPresContext* aPresContext, PRInt32 aIndex); + NS_IMETHOD RemoveOption(nsIPresContext* aPresContext, PRInt32 aIndex); NS_IMETHOD SetOptionSelected(PRInt32 aIndex, PRBool aValue); NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue); //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); protected: PRInt32 mNumRows; @@ -1238,7 +1238,8 @@ nsNativeSelectControlFrame::AttributeChanged(nsIPresContext* aPresContext, } -NS_IMETHODIMP nsNativeSelectControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsNativeSelectControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, const nsString& aValue) { if (nsHTMLAtoms::selected == aName) { return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec. @@ -1257,12 +1258,13 @@ NS_IMETHODIMP nsNativeSelectControlFrame::SetProperty(nsIAtom* aName, const nsSt // Update widget UpdateWidgetToCache(); } else { - return nsNativeFormControlFrame::SetProperty(aName, aValue); + return nsNativeFormControlFrame::SetProperty(aPresContext, aName, aValue); } return NS_OK; } -NS_IMETHODIMP nsNativeSelectControlFrame::AddOption(PRInt32 aIndex) +NS_IMETHODIMP nsNativeSelectControlFrame::AddOption(nsIPresContext* aPresContext, + PRInt32 aIndex) { // Grab the content model information nsIDOMHTMLCollection* options = GetOptions(); @@ -1318,7 +1320,8 @@ NS_IMETHODIMP nsNativeSelectControlFrame::AddOption(PRInt32 aIndex) return NS_OK; } -NS_IMETHODIMP nsNativeSelectControlFrame::RemoveOption(PRInt32 aIndex) +NS_IMETHODIMP nsNativeSelectControlFrame::RemoveOption(nsIPresContext* aPresContext, + PRInt32 aIndex) { // Grab the content model information nsIDOMHTMLCollection* options = GetOptions(); @@ -1536,14 +1539,15 @@ nsNativeSelectControlFrame::Deselect() // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsNativeSelectControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsNativeSelectControlFrame::GetStateType(nsIPresContext* aPresContext, + nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eSelectType; return NS_OK; } NS_IMETHODIMP -nsNativeSelectControlFrame::SaveState(nsISupports** aState) +nsNativeSelectControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { nsISupportsArray* value = nsnull; nsresult res = NS_NewISupportsArray(&value); @@ -1576,7 +1580,7 @@ nsNativeSelectControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsNativeSelectControlFrame::RestoreState(nsISupports* aState) +nsNativeSelectControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { nsISupportsArray* value = (nsISupportsArray *)aState; nsresult res = NS_ERROR_NULL_POINTER; diff --git a/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp index 7d6ea706714..527cb5fcc7e 100644 --- a/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsNativeTextControlFrame.cpp @@ -569,7 +569,9 @@ void nsNativeTextControlFrame::SetTextControlFrameState(const nsString& aValue) } } -NS_IMETHODIMP nsNativeTextControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsNativeTextControlFrame::SetProperty(nsIPresContext* aPresContext, + nsIAtom* aName, + const nsString& aValue) { nsresult rv = NS_OK; if (nsHTMLAtoms::value == aName) { @@ -592,7 +594,7 @@ NS_IMETHODIMP nsNativeTextControlFrame::SetProperty(nsIAtom* aName, const nsStri } } else { - return nsNativeFormControlFrame::SetProperty(aName, aValue); + return nsNativeFormControlFrame::SetProperty(aPresContext, aName, aValue); } return rv; } diff --git a/mozilla/layout/html/forms/src/nsNativeTextControlFrame.h b/mozilla/layout/html/forms/src/nsNativeTextControlFrame.h index d19ac1dfbf7..32209b16f96 100644 --- a/mozilla/layout/html/forms/src/nsNativeTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsNativeTextControlFrame.h @@ -31,7 +31,7 @@ public: virtual ~nsNativeTextControlFrame(); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext& aPresContext); diff --git a/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp index 3e796068fea..484aead978d 100644 --- a/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsRadioControlFrame.cpp @@ -75,22 +75,22 @@ nsRadioControlFrame::PostCreateWidget(nsIPresContext* aPresContext, nscoord& aWi nsresult result = GetDefaultCheckState(&checked); if (NS_CONTENT_ATTR_HAS_VALUE == result) { if (PR_TRUE == checked) - SetRadioControlFrameState(NS_STRING_TRUE); + SetRadioControlFrameState(aPresContext, NS_STRING_TRUE); else - SetRadioControlFrameState(NS_STRING_FALSE); + SetRadioControlFrameState(aPresContext, NS_STRING_FALSE); } } void nsRadioControlFrame::MouseUp(nsIPresContext* aPresContext) { - SetRadioControlFrameState(NS_STRING_TRUE); + SetRadioControlFrameState(aPresContext, NS_STRING_TRUE); if (mFormFrame) { // The form frame will determine which radio button needs // to be turned off and will call SetChecked on the // nsRadioControlFrame to unset the checked state - mFormFrame->OnRadioChecked(*this); + mFormFrame->OnRadioChecked(aPresContext, *this); } } @@ -108,7 +108,7 @@ nsRadioControlFrame::GetChecked(PRBool aGetInitialValue) } void -nsRadioControlFrame::SetChecked(PRBool aValue, PRBool aSetInitialValue) +nsRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue, PRBool aSetInitialValue) { if (aSetInitialValue) { if (aValue) { @@ -119,9 +119,9 @@ nsRadioControlFrame::SetChecked(PRBool aValue, PRBool aSetInitialValue) } if (PR_TRUE == aValue) { - SetRadioControlFrameState(NS_STRING_TRUE); + SetRadioControlFrameState(aPresContext, NS_STRING_TRUE); } else { - SetRadioControlFrameState(NS_STRING_FALSE); + SetRadioControlFrameState(aPresContext, NS_STRING_FALSE); } } @@ -218,25 +218,26 @@ void nsRadioControlFrame::GetRadioControlFrameState(nsString& aValue) nsFormControlHelper::GetBoolString(GetRadioState(), aValue); } -void nsRadioControlFrame::SetRadioControlFrameState(const nsString& aValue) +void nsRadioControlFrame::SetRadioControlFrameState(nsIPresContext* aPresContext, + const nsString& aValue) { PRBool state = nsFormControlHelper::GetBool(aValue); - SetRadioState(state); + SetRadioState(aPresContext, state); } -NS_IMETHODIMP nsRadioControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue) +NS_IMETHODIMP nsRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { if (nsHTMLAtoms::checked == aName) { // Set the current state for the radio button because // the mFormFrame->OnRadioChecked will not set it. - SetRadioControlFrameState(aValue); + SetRadioControlFrameState(aPresContext, aValue); if (mFormFrame) { PRBool state = (aValue == NS_STRING_TRUE) ? PR_TRUE : PR_FALSE; - mFormFrame->OnRadioChecked(*this, state); + mFormFrame->OnRadioChecked(aPresContext, *this, state); } } else { - return nsNativeFormControlFrame::SetProperty(aName, aValue); + return nsNativeFormControlFrame::SetProperty(aPresContext, aName, aValue); } return NS_OK; @@ -268,14 +269,14 @@ nsresult nsRadioControlFrame::RequiresWidget(PRBool& aRequiresWidget) // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsRadioControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsRadioControlFrame::GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eRadioType; return NS_OK; } NS_IMETHODIMP -nsRadioControlFrame::SaveState(nsISupports** aState) +nsRadioControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { nsISupportsString* value = nsnull; nsresult res = NS_OK; @@ -297,13 +298,13 @@ nsRadioControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsRadioControlFrame::RestoreState(nsISupports* aState) +nsRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { char* chars = nsnull; nsresult res = ((nsISupportsString*)aState)->GetData(&chars); if (NS_SUCCEEDED(res) && chars) { nsAutoString string(chars); - SetRadioControlFrameState(string); + SetRadioControlFrameState(aPresContext, string); nsCRT::free(chars); } return res; diff --git a/mozilla/layout/html/forms/src/nsRadioControlFrame.h b/mozilla/layout/html/forms/src/nsRadioControlFrame.h index 2ef05432226..85fa1f2a737 100644 --- a/mozilla/layout/html/forms/src/nsRadioControlFrame.h +++ b/mozilla/layout/html/forms/src/nsRadioControlFrame.h @@ -37,7 +37,7 @@ public: nsresult RequiresWidget(PRBool &aHasWidget); // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue); + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue); NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue); @@ -52,7 +52,7 @@ public: NS_IMETHOD SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext); virtual PRBool GetChecked(PRBool aGetInitialValue); - virtual void SetChecked(PRBool aValue, PRBool aSetInitialValue); + virtual void SetChecked(nsIPresContext* aPresContext, PRBool aValue, PRBool aSetInitialValue); virtual PRInt32 GetMaxNumValues() { return 1; } @@ -78,19 +78,19 @@ public: ///XXX: End o the temporary methods //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); protected: // Utility methods for implementing SetProperty/GetProperty - void SetRadioControlFrameState(const nsString& aValue); + void SetRadioControlFrameState(nsIPresContext* aPresContext, const nsString& aValue); void GetRadioControlFrameState(nsString& aValue); protected: virtual PRBool GetRadioState() = 0; - virtual void SetRadioState(PRBool aValue) = 0; + virtual void SetRadioState(nsIPresContext* aPresContext, PRBool aValue) = 0; private: NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index c12abaa53f7..dc0018c008e 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -349,14 +349,14 @@ nsTextControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight) // nsIStatefulFrame //---------------------------------------------------------------------- NS_IMETHODIMP -nsTextControlFrame::GetStateType(nsIStatefulFrame::StateType* aStateType) +nsTextControlFrame::GetStateType(nsIPresContext* aPresContext, nsIStatefulFrame::StateType* aStateType) { *aStateType = nsIStatefulFrame::eTextType; return NS_OK; } NS_IMETHODIMP -nsTextControlFrame::SaveState(nsISupports** aState) +nsTextControlFrame::SaveState(nsIPresContext* aPresContext, nsISupports** aState) { nsISupportsString* value = nsnull; nsAutoString string; @@ -379,13 +379,13 @@ nsTextControlFrame::SaveState(nsISupports** aState) } NS_IMETHODIMP -nsTextControlFrame::RestoreState(nsISupports* aState) +nsTextControlFrame::RestoreState(nsIPresContext* aPresContext, nsISupports* aState) { char* chars = nsnull; nsresult res = ((nsISupportsString*)aState)->GetData(&chars); if (NS_SUCCEEDED(res) && chars) { nsAutoString string(chars); - res = SetProperty(nsHTMLAtoms::value, string); + res = SetProperty(aPresContext, nsHTMLAtoms::value, string); nsCRT::free(chars); } return res; diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.h b/mozilla/layout/html/forms/src/nsTextControlFrame.h index c6b2b4afad2..83444e176a0 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.h @@ -56,9 +56,9 @@ public: NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight); //nsIStatefulFrame - NS_IMETHOD GetStateType(StateType* aStateType); - NS_IMETHOD SaveState(nsISupports** aState); - NS_IMETHOD RestoreState(nsISupports* aState); + NS_IMETHOD GetStateType(nsIPresContext* aPresContext, StateType* aStateType); + NS_IMETHOD SaveState(nsIPresContext* aPresContext, nsISupports** aState); + NS_IMETHOD RestoreState(nsIPresContext* aPresContext, nsISupports* aState); protected: @@ -81,7 +81,7 @@ private: /* ---------- abstract methods derived class must implement ---------- */ public: // nsIFormControlFrame - NS_IMETHOD SetProperty(nsIAtom* aName, const nsString& aValue)=0; + NS_IMETHOD SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue)=0; NS_IMETHOD GetProperty(nsIAtom* aName, nsString& aValue)=0; virtual nsWidgetInitData* GetWidgetInitData(nsIPresContext& aPresContext)=0; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index d5d37868731..69bd7ce9bc9 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -2258,12 +2258,12 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresContext* aPresCo nsIView* view; if (IsScrollable(aPresContext, display)) { - contentFrame->GetView(&view); + contentFrame->GetView(aPresContext, &view); } else { nsIFrame* parentFrame; contentFrame->GetParent(&parentFrame); - parentFrame->GetView(&view); + parentFrame->GetView(aPresContext, &view); } NS_ASSERTION(view, "expected a view"); @@ -2635,7 +2635,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext, nsIView* rootView; viewManager->GetRootView(rootView); - viewportFrame->SetView(rootView); + viewportFrame->SetView(aPresContext, rootView); // The viewport is the containing block for 'fixed' elements mFixedContainingBlock = viewportFrame; @@ -2751,7 +2751,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext, // Inform the view manager about the root scrollable view // get the scrolling view nsIView* view = nsnull; - newScrollableFrame->GetView(&view); + newScrollableFrame->GetView(aPresContext, &view); nsIScrollableView* scrollableView; view->QueryInterface(kScrollViewIID, (void**)&scrollableView); viewManager->SetRootScrollableView(scrollableView); @@ -3410,7 +3410,7 @@ nsresult rv = NS_OK; // XXX: We should replace this with a real widget manager similar // to how the nsFormControlFrame works. Re-directing events is a temporary Kludge. nsIView *listView; - listFrame->GetView(&listView); + listFrame->GetView(aPresContext, &listView); NS_ASSERTION(nsnull != listView,"ListFrame's view is nsnull"); //listView->SetViewFlags(NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN); @@ -3458,7 +3458,7 @@ nsresult rv = NS_OK; // to how the nsFormControlFrame works. // Re-directing events is a temporary Kludge. nsIView *listView; - listFrame->GetView(&listView); + listFrame->GetView(aPresContext, &listView); NS_ASSERTION(nsnull != listView,"ListFrame's view is nsnull"); //listView->SetViewFlags(NS_VIEW_PUBLIC_FLAG_DONT_CHECK_CHILDREN); aFrameHasBeenInitialized = PR_TRUE; @@ -7197,7 +7197,7 @@ UpdateViewsForTree(nsIPresContext& aPresContext, nsIFrame* aFrame, nsIViewManager* aViewManager, nsRect& aBoundsRect) { nsIView* view; - aFrame->GetView(&view); + aFrame->GetView(&aPresContext, &view); if (view) { SyncAndInvalidateView(view, aFrame, aViewManager); @@ -7273,10 +7273,10 @@ ApplyRenderingChangeToTree(nsIPresContext& aPresContext, // (adjusting r's coordinate system to reflect the nesting) and // update there. nsIView* view = nsnull; - aFrame->GetView(&view); + aFrame->GetView(&aPresContext, &view); nsIView* parentView; if (! view) { // XXX can view have children outside it? - aFrame->GetOffsetFromView(viewOffset, &parentView); + aFrame->GetOffsetFromView(&aPresContext, viewOffset, &parentView); NS_ASSERTION(nsnull != parentView, "no view"); if (! viewManager) { parentView->GetViewManager(viewManager); diff --git a/mozilla/layout/html/style/src/nsCSSRendering.cpp b/mozilla/layout/html/style/src/nsCSSRendering.cpp index 4d28aa8488f..8c46101f35d 100644 --- a/mozilla/layout/html/style/src/nsCSSRendering.cpp +++ b/mozilla/layout/html/style/src/nsCSSRendering.cpp @@ -1816,14 +1816,14 @@ ComputeBackgroundAnchorPoint(const nsStyleColor& aColor, // Returns the clip view associated with the scroll frame's scrolling // view static const nsIView* -GetClipView(nsIFrame* aScrollFrame) +GetClipView(nsIPresContext* aPresContext, nsIFrame* aScrollFrame) { nsIView* view; nsIScrollableView* scrollingView; const nsIView* clipView; // Get the scrolling view - aScrollFrame->GetView(&view); + aScrollFrame->GetView(aPresContext, &view); view->QueryInterface(kScrollViewIID, (void**)&scrollingView); // Get the clip view @@ -1968,7 +1968,7 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, scrollFrame = GetNearestScrollFrame(aForFrame); // Get the viewport size - clipView = GetClipView(scrollFrame); + clipView = GetClipView(&aPresContext, scrollFrame); clipView->GetDimensions(&viewportArea.width, &viewportArea.height); } @@ -1987,10 +1987,10 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext, if (NS_STYLE_BG_ATTACHMENT_FIXED == aColor.mBackgroundAttachment) { nsIView* view; - aForFrame->GetView(&view); + aForFrame->GetView(&aPresContext, &view); if (!view) { nsPoint offset; - aForFrame->GetOffsetFromView(offset, &view); + aForFrame->GetOffsetFromView(&aPresContext, offset, &view); anchor -= offset; } NS_ASSERTION(view, "expected a view"); diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index af8d2b83626..28bc713fdbe 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -304,7 +304,10 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext, //null range means the whole thing NS_IMETHODIMP -nsTableCellFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) +nsTableCellFrame::SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread) { //traverse through children unselect tables #if 0 @@ -409,7 +412,7 @@ void nsTableCellFrame::SetBorderEdge(PRUint8 aSide, * Align the cell's child frame within the cell * */ -void nsTableCellFrame::VerticallyAlignChild() +void nsTableCellFrame::VerticallyAlignChild(nsIPresContext* aPresContext) { const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); @@ -461,7 +464,7 @@ void nsTableCellFrame::VerticallyAlignChild() // Align the middle of the child frame with the middle of the content area, kidYTop = (height - childHeight - bottomInset + topInset) / 2; } - firstKid->MoveTo(kidRect.x, kidYTop); + firstKid->MoveTo(aPresContext, kidRect.x, kidYTop); } PRInt32 nsTableCellFrame::GetRowSpan() @@ -720,8 +723,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext, //////////////////////////////// HACK ////////////////////////////// kidSize.width = PR_MIN(kidSize.width, availSize.width); ///////////////////////////// END HACK ///////////////////////////// - firstKid->SetRect(nsRect(leftInset, topInset, - kidSize.width, kidSize.height)); + firstKid->SetRect(&aPresContext, nsRect(leftInset, topInset, + kidSize.width, kidSize.height)); // Return our size and our result diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.h b/mozilla/layout/html/table/src/nsTableCellFrame.h index b75d6bbb850..e8ba9c3e26c 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.h +++ b/mozilla/layout/html/table/src/nsTableCellFrame.h @@ -104,7 +104,10 @@ public: const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread); NS_IMETHOD Reflow(nsIPresContext& aPresContext, nsHTMLReflowMetrics& aDesiredSize, @@ -124,7 +127,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const; - virtual void VerticallyAlignChild(); + virtual void VerticallyAlignChild(nsIPresContext* aPresContext); /** * return the cell's specified row span. this is what was specified in the diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 4f44318f158..a158d7cbd16 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -341,7 +341,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext& aPresContext, nsReflowStatus status; ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, status); // note that DidReflow is called as the result of some ancestor firing off a DidReflow above me - kidFrame->SetRect(nsRect(0,0,0,0)); + kidFrame->SetRect(&aPresContext, nsRect(0,0,0,0)); } aDesiredSize.width=0; diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index ef39737e876..27785305797 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -1966,7 +1966,10 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext, //null range means the whole thing NS_IMETHODIMP -nsTableFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread) +nsTableFrame::SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread) { #if 0 //traverse through children unselect tables @@ -2089,7 +2092,7 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresCon // Adjust the y-origin if its position actually changed if (aDeltaY != 0) { kidRect.y += aDeltaY; - kidFrame->MoveTo(kidRect.x, kidRect.y); + kidFrame->MoveTo(&aPresContext, kidRect.x, kidRect.y); } } @@ -2103,7 +2106,7 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresCon if (aDeltaY != 0) { kidRect.y += aDeltaY; - aReflowState.footerFrame->MoveTo(kidRect.x, kidRect.y); + aReflowState.footerFrame->MoveTo(&aPresContext, kidRect.x, kidRect.y); } } @@ -2115,14 +2118,14 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext& aPresCon if (kidRect.YMost() < mRect.height) { nsRect dirtyRect(0, kidRect.YMost(), mRect.width, mRect.height - kidRect.YMost()); - Invalidate(dirtyRect); + Invalidate(&aPresContext, dirtyRect); } } return NS_OK; } -void nsTableFrame::SetColumnDimensions(nscoord aHeight) +void nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext, nscoord aHeight) { const nsStyleSpacing* spacing = (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); @@ -2159,14 +2162,14 @@ void nsTableFrame::SetColumnDimensions(nscoord aHeight) colGroupWidth += colWidth; nsRect colRect(colOrigin.x, colOrigin.y, colWidth, colHeight); - colFrame->SetRect(colRect); + colFrame->SetRect(aPresContext, colRect); colOrigin.x += colWidth; colX++; } colFrame->GetNextSibling(&colFrame); } nsRect colGroupRect(colGroupOrigin.x, colGroupOrigin.y, colGroupWidth, colHeight); - colGroupFrame->SetRect(colGroupRect); + colGroupFrame->SetRect(aPresContext, colGroupRect); colGroupFrame->GetNextSibling(&colGroupFrame); colGroupOrigin.x += colGroupWidth; } @@ -2295,7 +2298,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, damageRect.y = 0; damageRect.width = mRect.width; damageRect.height = mRect.height; - Invalidate(damageRect); + Invalidate(&aPresContext, damageRect); } } else @@ -2303,7 +2306,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext, // set aDesiredSize and aMaxElementSize } - SetColumnDimensions(aDesiredSize.height); + SetColumnDimensions(&aPresContext, aDesiredSize.height); if (pass1MaxElementSize) { aDesiredSize.maxElementSize = pass1MaxElementSize; } @@ -2374,7 +2377,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); // Place the child since some of its content fit in us. - kidFrame->SetRect(nsRect(0, 0, kidSize.width, kidSize.height)); + kidFrame->SetRect(&aPresContext, nsRect(0, 0, kidSize.width, kidSize.height)); if (NS_UNCONSTRAINEDSIZE==kidSize.height) y = NS_UNCONSTRAINEDSIZE; else @@ -2404,7 +2407,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext& aPresContext, nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame, availSize, aReason); ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus); - kidFrame->SetRect(nsRect(0, 0, 0, 0)); + kidFrame->SetRect(&aPresContext, nsRect(0, 0, 0, 0)); } } } @@ -2484,7 +2487,7 @@ nsTableFrame::PushChildren(nsIPresContext* aPresContext, // When pushing and pulling frames we need to check for whether any // views need to be reparented. for (nsIFrame* f = aFromChild; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, this, nextInFlow); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, this, nextInFlow); } nextInFlow->mFrames.InsertFrames(mNextInFlow, prevSibling, aFromChild); } @@ -2514,7 +2517,7 @@ nsTableFrame::MoveOverflowToChildList(nsIPresContext* aPresContext) // When pushing and pulling frames we need to check for whether any // views need to be reparented. for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) { - nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this); + nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this); } mFrames.InsertFrames(this, nsnull, prevOverflowFrames); result = PR_TRUE; @@ -2679,7 +2682,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext, if (collapseGroup || (NS_STYLE_VISIBILITY_COLLAPSE == rowDisplay->mVisible)) { aYGroupOffset += rowRect.height; rowRect.height = 0; - rowFrame->SetRect(rowRect); + rowFrame->SetRect(aPresContext, rowRect); nsIFrame* cellFrame; rowFrame->FirstChild(nsnull, &cellFrame); while (nsnull != cellFrame) { @@ -2691,7 +2694,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext, cFrame->GetRect(cRect); cRect.height -= rowRect.height; cFrame->SetCollapseOffsetY(aPresContext, -aYGroupOffset); - cFrame->SetRect(cRect); + cFrame->SetRect(aPresContext, cRect); } cellFrame->GetNextSibling(&cellFrame); } @@ -2710,7 +2713,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext, nsRect realRect; realCell->GetRect(realRect); realRect.height -= rowRect.height; - realCell->SetRect(realRect); + realCell->SetRect(aPresContext, realRect); } lastCell = realCell; } @@ -2718,7 +2721,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext, //} } else { // row is not collapsed but needs to be adjusted by those that are rowRect.y -= aYGroupOffset; - rowFrame->SetRect(rowRect); + rowFrame->SetRect(aPresContext, rowRect); } aRowX++; } @@ -2729,7 +2732,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext, aRowGroupFrame->GetRect(groupRect); groupRect.height -= aYGroupOffset; groupRect.y -= aYTotalOffset; - aRowGroupFrame->SetRect(groupRect); + aRowGroupFrame->SetRect(aPresContext, groupRect); return NS_OK; } @@ -2850,7 +2853,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext& aPresContext, } else { // the cell is not in a collapsed col but needs to move cellRect.x -= xOffset; } - cellFrame->SetRect(cellRect); + cellFrame->SetRect(&aPresContext, cellRect); // if the cell does not originate at (rowX, colX), adjust the real cells width } else if (collapseGroup || collapseCol) { if (cellData->mColSpanData) @@ -2858,7 +2861,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext& aPresContext, if ((cellFrame) && (lastCell != cellFrame)) { cellFrame->GetRect(cellRect); cellRect.width -= colWidth + cellSpacingX; - cellFrame->SetRect(cellRect); + cellFrame->SetRect(&aPresContext, cellRect); } } } @@ -3338,7 +3341,7 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, nscoord x = aReflowState.mBorderPadding.left; nscoord y = aReflowState.mBorderPadding.top + aReflowState.y; nsRect kidRect(x, y, desiredSize.width, desiredSize.height); - aNextFrame->SetRect(kidRect); + aNextFrame->SetRect(&aPresContext, kidRect); // Adjust the running y-offset aReflowState.y += kidRect.height; @@ -3379,7 +3382,7 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext& aPresContext, dirtyRect.width = mRect.width; dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) - dirtyRect.y; - Invalidate(dirtyRect); + Invalidate(&aPresContext, dirtyRect); } // Adjust the row groups that follow @@ -3440,7 +3443,7 @@ void nsTableFrame::PlaceChild(nsIPresContext& aPresContext, nsSize& aKidMaxElementSize) { // Place and size the child - aKidFrame->SetRect(aKidRect); + aKidFrame->SetRect(&aPresContext, aKidRect); // Adjust the running y-offset aReflowState.y += aKidRect.height; @@ -3469,12 +3472,12 @@ void nsTableFrame::PlaceChild(nsIPresContext& aPresContext, aKidFrame->GetOrigin(origin); aReflowState.footerFrame->GetSize(footerSize); origin.y -= footerSize.height; - aKidFrame->MoveTo(origin.x, origin.y); + aKidFrame->MoveTo(&aPresContext, origin.x, origin.y); // Move the footer below the body row group frame aReflowState.footerFrame->GetOrigin(origin); origin.y += aKidRect.height; - aReflowState.footerFrame->MoveTo(origin.x, origin.y); + aReflowState.footerFrame->MoveTo(&aPresContext, origin.x, origin.y); } //XXX: this should call into layout strategy to get the width field @@ -3899,7 +3902,7 @@ void nsTableFrame::SetTableWidth(nsIPresContext& aPresContext) else if (0 == tableWidth) { nsRect tableRect = mRect; tableRect.width = 0; - SetRect(tableRect); + SetRect(&aPresContext, tableRect); return; } @@ -3926,7 +3929,7 @@ void nsTableFrame::SetTableWidth(nsIPresContext& aPresContext) dc->GetScrollBarDimensions(sbWidth, sbHeight); tableSize.width += NSToCoordRound(sbWidth); } - SetRect(tableSize); + SetRect(&aPresContext, tableSize); } // XXX percentage based margin/border/padding @@ -4072,7 +4075,7 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext, if (rowGroupFrame->RowsDesireExcessSpace()) { nsRect newRowRect(rowRect.x, y, rowRect.width, excessForRow+rowRect.height); - rowFrame->SetRect(newRowRect); + rowFrame->SetRect(&aPresContext, newRowRect); if (NS_STYLE_BORDER_COLLAPSE == GetBorderCollapseStyle()) { NS_PRECONDITION(mBorderEdges, "haven't allocated border edges struct"); @@ -4105,7 +4108,7 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext, aRowGroupFrame->GetRect(rowGroupRect); if (rowGroupFrame->RowGroupDesiresExcessSpace()) { nsRect newRowGroupRect(rowGroupRect.x, aRowGroupYPos, rowGroupRect.width, aExcessForRowGroup+rowGroupRect.height); - aRowGroupFrame->SetRect(newRowGroupRect); + aRowGroupFrame->SetRect(&aPresContext, newRowGroupRect); aRowGroupYPos += aExcessForRowGroup + rowGroupRect.height; } else aRowGroupYPos += rowGroupRect.height; diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h index fed0d4bdcb7..d0cadd02854 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.h +++ b/mozilla/layout/html/table/src/nsTableFrame.h @@ -176,7 +176,10 @@ public: /** nsIFrame method overridden to handle table specifics */ - NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread); + NS_IMETHOD SetSelected(nsIPresContext* aPresContext, + nsIDOMRange *aRange, + PRBool aSelected, + nsSpread aSpread); /** inner tables are reflowed in two steps. *
@@ -765,7 +768,7 @@ protected:
   /** iterates all child frames and creates a new cell map */
   NS_IMETHOD ReBuildCellMap();
 
-  void SetColumnDimensions(nscoord aHeight);
+  void SetColumnDimensions(nsIPresContext* aPresContext, nscoord aHeight);
 
 #ifdef NS_DEBUG
   /** for debugging only
diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
index 4e7668e086a..47340a5e953 100644
--- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp
@@ -233,11 +233,14 @@ NS_METHOD nsTableOuterFrame::Paint(nsIPresContext&      aPresContext,
   return NS_OK;
 }
 
-NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread)
+NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsIPresContext* aPresContext,
+                                             nsIDOMRange *aRange,
+                                             PRBool aSelected,
+                                             nsSpread aSpread)
 {
-  nsresult result = nsFrame::SetSelected(aRange,aSelected, aSpread);
+  nsresult result = nsFrame::SetSelected(aPresContext, aRange,aSelected, aSpread);
   if (NS_SUCCEEDED(result) && mInnerTableFrame)
-    return mInnerTableFrame->SetSelected(aRange,aSelected, aSpread);
+    return mInnerTableFrame->SetSelected(aPresContext, aRange,aSelected, aSpread);
   return result;
 }
 
@@ -451,7 +454,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext&        aPres
   }
 
   // regardless of what we've done up to this point, place the caption and inner table
-  rv = SizeAndPlaceChildren(innerTableSize, 
+  rv = SizeAndPlaceChildren(&aPresContext, innerTableSize, 
                             nsSize (captionSize.width, captionSize.height), 
                             aReflowState);
 
@@ -476,7 +479,7 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext&        aPresContext,
 
       // Repaint our entire bounds
       // XXX Improve this...
-      Invalidate(nsRect(0, 0, mRect.width, mRect.height));
+      Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height));
     }
   }
 
@@ -498,13 +501,13 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext&        aPresContext,
 
     // Repaint the inner table frame's entire visible area
     dirtyRect.x = dirtyRect.y = 0;
-    Invalidate(dirtyRect);
+    Invalidate(&aPresContext, dirtyRect);
 
   } else if (!mCaptionFrame) {
     // The inner table isn't dirty so we don't need to reflow it, but make
     // sure it's placed correctly. It could be that we're dirty because the
     // caption was removed
-    mInnerTableFrame->MoveTo(0,0);
+    mInnerTableFrame->MoveTo(&aPresContext, 0,0);
 
     // Update our state so we calculate our desired size correctly
     nsRect  innerRect;
@@ -514,7 +517,7 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext&        aPresContext,
     
     // Repaint our entire bounds
     // XXX Improve this...
-    Invalidate(nsRect(0, 0, mRect.width, mRect.height));
+    Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height));
   }
 
   return rv;
@@ -618,7 +621,7 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext&        aPresCont
       else {
         captionRect.SizeTo(oldCaptionRect.width, oldCaptionRect.height);
       }
-      mCaptionFrame->SetRect(captionRect);
+      mCaptionFrame->SetRect(&aPresContext, captionRect);
     }
   }
 
@@ -652,7 +655,7 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext&        aPresCont
     aReflowState.y = innerSize.height;
   }
   nsRect innerRect(0, innerY, innerSize.width, innerSize.height);
-  mInnerTableFrame->SetRect(innerRect);
+  mInnerTableFrame->SetRect(&aPresContext, innerRect);
 
   aReflowState.innerTableMaxSize.width = innerSize.width;
   return rv;
@@ -708,7 +711,8 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext&        aPresConte
       }
     }
 
-    rv = SizeAndPlaceChildren(nsSize (innerSize.width, innerSize.height), 
+    rv = SizeAndPlaceChildren(&aPresContext,
+                              nsSize (innerSize.width, innerSize.height), 
                               nsSize (captionSize.width, captionSize.height), 
                               aReflowState);
   }
@@ -723,7 +727,8 @@ PRBool nsTableOuterFrame::IR_CaptionChangedAxis(const nsStyleTable* aOldStyle,
   return result;
 }
 
-nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize&          aInnerSize, 
+nsresult nsTableOuterFrame::SizeAndPlaceChildren(nsIPresContext*        aPresContext,
+                                                 const nsSize&          aInnerSize, 
                                                  const nsSize&          aCaptionSize,
                                                  OuterTableReflowState& aReflowState)
 {
@@ -743,7 +748,7 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize&          aInnerSi
   // Place the caption
   nsRect captionRect(captionMargin.left, captionY, 0, 0);
   captionRect.SizeTo(aCaptionSize.width, aCaptionSize.height);
-  mCaptionFrame->SetRect(captionRect);
+  mCaptionFrame->SetRect(aPresContext, captionRect);
 
   // Place the inner table
   nscoord innerY;
@@ -757,7 +762,7 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize&          aInnerSi
     aReflowState.y = innerY + aInnerSize.height;
   }
   nsRect innerRect(0, innerY, aInnerSize.width, aInnerSize.height);
-  mInnerTableFrame->SetRect(innerRect);
+  mInnerTableFrame->SetRect(aPresContext, innerRect);
   aReflowState.innerTableMaxSize.width = aInnerSize.width;
   return rv;
 }
@@ -948,7 +953,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext&          aPresContext,
 
         // Place the caption
         captionRect.SizeTo(captionSize.width, captionSize.height);
-        mCaptionFrame->SetRect(captionRect);
+        mCaptionFrame->SetRect(&aPresContext, captionRect);
       }
 
       // Place the inner table
@@ -964,13 +969,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext&          aPresContext,
         state.y = captionRect.YMost() + captionMargin.bottom;
       }
       nsRect innerRect(0, innerY, innerSize.width, innerSize.height);
-      mInnerTableFrame->SetRect(innerRect);
+      mInnerTableFrame->SetRect(&aPresContext, innerRect);
 
     } 
     else {
       // Place the inner table
       nsRect innerRect(0, 0, innerSize.width, innerSize.height);
-      mInnerTableFrame->SetRect(innerRect);
+      mInnerTableFrame->SetRect(&aPresContext, innerRect);
       state.y = innerSize.height;
     }
   }
@@ -995,7 +1000,7 @@ void nsTableOuterFrame::PlaceChild(OuterTableReflowState& aReflowState,
                                    nsSize&                aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(aReflowState.pc, aKidRect);
 
   // Adjust the running y-offset
   aReflowState.y += aKidRect.height;
diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.h b/mozilla/layout/html/table/src/nsTableOuterFrame.h
index 07d7c875551..abb658353a5 100644
--- a/mozilla/layout/html/table/src/nsTableOuterFrame.h
+++ b/mozilla/layout/html/table/src/nsTableOuterFrame.h
@@ -98,7 +98,10 @@ public:
 
   /** SetSelected needs to be overridden to talk to inner tableframe
    */
-  NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
+  NS_IMETHOD SetSelected(nsIPresContext* aPresContext,
+                         nsIDOMRange *aRange,
+                         PRBool aSelected,
+                         nsSpread aSpread);
 
   /** return the min width of the caption.  Return 0 if there is no caption. 
     * The return value is only meaningful after the caption has had a pass1 reflow.
@@ -241,7 +244,8 @@ protected:
                                const nsStyleTable* aNewStyle) const;
 
   /** set the size and the location of both the inner table frame and the caption. */
-  NS_IMETHOD SizeAndPlaceChildren(const nsSize &         aInnerSize, 
+  NS_IMETHOD SizeAndPlaceChildren(nsIPresContext*        aPresContext,
+                                  const nsSize &         aInnerSize, 
                                   const nsSize &         aCaptionSize,
                                   OuterTableReflowState& aReflowState);
 
diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
index 7fd560a48a8..f7b559b7f9b 100644
--- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp
@@ -330,7 +330,7 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext,
       cellFrame->GetSize(cellFrameSize);
       //if (cellFrameSize.height!=cellHeight)
       {
-        cellFrame->SizeTo(cellFrameSize.width, cellHeight);
+        cellFrame->SizeTo(&aPresContext, cellFrameSize.width, cellHeight);
         // realign cell content based on the new height
         /*nsHTMLReflowMetrics desiredSize(nsnull);
         nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
@@ -342,7 +342,7 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext,
         //     But some content crashes when this reflow is issued, to be investigated
         //XXX nsReflowStatus status;
         //ReflowChild(cellFrame, aPresContext, desiredSize, kidReflowState, status);
-        ((nsTableCellFrame *)cellFrame)->VerticallyAlignChild();
+        ((nsTableCellFrame *)cellFrame)->VerticallyAlignChild(&aPresContext);
         /* if we're collapsing borders, notify the cell that the border edge length has changed */
         if (NS_STYLE_BORDER_COLLAPSE == tableFrame->GetBorderCollapseStyle()) {
           ((nsTableCellFrame *)(cellFrame))->SetBorderEdgeLength(NS_SIDE_LEFT,
@@ -486,7 +486,7 @@ void nsTableRowFrame::PaintChildren(nsIPresContext&      aPresContext,
   while (nsnull != kid) {
     nsIView *pView;
      
-    kid->GetView(&pView);
+    kid->GetView(&aPresContext, &pView);
     if (nsnull == pView) {
       nsRect kidRect;
       kid->GetRect(kidRect);
@@ -604,7 +604,7 @@ void nsTableRowFrame::PlaceChild(nsIPresContext&    aPresContext,
 																 nsSize*            aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(&aPresContext, aKidRect);
 
   // update the running total for the row width
   aReflowState.x += aKidRect.width;
@@ -1553,8 +1553,8 @@ void nsTableRowFrame::ReflowCellFrame(nsIPresContext&          aPresContext,
   nsHTMLReflowMetrics desiredSize(nsnull);
 
   ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowState, aStatus);
-  aCellFrame->SizeTo(cellSize.width, aAvailableHeight);
-  aCellFrame->VerticallyAlignChild();
+  aCellFrame->SizeTo(&aPresContext, cellSize.width, aAvailableHeight);
+  aCellFrame->VerticallyAlignChild(&aPresContext);
 }
 
 /**
diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
index 5f5a6489027..cce9cb62d29 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
@@ -268,7 +268,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
   while (nsnull != kid) {
     nsIView *pView;
      
-    kid->GetView(&pView);
+    kid->GetView(&aPresContext, &pView);
     if (nsnull == pView) {
       PRBool clipState;
       nsRect kidRect;
@@ -296,7 +296,9 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
  * sufficient.  We have to ask the row if it has a child that contains the point.
  */
 NS_IMETHODIMP
-nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
+nsTableRowGroupFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                       const nsPoint& aPoint,
+                                       nsIFrame** aFrame)
 {
   nsIFrame* kid;
   nsRect kidRect;
@@ -311,13 +313,13 @@ nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
     if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) {
       if (((nsTableRowFrame*)(kid))->Contains(aPoint)) {
         tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
-        return kid->GetFrameForPoint(tmp, aFrame);
+        return kid->GetFrameForPoint(aPresContext, tmp, aFrame);
       }
     }
     else {
       if (kidRect.Contains(aPoint)) {
         tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
-        return kid->GetFrameForPoint(tmp, aFrame);
+        return kid->GetFrameForPoint(aPresContext, tmp, aFrame);
       }
     }
 
@@ -336,7 +338,7 @@ void nsTableRowGroupFrame::PlaceChild(nsIPresContext&      aPresContext,
 																			nsSize&              aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(&aPresContext, aKidRect);
 
   // Adjust the running y-offset
   aReflowState.y += aKidRect.height;
@@ -535,7 +537,7 @@ NS_METHOD nsTableRowGroupFrame::PullUpAllRowFrames(nsIPresContext& aPresContext)
         // When pushing and pulling frames we need to check for whether any
         // views need to be reparented.
         for (nsIFrame* f = nextInFlow->GetFirstFrame(); f; GetNextFrame(f, &f)) {
-          nsHTMLContainerFrame::ReparentFrameView(f, nextInFlow, this);
+          nsHTMLContainerFrame::ReparentFrameView(&aPresContext, f, nextInFlow, this);
         }
         // Append them to our child list
         mFrames.AppendFrames(this, nextInFlow->mFrames);
@@ -689,9 +691,9 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
                 {
                   // yes the cell's height fits with the available space of the rows it
                   // spans. Set the cell frame's height
-                  cellFrame->SizeTo(cellFrameSize.width, availHeightOfRowsSpanned);
+                  cellFrame->SizeTo(&aPresContext, cellFrameSize.width, availHeightOfRowsSpanned);
                   // Realign cell content based on new height
-                  ((nsTableCellFrame*)cellFrame)->VerticallyAlignChild();
+                  ((nsTableCellFrame*)cellFrame)->VerticallyAlignChild(&aPresContext);
                 }
                 else
                 {
@@ -744,7 +746,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
   
             // Resize the row to its final size and position
             rowBounds.height = rowHeights[rowIndex];
-            rowFrame->SetRect(rowBounds);
+            rowFrame->SetRect(&aPresContext, rowBounds);
           }
           
           rowIndex++;
@@ -829,7 +831,7 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext&      aPresContex
         htmlReflow->WillReflow(aPresContext);
       }
       
-      kidFrame->MoveTo(origin.x, origin.y);
+      kidFrame->MoveTo(&aPresContext, origin.x, origin.y);
     }
 
     // Remember the last frame
@@ -871,7 +873,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext&          aPresContext,
         nsHTMLReflowMetrics desiredSize(nsnull);
 
         rv = ReflowChild(rowFrame, aPresContext, desiredSize, rowReflowState, aStatus);
-        rowFrame->SizeTo(desiredSize.width, desiredSize.height);
+        rowFrame->SizeTo(&aPresContext, desiredSize.width, desiredSize.height);
         ((nsTableRowFrame *)rowFrame)->DidResize(aPresContext, aReflowState);
         aDesiredSize.height = desiredSize.height;
 
@@ -1533,7 +1535,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresConte
         // repaint the entire row
         // XXX Improve this so the row knows it should bitblt (or repaint) those
         // cells that change position...
-        Invalidate(kidRect);
+        Invalidate(&aPresContext, kidRect);
 
         // Invalidate the area we're offseting. Note that we only repaint within
         // our existing frame bounds.
@@ -1542,7 +1544,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresConte
         if (kidRect.YMost() < mRect.height) {
           nsRect  dirtyRect(0, kidRect.YMost(),
                             mRect.width, mRect.height - kidRect.YMost());
-          Invalidate(dirtyRect);
+          Invalidate(&aPresContext, dirtyRect);
         }
 
         // Adjust the frames that follow
@@ -1567,7 +1569,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresConte
       // XXX We should change CalculateRowHeights() to return the bounding
       // rect of what changed. Or whether anything moved or changed size...
       nsRect  dirtyRect(0, 0, mRect.width, mRect.height);
-      Invalidate(dirtyRect);
+      Invalidate(&aPresContext, dirtyRect);
     }
   }
   
diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h
index de9243116eb..32d51dd230b 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.h
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.h
@@ -131,7 +131,7 @@ public:
    * Return PR_TRUE if a frame containing the point is found.
    * @see nsContainerFrame::GetFrameForPoint
    */
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame);
 
    /** calls Reflow for all of its child rows.
     * Rows are all set to the same width and stacked vertically.
diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp
index af8d2b83626..28bc713fdbe 100644
--- a/mozilla/layout/tables/nsTableCellFrame.cpp
+++ b/mozilla/layout/tables/nsTableCellFrame.cpp
@@ -304,7 +304,10 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext& aPresContext,
 
 //null range means the whole thing
 NS_IMETHODIMP
-nsTableCellFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread)
+nsTableCellFrame::SetSelected(nsIPresContext* aPresContext,
+                              nsIDOMRange *aRange,
+                              PRBool aSelected,
+                              nsSpread aSpread)
 {
   //traverse through children unselect tables
 #if 0
@@ -409,7 +412,7 @@ void nsTableCellFrame::SetBorderEdge(PRUint8       aSide,
   * Align the cell's child frame within the cell
   *
   */
-void  nsTableCellFrame::VerticallyAlignChild()
+void  nsTableCellFrame::VerticallyAlignChild(nsIPresContext* aPresContext)
 {
   const nsStyleSpacing* spacing =
       (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
@@ -461,7 +464,7 @@ void  nsTableCellFrame::VerticallyAlignChild()
       // Align the middle of the child frame with the middle of the content area, 
       kidYTop = (height - childHeight - bottomInset + topInset) / 2;
   }
-  firstKid->MoveTo(kidRect.x, kidYTop);
+  firstKid->MoveTo(aPresContext, kidRect.x, kidYTop);
 }
 
 PRInt32 nsTableCellFrame::GetRowSpan()
@@ -720,8 +723,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext&          aPresContext,
   //////////////////////////////// HACK //////////////////////////////
   kidSize.width = PR_MIN(kidSize.width, availSize.width);
   ///////////////////////////// END HACK /////////////////////////////
-  firstKid->SetRect(nsRect(leftInset, topInset,
-                           kidSize.width, kidSize.height));  
+  firstKid->SetRect(&aPresContext, nsRect(leftInset, topInset,
+                                          kidSize.width, kidSize.height));  
     
   // Return our size and our result
 
diff --git a/mozilla/layout/tables/nsTableCellFrame.h b/mozilla/layout/tables/nsTableCellFrame.h
index b75d6bbb850..e8ba9c3e26c 100644
--- a/mozilla/layout/tables/nsTableCellFrame.h
+++ b/mozilla/layout/tables/nsTableCellFrame.h
@@ -104,7 +104,10 @@ public:
                    const nsRect& aDirtyRect,
                    nsFramePaintLayer aWhichLayer);
 
-  NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
+  NS_IMETHOD SetSelected(nsIPresContext* aPresContext,
+                         nsIDOMRange *aRange,
+                         PRBool aSelected,
+                         nsSpread aSpread);
 
   NS_IMETHOD Reflow(nsIPresContext&      aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
@@ -124,7 +127,7 @@ public:
 
   NS_IMETHOD GetFrameName(nsString& aResult) const;
 
-  virtual void VerticallyAlignChild();
+  virtual void VerticallyAlignChild(nsIPresContext* aPresContext);
 
   /**
    * return the cell's specified row span. this is what was specified in the
diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp
index 4f44318f158..a158d7cbd16 100644
--- a/mozilla/layout/tables/nsTableColGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp
@@ -341,7 +341,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext&          aPresContext,
     nsReflowStatus status;
     ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, status);
     // note that DidReflow is called as the result of some ancestor firing off a DidReflow above me
-    kidFrame->SetRect(nsRect(0,0,0,0));
+    kidFrame->SetRect(&aPresContext, nsRect(0,0,0,0));
   }
 
   aDesiredSize.width=0;
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index ef39737e876..27785305797 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -1966,7 +1966,10 @@ NS_METHOD nsTableFrame::Paint(nsIPresContext& aPresContext,
 
 //null range means the whole thing
 NS_IMETHODIMP
-nsTableFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread)
+nsTableFrame::SetSelected(nsIPresContext* aPresContext,
+                          nsIDOMRange *aRange,
+                          PRBool aSelected,
+                          nsSpread aSpread)
 {
 #if 0
   //traverse through children unselect tables
@@ -2089,7 +2092,7 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext&        aPresCon
       // Adjust the y-origin if its position actually changed
       if (aDeltaY != 0) {
         kidRect.y += aDeltaY;
-        kidFrame->MoveTo(kidRect.x, kidRect.y);
+        kidFrame->MoveTo(&aPresContext, kidRect.x, kidRect.y);
       }
     }
   
@@ -2103,7 +2106,7 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext&        aPresCon
   
       if (aDeltaY != 0) {
         kidRect.y += aDeltaY;
-        aReflowState.footerFrame->MoveTo(kidRect.x, kidRect.y);
+        aReflowState.footerFrame->MoveTo(&aPresContext, kidRect.x, kidRect.y);
       }
     }
 
@@ -2115,14 +2118,14 @@ nsresult nsTableFrame::AdjustSiblingsAfterReflow(nsIPresContext&        aPresCon
     if (kidRect.YMost() < mRect.height) {
       nsRect  dirtyRect(0, kidRect.YMost(),
                         mRect.width, mRect.height - kidRect.YMost());
-      Invalidate(dirtyRect);
+      Invalidate(&aPresContext, dirtyRect);
     }
   }
 
   return NS_OK;
 }
 
-void nsTableFrame::SetColumnDimensions(nscoord aHeight)
+void nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext, nscoord aHeight)
 {
   const nsStyleSpacing* spacing =
     (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
@@ -2159,14 +2162,14 @@ void nsTableFrame::SetColumnDimensions(nscoord aHeight)
 
         colGroupWidth += colWidth;
         nsRect colRect(colOrigin.x, colOrigin.y, colWidth, colHeight);
-        colFrame->SetRect(colRect);
+        colFrame->SetRect(aPresContext, colRect);
         colOrigin.x += colWidth;
         colX++;
       }
       colFrame->GetNextSibling(&colFrame);
     }
     nsRect colGroupRect(colGroupOrigin.x, colGroupOrigin.y, colGroupWidth, colHeight);
-    colGroupFrame->SetRect(colGroupRect);
+    colGroupFrame->SetRect(aPresContext, colGroupRect);
     colGroupFrame->GetNextSibling(&colGroupFrame);
     colGroupOrigin.x += colGroupWidth;
   }
@@ -2295,7 +2298,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
       damageRect.y = 0;
       damageRect.width = mRect.width;
       damageRect.height = mRect.height;
-      Invalidate(damageRect);
+      Invalidate(&aPresContext, damageRect);
     }
   }
   else
@@ -2303,7 +2306,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
     // set aDesiredSize and aMaxElementSize
   }
 
-  SetColumnDimensions(aDesiredSize.height);
+  SetColumnDimensions(&aPresContext, aDesiredSize.height);
   if (pass1MaxElementSize) {
     aDesiredSize.maxElementSize = pass1MaxElementSize;
   }
@@ -2374,7 +2377,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext&          aPresContext,
       ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus);
 
       // Place the child since some of its content fit in us.
-      kidFrame->SetRect(nsRect(0, 0, kidSize.width, kidSize.height));
+      kidFrame->SetRect(&aPresContext, nsRect(0, 0, kidSize.width, kidSize.height));
       if (NS_UNCONSTRAINEDSIZE==kidSize.height)
         y = NS_UNCONSTRAINEDSIZE;
       else
@@ -2404,7 +2407,7 @@ NS_METHOD nsTableFrame::ResizeReflowPass1(nsIPresContext&          aPresContext,
         nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
                                          availSize, aReason);
         ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, aStatus);
-        kidFrame->SetRect(nsRect(0, 0, 0, 0));
+        kidFrame->SetRect(&aPresContext, nsRect(0, 0, 0, 0));
       }
     }
   }
@@ -2484,7 +2487,7 @@ nsTableFrame::PushChildren(nsIPresContext* aPresContext,
     // When pushing and pulling frames we need to check for whether any
     // views need to be reparented.
     for (nsIFrame* f = aFromChild; f; f->GetNextSibling(&f)) {
-      nsHTMLContainerFrame::ReparentFrameView(f, this, nextInFlow);
+      nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, this, nextInFlow);
     }
     nextInFlow->mFrames.InsertFrames(mNextInFlow, prevSibling, aFromChild);
   }
@@ -2514,7 +2517,7 @@ nsTableFrame::MoveOverflowToChildList(nsIPresContext* aPresContext)
       // When pushing and pulling frames we need to check for whether any
       // views need to be reparented.
       for (nsIFrame* f = prevOverflowFrames; f; f->GetNextSibling(&f)) {
-        nsHTMLContainerFrame::ReparentFrameView(f, prevInFlow, this);
+        nsHTMLContainerFrame::ReparentFrameView(aPresContext, f, prevInFlow, this);
       }
       mFrames.InsertFrames(this, nsnull, prevOverflowFrames);
       result = PR_TRUE;
@@ -2679,7 +2682,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext,
       if (collapseGroup || (NS_STYLE_VISIBILITY_COLLAPSE == rowDisplay->mVisible)) {
         aYGroupOffset += rowRect.height;
         rowRect.height = 0;
-        rowFrame->SetRect(rowRect);
+        rowFrame->SetRect(aPresContext, rowRect);
         nsIFrame* cellFrame;
         rowFrame->FirstChild(nsnull, &cellFrame);
         while (nsnull != cellFrame) {
@@ -2691,7 +2694,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext,
             cFrame->GetRect(cRect);
             cRect.height -= rowRect.height;
             cFrame->SetCollapseOffsetY(aPresContext, -aYGroupOffset);
-            cFrame->SetRect(cRect);
+            cFrame->SetRect(aPresContext, cRect);
           }
           cellFrame->GetNextSibling(&cellFrame);
         }
@@ -2710,7 +2713,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext,
                 nsRect realRect;
                 realCell->GetRect(realRect);
                 realRect.height -= rowRect.height;
-                realCell->SetRect(realRect);
+                realCell->SetRect(aPresContext, realRect);
               }
               lastCell = realCell;
             }
@@ -2718,7 +2721,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext,
         //}
       } else { // row is not collapsed but needs to be adjusted by those that are
         rowRect.y -= aYGroupOffset;
-        rowFrame->SetRect(rowRect);
+        rowFrame->SetRect(aPresContext, rowRect);
       }
       aRowX++;
     }
@@ -2729,7 +2732,7 @@ NS_METHOD nsTableFrame::CollapseRowGroup(nsIPresContext* aPresContext,
   aRowGroupFrame->GetRect(groupRect);
   groupRect.height -= aYGroupOffset;
   groupRect.y -= aYTotalOffset;
-  aRowGroupFrame->SetRect(groupRect);
+  aRowGroupFrame->SetRect(aPresContext, groupRect);
 
   return NS_OK;
 }
@@ -2850,7 +2853,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext& aPresContext,
                 } else { // the cell is not in a collapsed col but needs to move
                   cellRect.x -= xOffset;
                 }
-                cellFrame->SetRect(cellRect);
+                cellFrame->SetRect(&aPresContext, cellRect);
               // if the cell does not originate at (rowX, colX), adjust the real cells width
               } else if (collapseGroup || collapseCol) { 
                 if (cellData->mColSpanData)
@@ -2858,7 +2861,7 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext& aPresContext,
                 if ((cellFrame) && (lastCell != cellFrame)) {
                   cellFrame->GetRect(cellRect);
                   cellRect.width -= colWidth + cellSpacingX;
-                  cellFrame->SetRect(cellRect);
+                  cellFrame->SetRect(&aPresContext, cellRect);
                 }
               }
             }
@@ -3338,7 +3341,7 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext&        aPresContext,
   nscoord x = aReflowState.mBorderPadding.left;
   nscoord y = aReflowState.mBorderPadding.top + aReflowState.y;
   nsRect  kidRect(x, y, desiredSize.width, desiredSize.height);
-  aNextFrame->SetRect(kidRect);
+  aNextFrame->SetRect(&aPresContext, kidRect);
 
   // Adjust the running y-offset
   aReflowState.y += kidRect.height;
@@ -3379,7 +3382,7 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext&        aPresContext,
       dirtyRect.width = mRect.width;
       dirtyRect.height = PR_MAX(oldKidRect.YMost(), kidRect.YMost()) -
                          dirtyRect.y;
-      Invalidate(dirtyRect);
+      Invalidate(&aPresContext, dirtyRect);
     }
 
     // Adjust the row groups that follow
@@ -3440,7 +3443,7 @@ void nsTableFrame::PlaceChild(nsIPresContext&    aPresContext,
                               nsSize&            aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(&aPresContext, aKidRect);
 
   // Adjust the running y-offset
   aReflowState.y += aKidRect.height;
@@ -3469,12 +3472,12 @@ void nsTableFrame::PlaceChild(nsIPresContext&    aPresContext,
     aKidFrame->GetOrigin(origin);
     aReflowState.footerFrame->GetSize(footerSize);
     origin.y -= footerSize.height;
-    aKidFrame->MoveTo(origin.x, origin.y);
+    aKidFrame->MoveTo(&aPresContext, origin.x, origin.y);
     
     // Move the footer below the body row group frame
     aReflowState.footerFrame->GetOrigin(origin);
     origin.y += aKidRect.height;
-    aReflowState.footerFrame->MoveTo(origin.x, origin.y);
+    aReflowState.footerFrame->MoveTo(&aPresContext, origin.x, origin.y);
   }
 
   //XXX: this should call into layout strategy to get the width field
@@ -3899,7 +3902,7 @@ void nsTableFrame::SetTableWidth(nsIPresContext& aPresContext)
   else if (0 == tableWidth)  {
     nsRect tableRect = mRect;
     tableRect.width = 0;
-    SetRect(tableRect);
+    SetRect(&aPresContext, tableRect);
     return;
   }
 
@@ -3926,7 +3929,7 @@ void nsTableFrame::SetTableWidth(nsIPresContext& aPresContext)
     dc->GetScrollBarDimensions(sbWidth, sbHeight);
     tableSize.width += NSToCoordRound(sbWidth);
   }
-  SetRect(tableSize);
+  SetRect(&aPresContext, tableSize);
 }
 
 // XXX percentage based margin/border/padding
@@ -4072,7 +4075,7 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
 
       if (rowGroupFrame->RowsDesireExcessSpace()) {
         nsRect newRowRect(rowRect.x, y, rowRect.width, excessForRow+rowRect.height);
-        rowFrame->SetRect(newRowRect);
+        rowFrame->SetRect(&aPresContext, newRowRect);
         if (NS_STYLE_BORDER_COLLAPSE == GetBorderCollapseStyle())
         {
           NS_PRECONDITION(mBorderEdges, "haven't allocated border edges struct");
@@ -4105,7 +4108,7 @@ void nsTableFrame::DistributeSpaceToRows(nsIPresContext& aPresContext,
   aRowGroupFrame->GetRect(rowGroupRect);  
   if (rowGroupFrame->RowGroupDesiresExcessSpace()) {
     nsRect newRowGroupRect(rowGroupRect.x, aRowGroupYPos, rowGroupRect.width, aExcessForRowGroup+rowGroupRect.height);
-    aRowGroupFrame->SetRect(newRowGroupRect);
+    aRowGroupFrame->SetRect(&aPresContext, newRowGroupRect);
     aRowGroupYPos += aExcessForRowGroup + rowGroupRect.height;
   }
   else aRowGroupYPos += rowGroupRect.height;
diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h
index fed0d4bdcb7..d0cadd02854 100644
--- a/mozilla/layout/tables/nsTableFrame.h
+++ b/mozilla/layout/tables/nsTableFrame.h
@@ -176,7 +176,10 @@ public:
 
   /** nsIFrame method overridden to handle table specifics
   */
-  NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
+  NS_IMETHOD SetSelected(nsIPresContext* aPresContext,
+                         nsIDOMRange *aRange,
+                         PRBool aSelected,
+                         nsSpread aSpread);
 
   /** inner tables are reflowed in two steps.
     * 
@@ -765,7 +768,7 @@ protected:
   /** iterates all child frames and creates a new cell map */
   NS_IMETHOD ReBuildCellMap();
 
-  void SetColumnDimensions(nscoord aHeight);
+  void SetColumnDimensions(nsIPresContext* aPresContext, nscoord aHeight);
 
 #ifdef NS_DEBUG
   /** for debugging only
diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp
index 4e7668e086a..47340a5e953 100644
--- a/mozilla/layout/tables/nsTableOuterFrame.cpp
+++ b/mozilla/layout/tables/nsTableOuterFrame.cpp
@@ -233,11 +233,14 @@ NS_METHOD nsTableOuterFrame::Paint(nsIPresContext&      aPresContext,
   return NS_OK;
 }
 
-NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread)
+NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsIPresContext* aPresContext,
+                                             nsIDOMRange *aRange,
+                                             PRBool aSelected,
+                                             nsSpread aSpread)
 {
-  nsresult result = nsFrame::SetSelected(aRange,aSelected, aSpread);
+  nsresult result = nsFrame::SetSelected(aPresContext, aRange,aSelected, aSpread);
   if (NS_SUCCEEDED(result) && mInnerTableFrame)
-    return mInnerTableFrame->SetSelected(aRange,aSelected, aSpread);
+    return mInnerTableFrame->SetSelected(aPresContext, aRange,aSelected, aSpread);
   return result;
 }
 
@@ -451,7 +454,7 @@ nsresult nsTableOuterFrame::IR_TargetIsCaptionFrame(nsIPresContext&        aPres
   }
 
   // regardless of what we've done up to this point, place the caption and inner table
-  rv = SizeAndPlaceChildren(innerTableSize, 
+  rv = SizeAndPlaceChildren(&aPresContext, innerTableSize, 
                             nsSize (captionSize.width, captionSize.height), 
                             aReflowState);
 
@@ -476,7 +479,7 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext&        aPresContext,
 
       // Repaint our entire bounds
       // XXX Improve this...
-      Invalidate(nsRect(0, 0, mRect.width, mRect.height));
+      Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height));
     }
   }
 
@@ -498,13 +501,13 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext&        aPresContext,
 
     // Repaint the inner table frame's entire visible area
     dirtyRect.x = dirtyRect.y = 0;
-    Invalidate(dirtyRect);
+    Invalidate(&aPresContext, dirtyRect);
 
   } else if (!mCaptionFrame) {
     // The inner table isn't dirty so we don't need to reflow it, but make
     // sure it's placed correctly. It could be that we're dirty because the
     // caption was removed
-    mInnerTableFrame->MoveTo(0,0);
+    mInnerTableFrame->MoveTo(&aPresContext, 0,0);
 
     // Update our state so we calculate our desired size correctly
     nsRect  innerRect;
@@ -514,7 +517,7 @@ nsTableOuterFrame::IR_ReflowDirty(nsIPresContext&        aPresContext,
     
     // Repaint our entire bounds
     // XXX Improve this...
-    Invalidate(nsRect(0, 0, mRect.width, mRect.height));
+    Invalidate(&aPresContext, nsRect(0, 0, mRect.width, mRect.height));
   }
 
   return rv;
@@ -618,7 +621,7 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext&        aPresCont
       else {
         captionRect.SizeTo(oldCaptionRect.width, oldCaptionRect.height);
       }
-      mCaptionFrame->SetRect(captionRect);
+      mCaptionFrame->SetRect(&aPresContext, captionRect);
     }
   }
 
@@ -652,7 +655,7 @@ nsresult nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext&        aPresCont
     aReflowState.y = innerSize.height;
   }
   nsRect innerRect(0, innerY, innerSize.width, innerSize.height);
-  mInnerTableFrame->SetRect(innerRect);
+  mInnerTableFrame->SetRect(&aPresContext, innerRect);
 
   aReflowState.innerTableMaxSize.width = innerSize.width;
   return rv;
@@ -708,7 +711,8 @@ nsresult nsTableOuterFrame::IR_CaptionInserted(nsIPresContext&        aPresConte
       }
     }
 
-    rv = SizeAndPlaceChildren(nsSize (innerSize.width, innerSize.height), 
+    rv = SizeAndPlaceChildren(&aPresContext,
+                              nsSize (innerSize.width, innerSize.height), 
                               nsSize (captionSize.width, captionSize.height), 
                               aReflowState);
   }
@@ -723,7 +727,8 @@ PRBool nsTableOuterFrame::IR_CaptionChangedAxis(const nsStyleTable* aOldStyle,
   return result;
 }
 
-nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize&          aInnerSize, 
+nsresult nsTableOuterFrame::SizeAndPlaceChildren(nsIPresContext*        aPresContext,
+                                                 const nsSize&          aInnerSize, 
                                                  const nsSize&          aCaptionSize,
                                                  OuterTableReflowState& aReflowState)
 {
@@ -743,7 +748,7 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize&          aInnerSi
   // Place the caption
   nsRect captionRect(captionMargin.left, captionY, 0, 0);
   captionRect.SizeTo(aCaptionSize.width, aCaptionSize.height);
-  mCaptionFrame->SetRect(captionRect);
+  mCaptionFrame->SetRect(aPresContext, captionRect);
 
   // Place the inner table
   nscoord innerY;
@@ -757,7 +762,7 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize&          aInnerSi
     aReflowState.y = innerY + aInnerSize.height;
   }
   nsRect innerRect(0, innerY, aInnerSize.width, aInnerSize.height);
-  mInnerTableFrame->SetRect(innerRect);
+  mInnerTableFrame->SetRect(aPresContext, innerRect);
   aReflowState.innerTableMaxSize.width = aInnerSize.width;
   return rv;
 }
@@ -948,7 +953,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext&          aPresContext,
 
         // Place the caption
         captionRect.SizeTo(captionSize.width, captionSize.height);
-        mCaptionFrame->SetRect(captionRect);
+        mCaptionFrame->SetRect(&aPresContext, captionRect);
       }
 
       // Place the inner table
@@ -964,13 +969,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext&          aPresContext,
         state.y = captionRect.YMost() + captionMargin.bottom;
       }
       nsRect innerRect(0, innerY, innerSize.width, innerSize.height);
-      mInnerTableFrame->SetRect(innerRect);
+      mInnerTableFrame->SetRect(&aPresContext, innerRect);
 
     } 
     else {
       // Place the inner table
       nsRect innerRect(0, 0, innerSize.width, innerSize.height);
-      mInnerTableFrame->SetRect(innerRect);
+      mInnerTableFrame->SetRect(&aPresContext, innerRect);
       state.y = innerSize.height;
     }
   }
@@ -995,7 +1000,7 @@ void nsTableOuterFrame::PlaceChild(OuterTableReflowState& aReflowState,
                                    nsSize&                aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(aReflowState.pc, aKidRect);
 
   // Adjust the running y-offset
   aReflowState.y += aKidRect.height;
diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h
index 07d7c875551..abb658353a5 100644
--- a/mozilla/layout/tables/nsTableOuterFrame.h
+++ b/mozilla/layout/tables/nsTableOuterFrame.h
@@ -98,7 +98,10 @@ public:
 
   /** SetSelected needs to be overridden to talk to inner tableframe
    */
-  NS_IMETHOD SetSelected(nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
+  NS_IMETHOD SetSelected(nsIPresContext* aPresContext,
+                         nsIDOMRange *aRange,
+                         PRBool aSelected,
+                         nsSpread aSpread);
 
   /** return the min width of the caption.  Return 0 if there is no caption. 
     * The return value is only meaningful after the caption has had a pass1 reflow.
@@ -241,7 +244,8 @@ protected:
                                const nsStyleTable* aNewStyle) const;
 
   /** set the size and the location of both the inner table frame and the caption. */
-  NS_IMETHOD SizeAndPlaceChildren(const nsSize &         aInnerSize, 
+  NS_IMETHOD SizeAndPlaceChildren(nsIPresContext*        aPresContext,
+                                  const nsSize &         aInnerSize, 
                                   const nsSize &         aCaptionSize,
                                   OuterTableReflowState& aReflowState);
 
diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp
index 7fd560a48a8..f7b559b7f9b 100644
--- a/mozilla/layout/tables/nsTableRowFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowFrame.cpp
@@ -330,7 +330,7 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext,
       cellFrame->GetSize(cellFrameSize);
       //if (cellFrameSize.height!=cellHeight)
       {
-        cellFrame->SizeTo(cellFrameSize.width, cellHeight);
+        cellFrame->SizeTo(&aPresContext, cellFrameSize.width, cellHeight);
         // realign cell content based on the new height
         /*nsHTMLReflowMetrics desiredSize(nsnull);
         nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
@@ -342,7 +342,7 @@ nsTableRowFrame::DidResize(nsIPresContext& aPresContext,
         //     But some content crashes when this reflow is issued, to be investigated
         //XXX nsReflowStatus status;
         //ReflowChild(cellFrame, aPresContext, desiredSize, kidReflowState, status);
-        ((nsTableCellFrame *)cellFrame)->VerticallyAlignChild();
+        ((nsTableCellFrame *)cellFrame)->VerticallyAlignChild(&aPresContext);
         /* if we're collapsing borders, notify the cell that the border edge length has changed */
         if (NS_STYLE_BORDER_COLLAPSE == tableFrame->GetBorderCollapseStyle()) {
           ((nsTableCellFrame *)(cellFrame))->SetBorderEdgeLength(NS_SIDE_LEFT,
@@ -486,7 +486,7 @@ void nsTableRowFrame::PaintChildren(nsIPresContext&      aPresContext,
   while (nsnull != kid) {
     nsIView *pView;
      
-    kid->GetView(&pView);
+    kid->GetView(&aPresContext, &pView);
     if (nsnull == pView) {
       nsRect kidRect;
       kid->GetRect(kidRect);
@@ -604,7 +604,7 @@ void nsTableRowFrame::PlaceChild(nsIPresContext&    aPresContext,
 																 nsSize*            aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(&aPresContext, aKidRect);
 
   // update the running total for the row width
   aReflowState.x += aKidRect.width;
@@ -1553,8 +1553,8 @@ void nsTableRowFrame::ReflowCellFrame(nsIPresContext&          aPresContext,
   nsHTMLReflowMetrics desiredSize(nsnull);
 
   ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowState, aStatus);
-  aCellFrame->SizeTo(cellSize.width, aAvailableHeight);
-  aCellFrame->VerticallyAlignChild();
+  aCellFrame->SizeTo(&aPresContext, cellSize.width, aAvailableHeight);
+  aCellFrame->VerticallyAlignChild(&aPresContext);
 }
 
 /**
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
index 5f5a6489027..cce9cb62d29 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
@@ -268,7 +268,7 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
   while (nsnull != kid) {
     nsIView *pView;
      
-    kid->GetView(&pView);
+    kid->GetView(&aPresContext, &pView);
     if (nsnull == pView) {
       PRBool clipState;
       nsRect kidRect;
@@ -296,7 +296,9 @@ void nsTableRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
  * sufficient.  We have to ask the row if it has a child that contains the point.
  */
 NS_IMETHODIMP
-nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
+nsTableRowGroupFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                       const nsPoint& aPoint,
+                                       nsIFrame** aFrame)
 {
   nsIFrame* kid;
   nsRect kidRect;
@@ -311,13 +313,13 @@ nsTableRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
     if (NS_STYLE_DISPLAY_TABLE_ROW == childDisplay->mDisplay) {
       if (((nsTableRowFrame*)(kid))->Contains(aPoint)) {
         tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
-        return kid->GetFrameForPoint(tmp, aFrame);
+        return kid->GetFrameForPoint(aPresContext, tmp, aFrame);
       }
     }
     else {
       if (kidRect.Contains(aPoint)) {
         tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
-        return kid->GetFrameForPoint(tmp, aFrame);
+        return kid->GetFrameForPoint(aPresContext, tmp, aFrame);
       }
     }
 
@@ -336,7 +338,7 @@ void nsTableRowGroupFrame::PlaceChild(nsIPresContext&      aPresContext,
 																			nsSize&              aKidMaxElementSize)
 {
   // Place and size the child
-  aKidFrame->SetRect(aKidRect);
+  aKidFrame->SetRect(&aPresContext, aKidRect);
 
   // Adjust the running y-offset
   aReflowState.y += aKidRect.height;
@@ -535,7 +537,7 @@ NS_METHOD nsTableRowGroupFrame::PullUpAllRowFrames(nsIPresContext& aPresContext)
         // When pushing and pulling frames we need to check for whether any
         // views need to be reparented.
         for (nsIFrame* f = nextInFlow->GetFirstFrame(); f; GetNextFrame(f, &f)) {
-          nsHTMLContainerFrame::ReparentFrameView(f, nextInFlow, this);
+          nsHTMLContainerFrame::ReparentFrameView(&aPresContext, f, nextInFlow, this);
         }
         // Append them to our child list
         mFrames.AppendFrames(this, nextInFlow->mFrames);
@@ -689,9 +691,9 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
                 {
                   // yes the cell's height fits with the available space of the rows it
                   // spans. Set the cell frame's height
-                  cellFrame->SizeTo(cellFrameSize.width, availHeightOfRowsSpanned);
+                  cellFrame->SizeTo(&aPresContext, cellFrameSize.width, availHeightOfRowsSpanned);
                   // Realign cell content based on new height
-                  ((nsTableCellFrame*)cellFrame)->VerticallyAlignChild();
+                  ((nsTableCellFrame*)cellFrame)->VerticallyAlignChild(&aPresContext);
                 }
                 else
                 {
@@ -744,7 +746,7 @@ void nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext& aPresContext,
   
             // Resize the row to its final size and position
             rowBounds.height = rowHeights[rowIndex];
-            rowFrame->SetRect(rowBounds);
+            rowFrame->SetRect(&aPresContext, rowBounds);
           }
           
           rowIndex++;
@@ -829,7 +831,7 @@ nsTableRowGroupFrame::AdjustSiblingsAfterReflow(nsIPresContext&      aPresContex
         htmlReflow->WillReflow(aPresContext);
       }
       
-      kidFrame->MoveTo(origin.x, origin.y);
+      kidFrame->MoveTo(&aPresContext, origin.x, origin.y);
     }
 
     // Remember the last frame
@@ -871,7 +873,7 @@ nsTableRowGroupFrame::SplitRowGroup(nsIPresContext&          aPresContext,
         nsHTMLReflowMetrics desiredSize(nsnull);
 
         rv = ReflowChild(rowFrame, aPresContext, desiredSize, rowReflowState, aStatus);
-        rowFrame->SizeTo(desiredSize.width, desiredSize.height);
+        rowFrame->SizeTo(&aPresContext, desiredSize.width, desiredSize.height);
         ((nsTableRowFrame *)rowFrame)->DidResize(aPresContext, aReflowState);
         aDesiredSize.height = desiredSize.height;
 
@@ -1533,7 +1535,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresConte
         // repaint the entire row
         // XXX Improve this so the row knows it should bitblt (or repaint) those
         // cells that change position...
-        Invalidate(kidRect);
+        Invalidate(&aPresContext, kidRect);
 
         // Invalidate the area we're offseting. Note that we only repaint within
         // our existing frame bounds.
@@ -1542,7 +1544,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresConte
         if (kidRect.YMost() < mRect.height) {
           nsRect  dirtyRect(0, kidRect.YMost(),
                             mRect.width, mRect.height - kidRect.YMost());
-          Invalidate(dirtyRect);
+          Invalidate(&aPresContext, dirtyRect);
         }
 
         // Adjust the frames that follow
@@ -1567,7 +1569,7 @@ NS_METHOD nsTableRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresConte
       // XXX We should change CalculateRowHeights() to return the bounding
       // rect of what changed. Or whether anything moved or changed size...
       nsRect  dirtyRect(0, 0, mRect.width, mRect.height);
-      Invalidate(dirtyRect);
+      Invalidate(&aPresContext, dirtyRect);
     }
   }
   
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.h b/mozilla/layout/tables/nsTableRowGroupFrame.h
index de9243116eb..32d51dd230b 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.h
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.h
@@ -131,7 +131,7 @@ public:
    * Return PR_TRUE if a frame containing the point is found.
    * @see nsContainerFrame::GetFrameForPoint
    */
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame);
 
    /** calls Reflow for all of its child rows.
     * Rows are all set to the same width and stacked vertically.
diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.cpp b/mozilla/layout/xul/base/src/nsBoxFrame.cpp
index b963e576380..77bf52f321b 100644
--- a/mozilla/layout/xul/base/src/nsBoxFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsBoxFrame.cpp
@@ -468,7 +468,7 @@ nsBoxFrame::Reflow(nsIPresContext&   aPresContext,
     aReflowState.reflowCommand->GetTarget(targetFrame);
     if (this == targetFrame) {
       // if it has redraw us
-      Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
+      Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
     } else {
       // otherwise dirty our children
       Dirty(aReflowState,incrementalChild);
@@ -727,7 +727,7 @@ nsBoxFrame::FlowChildren(nsIPresContext&   aPresContext,
       ListTag(stdout);
       printf("is being redrawn\n");
 #endif
-    Invalidate(nsRect(0,0,mRect.width, mRect.height), PR_FALSE);
+    Invalidate(&aPresContext, nsRect(0,0,mRect.width, mRect.height), PR_FALSE);
   }
 
   return NS_OK;
@@ -860,17 +860,17 @@ nsBoxFrame::ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, ns
 
 
 void 
-nsBoxFrame::CollapseChild(nsIFrame* frame)
+nsBoxFrame::CollapseChild(nsIPresContext* aPresContext, nsIFrame* frame)
 {
     nsRect rect(0,0,0,0);
     frame->GetRect(rect);
     if (rect.width > 0 || rect.height > 0) {
       // shrink the frame
-      frame->SizeTo(0,0);
+      frame->SizeTo(aPresContext, 0,0);
 
       // shrink the view
       nsIView* view = nsnull;
-      frame->GetView(&view);
+      frame->GetView(aPresContext, &view);
 
       // if we find a view stop right here. All views under it
       // will be clipped.
@@ -885,7 +885,7 @@ nsBoxFrame::CollapseChild(nsIFrame* frame)
 
       while (nsnull != child) 
       {
-         CollapseChild(child);
+         CollapseChild(aPresContext, child);
          nsresult rv = child->GetNextSibling(&child);
          NS_ASSERTION(rv == NS_OK,"failed to get next child");
       }
@@ -912,7 +912,7 @@ nsBoxFrame::PlaceChildren(nsIPresContext& aPresContext, nsRect& boxRect)
 
     // make collapsed children not show up
     if (mSprings[count].collapsed) {
-      CollapseChild(childFrame);
+      CollapseChild(&aPresContext, childFrame);
     } else {
       const nsStyleSpacing* spacing;
       rv = childFrame->GetStyleData(eStyleStruct_Spacing,
@@ -933,7 +933,7 @@ nsBoxFrame::PlaceChildren(nsIPresContext& aPresContext, nsRect& boxRect)
       childFrame->GetRect(rect);
       rect.x = x;
       rect.y = y;
-      childFrame->SetRect(rect);
+      childFrame->SetRect(&aPresContext, rect);
 
       // add in the right margin
       if (mHorizontal)
@@ -1008,7 +1008,7 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
                shouldReflow = PR_FALSE;
                desiredSize.width = aInfo.calculatedSize.width - (margin.left + margin.right);
                desiredSize.height = aInfo.calculatedSize.height - (margin.top + margin.bottom);
-               childFrame->SizeTo(desiredSize.width, desiredSize.height);
+               childFrame->SizeTo(&aPresContext, desiredSize.width, desiredSize.height);
           } else {
             desiredSize.width = currentRect.width;
             desiredSize.height = currentRect.height;
@@ -1147,7 +1147,7 @@ nsBoxFrame::FlowChildAt(nsIFrame* childFrame,
         }
 
           // set the rect
-        childFrame->SizeTo(desiredSize.width, desiredSize.height);
+        childFrame->SizeTo(&aPresContext, desiredSize.width, desiredSize.height);
 
         // Stub out desiredSize.maxElementSize so that when go out of
         // scope, nothing bad happens!
@@ -1967,10 +1967,11 @@ nsCalculatedBoxInfo::clear()
 
 
 NS_IMETHODIMP  
-nsBoxFrame::GetFrameForPoint(const nsPoint& aPoint, 
+nsBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                             const nsPoint& aPoint, 
                              nsIFrame**     aFrame)
 {   
-    nsresult rv = nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame);
+    nsresult rv = nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
     return rv;
 }
 
@@ -2040,7 +2041,7 @@ nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext& aPresContext,
       // how much we are scrolled.
       nsIScrollableView* scrollingView;
       nsIView*           view;
-      parent->GetView(&view);
+      parent->GetView(&aPresContext, &view);
       if (view) {
         nsresult result = view->QueryInterface(kScrollViewIID, (void**)&scrollingView);
         if (NS_SUCCEEDED(result)) {
diff --git a/mozilla/layout/xul/base/src/nsBoxFrame.h b/mozilla/layout/xul/base/src/nsBoxFrame.h
index 9c6eacc1e78..7400e8d5d94 100644
--- a/mozilla/layout/xul/base/src/nsBoxFrame.h
+++ b/mozilla/layout/xul/base/src/nsBoxFrame.h
@@ -63,7 +63,8 @@ public:
   // call this method to get the rect so you don't draw on the debug border or outer border.
   virtual void GetInnerRect(nsRect& aInner);
 
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, 
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint, 
                              nsIFrame**     aFrame);
 
   NS_IMETHOD GetCursor(nsIPresContext& aPresContext,
@@ -170,7 +171,7 @@ protected:
     virtual PRIntn GetSkipSides() const { return 0; }
 
     virtual void GetInset(nsMargin& margin); 
-    virtual void CollapseChild(nsIFrame* frame);
+    virtual void CollapseChild(nsIPresContext* aPresContext, nsIFrame* frame);
 
     nsresult GenerateDirtyReflowCommand(nsIPresContext& aPresContext,
                                         nsIPresShell&   aPresShell);
diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.cpp b/mozilla/layout/xul/base/src/nsDeckFrame.cpp
index 80c87d4bf10..28176628acd 100644
--- a/mozilla/layout/xul/base/src/nsDeckFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsDeckFrame.cpp
@@ -168,7 +168,8 @@ nsDeckFrame::Paint(nsIPresContext& aPresContext,
 }
 
 
-NS_IMETHODIMP  nsDeckFrame::GetFrameForPoint(const nsPoint& aPoint, 
+NS_IMETHODIMP  nsDeckFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                             const nsPoint& aPoint, 
                                              nsIFrame**     aFrame)
 {
   // if its not in our child just return us.
@@ -187,7 +188,7 @@ NS_IMETHODIMP  nsDeckFrame::GetFrameForPoint(const nsPoint& aPoint,
       nsPoint p = aPoint;
       p.x -= childRect.x;
       p.y -= childRect.y;
-      return selectedFrame->GetFrameForPoint(p, aFrame);
+      return selectedFrame->GetFrameForPoint(aPresContext, p, aFrame);
     }
   }
     
@@ -272,7 +273,7 @@ nsDeckFrame::PlaceChildren(nsIPresContext& aPresContext, nsRect& boxRect)
   
     // make collapsed children not show up
     if (mSprings[count].collapsed || count != index) {
-       CollapseChild(childFrame);
+       CollapseChild(&aPresContext, childFrame);
   //  } if (count != index) {
       // if the child is not in view then make sure its view is 0 so it clips
       // out all its children.
@@ -283,7 +284,7 @@ nsDeckFrame::PlaceChildren(nsIPresContext& aPresContext, nsRect& boxRect)
       ////nsIView* pv;
       //GetView(&pv);
       //childView->SetParent(pv);
-      childFrame->MoveTo(boxRect.x, boxRect.y);
+      childFrame->MoveTo(&aPresContext, boxRect.x, boxRect.y);
     }
 
     rv = childFrame->GetNextSibling(&childFrame);
diff --git a/mozilla/layout/xul/base/src/nsDeckFrame.h b/mozilla/layout/xul/base/src/nsDeckFrame.h
index 830d86c331b..903c8f104af 100644
--- a/mozilla/layout/xul/base/src/nsDeckFrame.h
+++ b/mozilla/layout/xul/base/src/nsDeckFrame.h
@@ -62,7 +62,8 @@ public:
                                               nsIFrame*       aChildList);
 
 
-  NS_IMETHOD  GetFrameForPoint(const nsPoint& aPoint, 
+  NS_IMETHOD  GetFrameForPoint(nsIPresContext* aPresContext,
+                               const nsPoint& aPoint, 
                                nsIFrame**     aFrame);
 
   virtual PRIntn GetSkipSides() const { return 0; }  
diff --git a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp
index 0a561ad6673..8047c025a77 100644
--- a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp
@@ -106,6 +106,9 @@ nsMenuBarFrame::Init(nsIPresContext&  aPresContext,
 {
   nsresult  rv = nsToolbarFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
 
+  // XXX hack
+  mPresContext = &aPresContext;
+
   // Create the menu bar listener.
   mMenuBarListener = new nsMenuBarListener(this);
 
@@ -482,7 +485,7 @@ nsMenuBarFrame::GetWidget(nsIWidget **aWidget)
 {
   // Get parent view
   nsIView * view = nsnull;
-  nsMenuPopupFrame::GetNearestEnclosingView(this, &view);
+  nsMenuPopupFrame::GetNearestEnclosingView(mPresContext, this, &view);
   if (!view)
     return NS_OK;
 
diff --git a/mozilla/layout/xul/base/src/nsMenuBarFrame.h b/mozilla/layout/xul/base/src/nsMenuBarFrame.h
index c183bf7258e..fb2d94f174d 100644
--- a/mozilla/layout/xul/base/src/nsMenuBarFrame.h
+++ b/mozilla/layout/xul/base/src/nsMenuBarFrame.h
@@ -100,6 +100,9 @@ protected:
 
   nsIDOMEventReceiver* mTarget;
 
+  // XXX Hack
+  nsIPresContext* mPresContext;  // weak reference
+
 }; // class nsMenuBarFrame
 
 #endif
diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp
index 381643d5164..a4d7b1f159f 100644
--- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp
@@ -207,10 +207,11 @@ nsMenuFrame::Destroy(nsIPresContext& aPresContext)
 
 // Called to prevent events from going to anything inside the menu.
 NS_IMETHODIMP
-nsMenuFrame::GetFrameForPoint(const nsPoint& aPoint, 
+nsMenuFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint, 
                               nsIFrame**     aFrame)
 {
-  nsresult result = nsBoxFrame::GetFrameForPoint(aPoint, aFrame);
+  nsresult result = nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
   nsCOMPtr content;
   if (*aFrame) {
     (*aFrame)->GetContent(getter_AddRefs(content));
@@ -621,7 +622,7 @@ nsMenuFrame::Reflow(nsIPresContext&   aPresContext,
   frame->GetRect(rect);
   rect.width = aDesiredSize.width;
   rect.height = aDesiredSize.height;
-  frame->SetRect(rect);
+  frame->SetRect(&aPresContext, rect);
 
   // Don't let it affect our size.
   aDesiredSize.width = w;
diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.h b/mozilla/layout/xul/base/src/nsMenuFrame.h
index a487fefd063..a7702a32f3b 100644
--- a/mozilla/layout/xul/base/src/nsMenuFrame.h
+++ b/mozilla/layout/xul/base/src/nsMenuFrame.h
@@ -81,7 +81,8 @@ public:
   NS_IMETHOD Destroy(nsIPresContext& aPresContext);
 
   // Overridden to prevent events from ever going to children of the menu.
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, 
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint, 
                               nsIFrame**     aFrame);
 
   NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, 
diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp
index cd76f2252ea..156a95f6fe3 100644
--- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -102,6 +102,9 @@ nsMenuPopupFrame::Init(nsIPresContext&  aPresContext,
 {
   nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
 
+  // XXX Hack
+  mPresContext = &aPresContext;
+
   // We default to being vertical.
   nsString value;
   mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value);
@@ -117,12 +120,12 @@ nsMenuPopupFrame::Init(nsIPresContext&  aPresContext,
   // position in the view hierarchy (as the root view).  We do this so that we
   // can draw the menus outside the confines of the window.
   nsIView* ourView;
-  GetView(&ourView);
+  GetView(&aPresContext, &ourView);
 
   nsIFrame* parent;
-  aParent->GetParentWithView(&parent);
+  aParent->GetParentWithView(&aPresContext, &parent);
   nsIView* parentView;
-  parent->GetView(&parentView);
+  parent->GetView(&aPresContext, &parentView);
 
   nsCOMPtr viewManager;
   parentView->GetViewManager(*getter_AddRefs(viewManager));
@@ -180,15 +183,15 @@ nsMenuPopupFrame::GetViewOffset(nsIViewManager* aManager, nsIView* aView,
 }
 
 void
-nsMenuPopupFrame::GetNearestEnclosingView(nsIFrame* aStartFrame, nsIView** aResult)
+nsMenuPopupFrame::GetNearestEnclosingView(nsIPresContext* aPresContext, nsIFrame* aStartFrame, nsIView** aResult)
 {
   *aResult = nsnull;
-  aStartFrame->GetView(aResult);
+  aStartFrame->GetView(aPresContext, aResult);
   if (!*aResult) {
     nsIFrame* parent;
-    aStartFrame->GetParentWithView(&parent);
+    aStartFrame->GetParentWithView(aPresContext, &parent);
     if (parent)
-      parent->GetView(aResult);
+      parent->GetView(aPresContext, aResult);
   }
 }
 
@@ -203,18 +206,18 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext& aPresContext,
 
   //Get the nearest enclosing parent view to aFrame.
   nsIView* parentView = nsnull;
-  GetNearestEnclosingView(aFrame, &parentView);
+  GetNearestEnclosingView(&aPresContext, aFrame, &parentView);
   if (!parentView)
     return NS_OK;
 
   parentView->GetViewManager(*getter_AddRefs(viewManager));
   GetViewOffset(viewManager, parentView, parentPos);
   nsIView* view = nsnull;
-  GetView(&view);
+  GetView(&aPresContext, &view);
 
   nsIView* containingView = nsnull;
   nsPoint offset;
-  aFrame->GetOffsetFromView(offset, &containingView);
+  aFrame->GetOffsetFromView(&aPresContext, offset, &containingView);
   
   nsRect parentRect;
   aFrame->GetRect(parentRect);
@@ -414,11 +417,11 @@ NS_IMETHODIMP nsMenuPopupFrame::SetCurrentMenuItem(nsIMenuFrame* aMenuItem)
 }
 
 NS_IMETHODIMP
-nsMenuPopupFrame::CaptureMouseEvents(PRBool aGrabMouseEvents)
+nsMenuPopupFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
 {
   // get its view
   nsIView* view = nsnull;
-  GetView(&view);
+  GetView(aPresContext, &view);
   nsCOMPtr viewMan;
   PRBool result;
 
@@ -687,7 +690,7 @@ nsMenuPopupFrame::GetWidget(nsIWidget **aWidget)
 {
   // Get parent view
   nsIView * view = nsnull;
-  nsMenuPopupFrame::GetNearestEnclosingView(this, &view);
+  nsMenuPopupFrame::GetNearestEnclosingView(mPresContext, this, &view);
   if (!view)
     return NS_OK;
 
@@ -745,12 +748,14 @@ nsMenuPopupFrame::Destroy(nsIPresContext& aPresContext)
 }
 
 NS_IMETHODIMP
-nsMenuPopupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
+nsMenuPopupFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                   const nsPoint& aPoint,
+                                   nsIFrame** aFrame)
 {
   nsRect rect;
   GetRect(rect);
   if (rect.Contains(aPoint)) {
-    return nsBoxFrame::GetFrameForPoint(aPoint, aFrame);
+    return nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
   }
   
   *aFrame = this;
diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.h b/mozilla/layout/xul/base/src/nsMenuPopupFrame.h
index 932aa195389..c825f270756 100644
--- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.h
+++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.h
@@ -82,15 +82,15 @@ public:
 
   NS_IMETHOD Destroy(nsIPresContext& aPresContext);
 
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame);
 
   void GetViewOffset(nsIViewManager* aManager, nsIView* aView, nsPoint& aPoint);
-  static void GetNearestEnclosingView(nsIFrame* aStartFrame, nsIView** aResult);
+  static void GetNearestEnclosingView(nsIPresContext* aPresContext, nsIFrame* aStartFrame, nsIView** aResult);
 
   nsresult SyncViewWithFrame(nsIPresContext& aPresContext, PRBool aOnMenuBar, 
                              nsIFrame* aFrame, PRInt32 aXPos, PRInt32 aYPos);
 
-  NS_IMETHOD CaptureMouseEvents(PRBool aGrabMouseEvents);
+  NS_IMETHOD CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);
 
   void KeyboardNavigation(PRUint32 aDirection, PRBool& aHandledFlag);
   
@@ -106,6 +106,8 @@ public:
 protected:
   nsIMenuFrame* mCurrentMenu; // The current menu that is active.
   PRBool mIsCapturingMouseEvents; // Whether or not we're grabbing the mouse events.
+  // XXX Hack
+  nsIPresContext* mPresContext;  // weak reference
 }; // class nsMenuPopupFrame
 
 #endif
diff --git a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp
index 1dd525b1e40..6c936888bfe 100644
--- a/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsPopupSetFrame.cpp
@@ -228,7 +228,7 @@ nsPopupSetFrame::Reflow(nsIPresContext&   aPresContext,
   frame->GetRect(rect);
   rect.width = aDesiredSize.width;
   rect.height = aDesiredSize.height;
-  frame->SetRect(rect);
+  frame->SetRect(&aPresContext, rect);
 
   // Don't let it affect our size.
   aDesiredSize.width = w;
diff --git a/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp b/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp
index 9e5bb74999d..862b978a013 100644
--- a/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp
@@ -53,7 +53,7 @@ public:
 
   NS_DECL_ISUPPORTS
 
-  void AddFrame(nsProgressMeterFrame* aFrame);
+  void AddFrame(nsIPresContext* aPresContext, nsProgressMeterFrame* aFrame);
 
   PRBool RemoveFrame(nsProgressMeterFrame* aFrame);
 
@@ -65,6 +65,18 @@ public:
 
   virtual void Notify(nsITimer *timer);
 
+  PRInt32 GetFrameData(nsProgressMeterFrame* aFrame);
+
+  struct FrameData {
+    nsIPresContext*       mPresContext;  // pres context associated with the frame
+    nsProgressMeterFrame* mFrame;
+
+
+    FrameData(nsIPresContext*       aPresContext,
+              nsProgressMeterFrame* aFrame)
+      : mPresContext(aPresContext), mFrame(aFrame) {}
+  };
+
   nsITimer* mTimer;
   nsVoidArray mFrames;
 };
@@ -101,21 +113,44 @@ void StripeTimer::Stop()
 static NS_DEFINE_IID(kITimerCallbackIID, NS_ITIMERCALLBACK_IID);
 NS_IMPL_ISUPPORTS(StripeTimer, kITimerCallbackIID);
 
-void StripeTimer::AddFrame(nsProgressMeterFrame* aFrame) {
+PRInt32 StripeTimer::GetFrameData(nsProgressMeterFrame* aFrame)
+{
+  PRInt32 i, n = mFrames.Count();
+  PRBool rv = PR_FALSE;
+  for (i = 0; i < n; i++) {
+    FrameData* frameData = (FrameData*) mFrames.ElementAt(i);
+
+    if (frameData->mFrame == aFrame) {
+      return i;
+    }
+  }
+
+  return -1;
+}
+
+void StripeTimer::AddFrame(nsIPresContext* aPresContext, nsProgressMeterFrame* aFrame) {
 
   // see if the frame is already here.
-  if (mFrames.IndexOf(aFrame) > -1)
+  if (GetFrameData(aFrame) > -1)
 	  return;
 
   // if not add it.
-  mFrames.AppendElement(aFrame);
+  FrameData* frameData = new FrameData(aPresContext, aFrame);
+  mFrames.AppendElement(frameData);
   if (1 == mFrames.Count()) {
     Start();
   }
 }
 
 PRBool StripeTimer::RemoveFrame(nsProgressMeterFrame* aFrame) {
-  PRBool rv = mFrames.RemoveElement(aFrame);
+  PRBool  rv = PR_FALSE;
+  PRInt32 i = GetFrameData(aFrame);
+
+  if (i > -1) {
+    FrameData*  frameData = (FrameData*)mFrames.ElementAt(i);
+    rv = mFrames.RemoveElementAt(i);
+    delete frameData;
+  }
   if (0 == mFrames.Count()) {
     Stop();
   }
@@ -135,15 +170,15 @@ void StripeTimer::Notify(nsITimer *timer)
 
   PRInt32 i, n = mFrames.Count();
   for (i = 0; i < n; i++) {
-    nsProgressMeterFrame* frame = (nsProgressMeterFrame*) mFrames.ElementAt(i);
-    frame->animate();
+    FrameData*  frameData = (FrameData*) mFrames.ElementAt(i);
+    frameData->mFrame->animate();
 
     // Determine damaged area and tell view manager to redraw it
     nsPoint offset;
     nsRect bounds;
-    frame->GetRect(bounds);
+    frameData->mFrame->GetRect(bounds);
     nsIView* view;
-    frame->GetOffsetFromView(offset, &view);
+    frameData->mFrame->GetOffsetFromView(frameData->mPresContext, offset, &view);
     nsIViewManager* vm;
     view->GetViewManager(vm);
     bounds.x = offset.x;
@@ -619,12 +654,12 @@ nsProgressMeterFrame :: Reflow ( nsIPresContext&          aPresContext,
     // See if it's targeted at us
     aReflowState.reflowCommand->GetTarget(targetFrame);
     if (this == targetFrame) {
-      Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
+      Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
     }
   }
 
   if (mUndetermined)
-     gStripeAnimator->AddFrame(this);
+     gStripeAnimator->AddFrame(&aPresContext, this);
   else 
 	 gStripeAnimator->RemoveFrame(this);
 
@@ -733,7 +768,7 @@ nsProgressMeterFrame::Redraw(nsIPresContext* aPresContext)
    	nsRect frameRect;
 	  GetRect(frameRect);
 	  nsRect rect(0, 0, frameRect.width, frameRect.height);
-    Invalidate(rect, PR_TRUE);
+    Invalidate(aPresContext, rect, PR_TRUE);
 }
 
 
diff --git a/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp b/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp
index 105482992df..754874dbd5e 100644
--- a/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsScrollbarFrame.cpp
@@ -301,7 +301,7 @@ nsScrollbarFrame::Init(nsIPresContext&  aPresContext,
   nsresult  rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
   CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
   nsIView* view;
-  GetView(&view);
+  GetView(&aPresContext, &view);
   view->SetContentTransparency(PR_TRUE);
   return rv;
 }
diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.cpp b/mozilla/layout/xul/base/src/nsSliderFrame.cpp
index 968482ccbe8..76f25986a62 100644
--- a/mozilla/layout/xul/base/src/nsSliderFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsSliderFrame.cpp
@@ -135,8 +135,10 @@ nsSliderFrame::Init(nsIPresContext&  aPresContext,
   nsresult  rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
   CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
   nsIView* view;
-  GetView(&view);
+  GetView(&aPresContext, &view);
   view->SetContentTransparency(PR_TRUE);
+  // XXX Hack
+  mPresContext = &aPresContext;
   return rv;
 }
 
@@ -437,7 +439,7 @@ nsSliderFrame::Reflow(nsIPresContext&   aPresContext,
   else
     thumbRect.y += pos;
 
-  thumbFrame->SetRect(thumbRect);
+  thumbFrame->SetRect(&aPresContext, thumbRect);
 
   // add in our border
   aDesiredSize.width += borderPadding.left + borderPadding.right;
@@ -465,7 +467,7 @@ nsSliderFrame::HandleEvent(nsIPresContext& aPresContext,
 
   PRBool isHorizontal = IsHorizontal(scrollbar);
 
-  if (isDraggingThumb())
+  if (isDraggingThumb(&aPresContext))
   {
     switch (aEvent->message) {
     case NS_MOUSE_MOVE: {
@@ -494,7 +496,7 @@ nsSliderFrame::HandleEvent(nsIPresContext& aPresContext,
           // how much we are scrolled.
           nsIScrollableView* scrollingView;
           nsIView*           view;
-          parent->GetView(&view);
+          parent->GetView(&aPresContext, &view);
           if (view) {
             nsresult result = view->QueryInterface(kScrollViewIID, (void**)&scrollingView);
             if (NS_SUCCEEDED(result)) {
@@ -535,7 +537,7 @@ nsSliderFrame::HandleEvent(nsIPresContext& aPresContext,
        // stop capturing
       //printf("stop capturing\n");
       AddListener();
-      DragThumb(PR_FALSE);
+      DragThumb(&aPresContext, PR_FALSE);
     }
     //return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
     return NS_OK;
@@ -639,14 +641,14 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
        newThumbRect.y = borderPadding.top + nscoord(float(curpospx)*mRatio);
 
     // set the rect
-    thumbFrame->SetRect(newThumbRect);
+    thumbFrame->SetRect(aPresContext, newThumbRect);
     
     // figure out the union of the rect so we know what to redraw
     nsRect changeRect;
     changeRect.UnionRect(thumbRect, newThumbRect);
 
     // redraw just the change
-    Invalidate(changeRect, PR_TRUE);
+    Invalidate(aPresContext, changeRect, PR_TRUE);
 
     if (mScrollbarListener)
       mScrollbarListener->PositionChanged(*aPresContext, mCurPos, curpos);
@@ -680,10 +682,11 @@ nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame,
   
 }
 
-NS_IMETHODIMP  nsSliderFrame::GetFrameForPoint(const nsPoint& aPoint, 
+NS_IMETHODIMP  nsSliderFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                             const nsPoint& aPoint, 
                                              nsIFrame**     aFrame)
 {   
-  if (isDraggingThumb())
+  if (isDraggingThumb(aPresContext))
   {
     *aFrame = this;
     return NS_OK;
@@ -702,7 +705,7 @@ NS_IMETHODIMP  nsSliderFrame::GetFrameForPoint(const nsPoint& aPoint,
 
   return NS_OK;
 
-  //return nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame);
+  //return nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
 }
 
 
@@ -766,7 +769,7 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
   nsCOMPtr uiEvent(do_QueryInterface(aMouseEvent));
 
   RemoveListener();
-  DragThumb(PR_TRUE);
+  DragThumb(mPresContext, PR_TRUE);
   PRInt32 c = 0;
   if (isHorizontal)
      uiEvent->GetClientX(&c);
@@ -797,11 +800,11 @@ nsSliderFrame::MouseUp(nsIDOMEvent* aMouseEvent)
 }
 
 NS_IMETHODIMP
-nsSliderFrame :: DragThumb(PRBool aGrabMouseEvents)
+nsSliderFrame :: DragThumb(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
 {
     // get its view
   nsIView* view = nsnull;
-  GetView(&view);
+  GetView(aPresContext, &view);
   nsCOMPtr viewMan;
   PRBool result;
 
@@ -821,11 +824,11 @@ nsSliderFrame :: DragThumb(PRBool aGrabMouseEvents)
 }
 
 PRBool
-nsSliderFrame :: isDraggingThumb()
+nsSliderFrame :: isDraggingThumb(nsIPresContext* aPresContext)
 {
     // get its view
   nsIView* view = nsnull;
-  GetView(&view);
+  GetView(aPresContext, &view);
   nsCOMPtr viewMan;
   
   if (view) {
diff --git a/mozilla/layout/xul/base/src/nsSliderFrame.h b/mozilla/layout/xul/base/src/nsSliderFrame.h
index fd60c6e639c..a37a20be511 100644
--- a/mozilla/layout/xul/base/src/nsSliderFrame.h
+++ b/mozilla/layout/xul/base/src/nsSliderFrame.h
@@ -106,7 +106,8 @@ public:
                          nsGUIEvent* aEvent,
                          nsEventStatus& aEventStatus);
 
-    NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
+    NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                                const nsPoint& aPoint, nsIFrame** aFrame);
 
     NS_IMETHOD SetInitialChildList(nsIPresContext& aPresContext,
                                  nsIAtom*        aListName,
@@ -208,10 +209,10 @@ private:
   nsIContent* GetScrollBar();
   void PageUpDown(nsIFrame* aThumbFrame, nscoord change);
   void SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, nscoord pos);
-  NS_IMETHOD DragThumb(PRBool aGrabMouseEvents);
+  NS_IMETHOD DragThumb(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);
   void AddListener();
   void RemoveListener();
-  PRBool isDraggingThumb();
+  PRBool isDraggingThumb(nsIPresContext* aPresContext);
 
   float mRatio;
 
@@ -222,6 +223,9 @@ private:
 
   nsIScrollbarListener* mScrollbarListener;
 
+  // XXX Hack
+  nsIPresContext* mPresContext;  // weak reference
+
   static nscoord gChange;
 }; // class nsSliderFrame
 
diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp
index d72ac92bed0..8300f9cc055 100644
--- a/mozilla/layout/xul/base/src/nsSplitterFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsSplitterFrame.cpp
@@ -102,7 +102,8 @@ public:
                     PRInt32 aCount,
                     PRInt32& aSpaceLeft);
 
-  void ResizeChildTo(nscoord& aDiff, 
+  void ResizeChildTo(nsIPresContext* aPresContext,
+                   nscoord& aDiff, 
                    nsSplitterInfo* aChildrenBeforeInfos, 
                    nsSplitterInfo* aChildrenAfterInfos, 
                    PRInt32 aChildrenBeforeCount, 
@@ -122,8 +123,8 @@ public:
   ResizeType GetResizeAfter();
   State GetState();
 
-  nsresult CaptureMouse(PRBool aGrabMouseEvents);
-  PRBool IsMouseCaptured();
+  nsresult CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);
+  PRBool IsMouseCaptured(nsIPresContext* aPresContext);
   void Reverse(nsSplitterInfo*& aIndexes, PRInt32 aCount);
   CollapseDirection GetCollapseDirection();
 
@@ -320,6 +321,9 @@ nsSplitterFrame::Init(nsIPresContext&  aPresContext,
 {
   nsresult  rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
 
+  // XXX Hack because we need the pres context in some of the event handling functions...
+  mPresContext = &aPresContext;
+
   // find the box we are in
   nsIFrame* box = nsnull;
   nsScrollbarButtonFrame::GetParentWithTag(nsXULAtoms::box, this, box);
@@ -343,7 +347,7 @@ nsSplitterFrame::Init(nsIPresContext&  aPresContext,
 
   nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
   nsIView* view;
-  GetView(&view);
+  GetView(&aPresContext, &view);
   view->SetContentTransparency(PR_TRUE);
   view->SetZIndex(kMaxZ);
 /*
@@ -411,16 +415,17 @@ nsSplitterFrame::HandleRelease(nsIPresContext& aPresContext,
   return NS_OK;
 }
 
-NS_IMETHODIMP  nsSplitterFrame::GetFrameForPoint(const nsPoint& aPoint, 
+NS_IMETHODIMP  nsSplitterFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                             const nsPoint& aPoint, 
                                              nsIFrame**     aFrame)
 {   
   // if the mouse is captured always return us as the frame.
-  if (mImpl->IsMouseCaptured())
+  if (mImpl->IsMouseCaptured(aPresContext))
   {
     *aFrame = this;
     return NS_OK;
   } else 
-    return nsBoxFrame::GetFrameForPoint(aPoint, aFrame);
+    return nsBoxFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
 }
 
 NS_IMETHODIMP
@@ -445,10 +450,10 @@ nsSplitterFrame::HandleEvent(nsIPresContext& aPresContext,
 void
 nsSplitterFrameImpl::MouseUp(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
 {
-      if (IsMouseCaptured()) {
+      if (IsMouseCaptured(&aPresContext)) {
           AdjustChildren(aPresContext);
           AddListener();
-          CaptureMouse(PR_FALSE);
+          CaptureMouse(&aPresContext, PR_FALSE);
           mSplitter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "", PR_TRUE);
           mPressed = PR_FALSE;
       }
@@ -457,7 +462,7 @@ nsSplitterFrameImpl::MouseUp(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
 void
 nsSplitterFrameImpl::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
 {
-        if (IsMouseCaptured()) {
+        if (IsMouseCaptured(&aPresContext)) {
           PRBool isHorizontal = !mSplitter->IsHorizontal();
            // convert coord to pixels
           nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;
@@ -481,7 +486,7 @@ nsSplitterFrameImpl::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
               // how much we are scrolled.
               nsIScrollableView* scrollingView;
               nsIView*           view;
-              parent->GetView(&view);
+              parent->GetView(&aPresContext, &view);
               if (view) {
                 nsresult result = view->QueryInterface(kScrollViewIID, (void**)&scrollingView);
                 if (NS_SUCCEEDED(result)) {
@@ -521,7 +526,7 @@ nsSplitterFrameImpl::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
 
 //            nscoord oldPos = pos;
 
-            ResizeChildTo(pos, mChildInfosBefore, mChildInfosAfter, mChildInfosBeforeCount, mChildInfosAfterCount, bounded);
+            ResizeChildTo(&aPresContext, pos, mChildInfosBefore, mChildInfosAfter, mChildInfosBeforeCount, mChildInfosAfterCount, bounded);
 
             /*
             if (oldPos > 0 && oldPos > pos)
@@ -600,11 +605,11 @@ nsSplitterFrameImpl::RemoveListener()
 }
 
 nsresult
-nsSplitterFrameImpl :: CaptureMouse(PRBool aGrabMouseEvents)
+nsSplitterFrameImpl :: CaptureMouse(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
 {
     // get its view
   nsIView* view = nsnull;
-  mSplitter->GetView(&view);
+  mSplitter->GetView(aPresContext, &view);
   nsCOMPtr viewMan;
   PRBool result;
   //nsCOMPtr widget;
@@ -629,11 +634,11 @@ nsSplitterFrameImpl :: CaptureMouse(PRBool aGrabMouseEvents)
 }
 
 PRBool
-nsSplitterFrameImpl :: IsMouseCaptured()
+nsSplitterFrameImpl :: IsMouseCaptured(nsIPresContext* aPresContext)
 {
     // get its view
   nsIView* view = nsnull;
-  mSplitter->GetView(&view);
+  mSplitter->GetView(aPresContext, &view);
   nsCOMPtr viewMan;
   
   if (view) {
@@ -766,7 +771,7 @@ nsSplitterFrameImpl::MouseDown(nsIDOMEvent* aMouseEvent)
 
   nsRect vr(0,0,0,0);
   nsIView *v;
-  mSplitter->GetView(&v);
+  mSplitter->GetView(mSplitter->mPresContext, &v);
   v->GetBounds(vr);
 
   PRInt32 c = 0;
@@ -795,7 +800,7 @@ nsSplitterFrameImpl::MouseMove(nsIDOMEvent* aMouseEvent)
   if (!mPressed)
       return NS_OK;
   
-  if (IsMouseCaptured())
+  if (IsMouseCaptured(mSplitter->mPresContext))
     return NS_OK;
 
  // if (mState == Collapsed)
@@ -805,7 +810,7 @@ nsSplitterFrameImpl::MouseMove(nsIDOMEvent* aMouseEvent)
   mSplitter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "dragging", PR_TRUE);
 
   RemoveListener();
-  CaptureMouse(PR_TRUE);
+  CaptureMouse(mSplitter->mPresContext, PR_TRUE);
 
   return NS_OK;
 }
@@ -1016,7 +1021,8 @@ nsSplitterFrameImpl::AddRemoveSpace(nscoord aDiff,
  */
 
 void
-nsSplitterFrameImpl::ResizeChildTo(nscoord& aDiff, 
+nsSplitterFrameImpl::ResizeChildTo(nsIPresContext* aPresContext,
+                                   nscoord& aDiff, 
                                    nsSplitterInfo* aChildrenBeforeInfos, 
                                    nsSplitterInfo* aChildrenAfterInfos, 
                                    PRInt32 aChildrenBeforeCount, 
@@ -1043,22 +1049,22 @@ nsSplitterFrameImpl::ResizeChildTo(nscoord& aDiff,
   nsRect vr;
   nsCOMPtr vm;
   nsIView *v;
-  mSplitter->GetView(&v);
+  mSplitter->GetView(aPresContext, &v);
   v->GetViewManager(*getter_AddRefs(vm));
   v->GetBounds(vr);
   nsRect invalid;
   if (mParentBox->IsHorizontal()) {
-      mSplitter->MoveTo(mSplitterPos + aDiff, r.y);
+      mSplitter->MoveTo(aPresContext, mSplitterPos + aDiff, r.y);
       vm->MoveViewTo(v, mSplitterViewPos + aDiff, vr.y);
       invalid.UnionRect(r,mSplitter->mRect);
   } else {
-      mSplitter->MoveTo(r.x, mSplitterPos + aDiff);
+      mSplitter->MoveTo(aPresContext, r.x, mSplitterPos + aDiff);
       vm->MoveViewTo(v, vr.x, mSplitterViewPos + aDiff);
       invalid.UnionRect(r,mSplitter->mRect);
   }
 
   // redraw immediately only what changed. This is animation so 
   // it must be immediate.
-  mParentBox->Invalidate(invalid, PR_TRUE);
+  mParentBox->Invalidate(aPresContext, invalid, PR_TRUE);
 }
 
diff --git a/mozilla/layout/xul/base/src/nsSplitterFrame.h b/mozilla/layout/xul/base/src/nsSplitterFrame.h
index a54a0832465..c3d6ba65a7a 100644
--- a/mozilla/layout/xul/base/src/nsSplitterFrame.h
+++ b/mozilla/layout/xul/base/src/nsSplitterFrame.h
@@ -87,13 +87,15 @@ public:
                          nsGUIEvent* aEvent,
                          nsEventStatus& aEventStatus);
 
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame);
 
 
 private:
 
   friend class nsSplitterFrameImpl;
   nsSplitterFrameImpl* mImpl;
+  // XXX Hack
+  nsIPresContext* mPresContext;  // weak reference
 
 }; // class nsSplitterFrame
 
diff --git a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp
index 526d44eb0a0..f69d37a1e1f 100644
--- a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp
@@ -196,11 +196,11 @@ nsTitledButtonFrame::AttributeChanged(nsIPresContext* aPresContext,
       aAttribute == nsHTMLAtoms::value ||
       aAttribute == nsXULAtoms::crop) {
       UpdateAccessUnderline();
-      nsFrame::Invalidate(nsRect(0, 0, mRect.width, mRect.height), PR_FALSE);
+      nsFrame::Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height), PR_FALSE);
   }
 
   // redraw
-  mRenderer->Redraw();
+  mRenderer->Redraw(aPresContext);
 
 #if !ONLOAD_CALLED_TOO_EARLY
   // onload handlers are called to early, so we have to do this code
@@ -906,7 +906,7 @@ nsTitledButtonFrame::Reflow(nsIPresContext&   aPresContext,
     // See if it's targeted at us
     aReflowState.reflowCommand->GetTarget(targetFrame);
     if (this == targetFrame) {
-      Invalidate(nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
+      Invalidate(&aPresContext, nsRect(0,0,mRect.width,mRect.height), PR_FALSE);
     }
   }
 
diff --git a/mozilla/layout/xul/base/src/nsToolbarFrame.cpp b/mozilla/layout/xul/base/src/nsToolbarFrame.cpp
index 0c08aa64b9e..7701386f161 100644
--- a/mozilla/layout/xul/base/src/nsToolbarFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsToolbarFrame.cpp
@@ -309,9 +309,11 @@ nsToolbarFrame :: Paint ( nsIPresContext& aPresContext,
 // Override to process events in our own frame
 //
 NS_IMETHODIMP
-nsToolbarFrame :: GetFrameForPoint ( const nsPoint& aPoint, nsIFrame** aFrame)
+nsToolbarFrame :: GetFrameForPoint ( nsIPresContext* aPresContext,
+                                     const nsPoint& aPoint,
+                                     nsIFrame** aFrame)
 {
-  nsresult retVal = nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame);
+  nsresult retVal = nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
 
   // returning NS_OK means that we tell the frame finding code that we have something
   // and to stop looking elsewhere for a frame.
@@ -392,8 +394,8 @@ nsToolbarFrame::ReResolveStyles(nsIPresContext& aPresContext,
 ////////////////////////////////////////////////////////////////////////
 // This is temporary until the bubling of event for CSS actions work
 ////////////////////////////////////////////////////////////////////////
-static void ForceDrawFrame(nsIFrame * aFrame);
-static void ForceDrawFrame(nsIFrame * aFrame)
+static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame);
+static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame)
 {
   if (aFrame == nsnull) {
     return;
@@ -401,7 +403,7 @@ static void ForceDrawFrame(nsIFrame * aFrame)
   nsRect    rect;
   nsIView * view;
   nsPoint   pnt;
-  aFrame->GetOffsetFromView(pnt, &view);
+  aFrame->GetOffsetFromView(aPresContext, pnt, &view);
   aFrame->GetRect(rect);
   rect.x = pnt.x;
   rect.y = pnt.y;
@@ -430,7 +432,7 @@ nsToolbarFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIContent* a
   nsresult rv = NS_OK;
   
   if ( aAttribute == nsXULAtoms::tbTriggerRepaint )
-    ForceDrawFrame ( this );
+    ForceDrawFrame ( aPresContext, this );
   else if ( aAttribute == nsXULAtoms::tbDropLocationCoord ) {
     nsAutoString attribute;
     aChild->GetAttribute ( kNameSpaceID_None, aAttribute, attribute );
diff --git a/mozilla/layout/xul/base/src/nsToolbarFrame.h b/mozilla/layout/xul/base/src/nsToolbarFrame.h
index eda28313d75..6823b4da623 100644
--- a/mozilla/layout/xul/base/src/nsToolbarFrame.h
+++ b/mozilla/layout/xul/base/src/nsToolbarFrame.h
@@ -71,7 +71,8 @@ public:
                     nsFramePaintLayer aWhichLayer);
 
     // nsFrame overrides
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint, // Overridden to capture events
                               nsIFrame**     aFrame);
   NS_IMETHOD  HandleEvent(nsIPresContext& aPresContext, 
                           nsGUIEvent*     aEvent,
diff --git a/mozilla/layout/xul/base/src/nsToolboxFrame.cpp b/mozilla/layout/xul/base/src/nsToolboxFrame.cpp
index 455c48176b6..ea30207e056 100644
--- a/mozilla/layout/xul/base/src/nsToolboxFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsToolboxFrame.cpp
@@ -593,10 +593,11 @@ nsToolboxFrame::GetInset(nsMargin& margin)
 // Override to process events in our own frame
 //
 NS_IMETHODIMP
-nsToolboxFrame :: GetFrameForPoint(const nsPoint& aPoint, 
-                                  nsIFrame**     aFrame)
+nsToolboxFrame :: GetFrameForPoint(nsIPresContext* aPresContext,
+                                   const nsPoint& aPoint, 
+                                   nsIFrame**     aFrame)
 {
-  nsresult retVal = nsHTMLContainerFrame::GetFrameForPoint(aPoint, aFrame);
+  nsresult retVal = nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
 
   // returning NS_OK means that we tell the frame finding code that we have something
   // and to stop looking elsewhere for a frame.
@@ -631,15 +632,15 @@ nsToolboxFrame :: HandleEvent ( nsIPresContext& aPresContext,
       break;
 
     case NS_MOUSE_LEFT_BUTTON_UP:
-      OnMouseLeftClick ( aEvent->point );
+      OnMouseLeftClick ( &aPresContext, aEvent->point );
       break;
     
     case NS_MOUSE_MOVE:
-      OnMouseMove ( aEvent->point );
+      OnMouseMove ( &aPresContext, aEvent->point );
       break;
       
     case NS_MOUSE_EXIT:
-      OnMouseExit ( );
+      OnMouseExit ( &aPresContext);
       break;
 
     default:
@@ -659,11 +660,11 @@ nsToolboxFrame :: HandleEvent ( nsIPresContext& aPresContext,
 // frame's local coordinate system.
 // 
 void
-nsToolboxFrame :: ConvertToLocalPoint ( nsPoint & ioPoint )
+nsToolboxFrame :: ConvertToLocalPoint ( nsIPresContext* aPresContext, nsPoint & ioPoint )
 {
   nsIView* view = nsnull;             // note: |view| not AddRef'd
   nsPoint offset; 
-  if ( GetOffsetFromView(offset, &view) == NS_OK )
+  if ( GetOffsetFromView(aPresContext, offset, &view) == NS_OK )
     ioPoint -= offset;
 
 } // ConvertToLocalPoint
@@ -676,10 +677,10 @@ nsToolboxFrame :: ConvertToLocalPoint ( nsPoint & ioPoint )
 // is not in local frame coordinates.
 //
 void
-nsToolboxFrame :: OnMouseMove ( nsPoint & aMouseLoc )
+nsToolboxFrame :: OnMouseMove ( nsIPresContext* aPresContext, nsPoint & aMouseLoc )
 {
   nsPoint localMouseLoc = aMouseLoc;
-  ConvertToLocalPoint ( localMouseLoc );
+  ConvertToLocalPoint ( aPresContext, localMouseLoc );
     
   for ( int i = 0; i < mGrippies.Count(); ++i ) {
     TabInfo* currGrippy = NS_STATIC_CAST(TabInfo*, mGrippies[i]);
@@ -688,12 +689,12 @@ nsToolboxFrame :: OnMouseMove ( nsPoint & aMouseLoc )
         // unhilight the old one
         if ( mGrippyHilighted != kNoGrippyHilighted ) {
           TabInfo* hilightedGrippy = NS_STATIC_CAST(TabInfo*, mGrippies[mGrippyHilighted]);
-          Invalidate ( hilightedGrippy->mBoundingRect, PR_FALSE );
+          Invalidate ( aPresContext, hilightedGrippy->mBoundingRect, PR_FALSE );
 	    }
 	    		
         // hilight the new one and remember it
         mGrippyHilighted = i;
-        Invalidate ( currGrippy->mBoundingRect, PR_FALSE );
+        Invalidate ( aPresContext, currGrippy->mBoundingRect, PR_FALSE );
       } // if in a new tab
     }
   } // for each toolbar
@@ -708,10 +709,10 @@ nsToolboxFrame :: OnMouseMove ( nsPoint & aMouseLoc )
 // is not in local frame coordinates.
 //
 void
-nsToolboxFrame :: OnMouseLeftClick ( nsPoint & aMouseLoc )
+nsToolboxFrame :: OnMouseLeftClick ( nsIPresContext* aPresContext, nsPoint & aMouseLoc )
 {
   nsPoint localMouseLoc = aMouseLoc;
-  ConvertToLocalPoint ( localMouseLoc );
+  ConvertToLocalPoint ( aPresContext, localMouseLoc );
   
   for ( int i = 0; i < mGrippies.Count(); ++i ) {
     TabInfo* currGrippy = NS_STATIC_CAST(TabInfo*, mGrippies[i]);			
@@ -738,11 +739,11 @@ nsToolboxFrame :: OnMouseLeftClick ( nsPoint & aMouseLoc )
 // manager.
 //
 void
-nsToolboxFrame :: OnMouseExit ( )
+nsToolboxFrame :: OnMouseExit (nsIPresContext* aPresContext)
 {
 	if ( mGrippyHilighted != kNoGrippyHilighted ) {
 	    TabInfo* hilightedGrippy = NS_STATIC_CAST(TabInfo*, mGrippies[mGrippyHilighted]);
-		Invalidate ( hilightedGrippy->mBoundingRect, PR_FALSE );
+		Invalidate ( aPresContext, hilightedGrippy->mBoundingRect, PR_FALSE );
 		mGrippyHilighted = kNoGrippyHilighted;
 	}
 
diff --git a/mozilla/layout/xul/base/src/nsToolboxFrame.h b/mozilla/layout/xul/base/src/nsToolboxFrame.h
index cf4d71fb4be..1d1587e8db8 100644
--- a/mozilla/layout/xul/base/src/nsToolboxFrame.h
+++ b/mozilla/layout/xul/base/src/nsToolboxFrame.h
@@ -83,7 +83,8 @@ public:
                                         nsIStyleContext* aStyleContext);
  
     // Overridden to capture events
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint,
                               nsIFrame**     aFrame);
 
 /*BEGIN implementations of dragevent handler interface*/
@@ -138,10 +139,10 @@ protected:
   void CollapseToolbar ( TabInfo & inTab ) ; 
   void ExpandToolbar ( TabInfo & inTab ) ; 
 
-  void ConvertToLocalPoint ( nsPoint & ioPoint ) ;
-  void OnMouseMove ( nsPoint & aMouseLoc ) ;
-  void OnMouseExit ( ) ;
-  void OnMouseLeftClick ( nsPoint & aMouseLoc ) ;
+  void ConvertToLocalPoint ( nsIPresContext* aPresContext, nsPoint & ioPoint ) ;
+  void OnMouseMove ( nsIPresContext* aPresContext, nsPoint & aMouseLoc ) ;
+  void OnMouseExit ( nsIPresContext* aPresContext ) ;
+  void OnMouseLeftClick ( nsIPresContext* aPresContext, nsPoint & aMouseLoc ) ;
 
     // utility routines
   TabInfo* FindGrippyForToolbar ( nsVoidArray & inList, const nsIContent* inContent ) const ;
diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp
index 44e872232d2..b6a9ccbbbf2 100644
--- a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp
@@ -150,16 +150,17 @@ NS_METHOD nsTreeCellFrame::Reflow(nsIPresContext& aPresContext,
 }
 
 NS_IMETHODIMP
-nsTreeCellFrame::GetFrameForPoint(const nsPoint& aPoint, 
+nsTreeCellFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                  const nsPoint& aPoint, 
                                   nsIFrame**     aFrame)
 {
   if (mAllowEvents)
   {
-	  return nsTableCellFrame::GetFrameForPoint(aPoint, aFrame);
+	  return nsTableCellFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
   }
   else
   {
-    nsresult result = nsTableCellFrame::GetFrameForPoint(aPoint, aFrame);
+    nsresult result = nsTableCellFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
     nsCOMPtr content;
     if (*aFrame) {
       (*aFrame)->GetContent(getter_AddRefs(content));
@@ -212,7 +213,7 @@ nsTreeCellFrame::HandleMouseDownEvent(nsIPresContext& aPresContext,
       nsIFrame* frame;
       GetParent(&frame);
       nsTreeRowFrame* treeRow = (nsTreeRowFrame*)frame;
-      treeRow->HeaderDrag(PR_TRUE);
+      treeRow->HeaderDrag(&aPresContext, PR_TRUE);
 
       // Inform the tree row of the flexing column
       treeRow->SetFlexingColumn(leftFlex);
diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.h b/mozilla/layout/xul/base/src/nsTreeCellFrame.h
index 2e7917e9ea0..6acb0a1e427 100644
--- a/mozilla/layout/xul/base/src/nsTreeCellFrame.h
+++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.h
@@ -32,7 +32,8 @@ public:
                               PRInt32 aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32 aHint);
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint, // Overridden to capture events
                               nsIFrame**     aFrame);
 
   NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
diff --git a/mozilla/layout/xul/base/src/nsTreeRowFrame.cpp b/mozilla/layout/xul/base/src/nsTreeRowFrame.cpp
index ac28186b4f2..1953a4fd85e 100644
--- a/mozilla/layout/xul/base/src/nsTreeRowFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsTreeRowFrame.cpp
@@ -123,7 +123,7 @@ nsTreeRowFrame::Init(nsIPresContext&  aPresContext,
         // headers get their own views, so that they can capture events
         CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
         nsIView* view;
-        GetView(&view);
+        GetView(&aPresContext, &view);
         view->SetContentTransparency(PR_TRUE);
 			}
 			else 
@@ -143,11 +143,11 @@ nsTreeRowFrame::Init(nsIPresContext&  aPresContext,
 }
 
 NS_IMETHODIMP
-nsTreeRowFrame::HeaderDrag(PRBool aGrabMouseEvents)
+nsTreeRowFrame::HeaderDrag(nsIPresContext* aPresContext, PRBool aGrabMouseEvents)
 {
     // get its view
   nsIView* view = nsnull;
-  GetView(&view);
+  GetView(aPresContext, &view);
   nsCOMPtr viewMan;
   PRBool result;
 
@@ -207,7 +207,7 @@ nsTreeRowFrame::HandleMouseUpEvent(nsIPresContext& aPresContext,
 									                  nsEventStatus&  aEventStatus)
 {
   if (DraggingHeader()) {
-    HeaderDrag(PR_FALSE);
+    HeaderDrag(&aPresContext, PR_FALSE);
   }
   return NS_OK;
 }
@@ -226,10 +226,11 @@ nsTreeRowFrame::HandleEvent(nsIPresContext& aPresContext,
 }
 
 NS_IMETHODIMP
-nsTreeRowFrame::GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events
+nsTreeRowFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                 const nsPoint& aPoint, // Overridden to capture events
                                  nsIFrame**     aFrame)
 {
-  nsresult rv = nsTableRowFrame::GetFrameForPoint(aPoint, aFrame);
+  nsresult rv = nsTableRowFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
   if (mDraggingHeader) {
     mHitFrame = *aFrame;
     *aFrame = this;
diff --git a/mozilla/layout/xul/base/src/nsTreeRowFrame.h b/mozilla/layout/xul/base/src/nsTreeRowFrame.h
index 25ea94d8136..9551ef63775 100644
--- a/mozilla/layout/xul/base/src/nsTreeRowFrame.h
+++ b/mozilla/layout/xul/base/src/nsTreeRowFrame.h
@@ -47,7 +47,8 @@ public:
                   nsIStyleContext* aContext,
                   nsIFrame*        aPrevInFlow); // Overridden to set whether we're a column header 
 
-  NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events
+  NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
+                              const nsPoint& aPoint, // Overridden to capture events
                               nsIFrame**     aFrame);
 
   NS_IMETHOD HandleEvent(nsIPresContext& aPresContext,
@@ -66,7 +67,7 @@ public:
                                      nsPoint&        aPoint,
                                      PRInt32&        aCursor);
 
-  NS_IMETHOD HeaderDrag(PRBool aGrabber);
+  NS_IMETHOD HeaderDrag(nsIPresContext* aPresContext, PRBool aGrabber);
   PRBool DraggingHeader() { return mDraggingHeader; };
 
   void SetFlexingColumn(nsTableColFrame* aTableColFrame) { mFlexingCol = aTableColFrame; };
diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp
index 20536ba4b8f..2d2511d2773 100644
--- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp
+++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp
@@ -697,7 +697,9 @@ PRBool nsTreeRowGroupFrame::RowGroupReceivesExcessSpace()
 }
 
 NS_IMETHODIMP
-nsTreeRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
+nsTreeRowGroupFrame::GetFrameForPoint(nsIPresContext* aPresContext,
+                                      const nsPoint& aPoint,
+                                      nsIFrame** aFrame)
 {
   nsPoint tmp;
   nsRect kidRect;
@@ -705,11 +707,11 @@ nsTreeRowGroupFrame::GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame)
     mScrollbar->GetRect(kidRect);
     if (kidRect.Contains(aPoint)) {
       tmp.MoveTo(aPoint.x - kidRect.x, aPoint.y - kidRect.y);
-      return mScrollbar->GetFrameForPoint(tmp, aFrame);
+      return mScrollbar->GetFrameForPoint(aPresContext, tmp, aFrame);
     }
   }
 
-  return nsTableRowGroupFrame::GetFrameForPoint(aPoint, aFrame);
+  return nsTableRowGroupFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
 }
 
 NS_IMETHODIMP
@@ -748,7 +750,7 @@ void nsTreeRowGroupFrame::PaintChildren(nsIPresContext&      aPresContext,
   if (mScrollbar) {
     nsIView *pView;
      
-    mScrollbar->GetView(&pView);
+    mScrollbar->GetView(&aPresContext, &pView);
     if (nsnull == pView) {
       PRBool clipState;
       nsRect kidRect;
@@ -806,7 +808,7 @@ nsTreeRowGroupFrame::IR_TargetIsChild(nsIPresContext&      aPresContext,
 
     // Place the child
     nsRect kidRect (xpos, 0, desiredSize.width, mRowGroupHeight);
-    mScrollbar->SetRect(kidRect);
+    mScrollbar->SetRect(&aPresContext, kidRect);
 
     // Return our desired width
     aDesiredSize.width = aReflowState.reflowState.availableWidth;
@@ -930,7 +932,7 @@ nsTreeRowGroupFrame::ReflowAfterRowLayout(nsIPresContext&       aPresContext,
 
     // Place the child
     nsRect kidRect (xpos, 0, desiredSize.width, mRowGroupHeight);
-    mScrollbar->SetRect(kidRect);
+    mScrollbar->SetRect(&aPresContext, kidRect);
   }
   return rv;
 }
diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h
index 8ed534b50f2..9ff98044e4e 100644
--- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h
+++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h
@@ -48,7 +48,7 @@ public:
   NS_IMETHOD  TreeInsertFrames(nsIFrame*       aPrevFrame,
                                nsIFrame*       aFrameList);
 
-  NS_IMETHOD  GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame);
+  NS_IMETHOD  GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame);
   void PaintChildren(nsIPresContext&      aPresContext,
                      nsIRenderingContext& aRenderingContext,
                      const nsRect&        aDirtyRect,
diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp
index 54f38d5ee82..57bc56f7e4c 100644
--- a/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp
+++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.cpp
@@ -2754,7 +2754,11 @@ DumpFramesRecurse(nsIWebShell* aWebShell, FILE* out, nsString *aFilterName)
       nsIFrame* root;
       shell->GetRootFrame(&root);
       if (nsnull != root) {
-        root->List(out, 0);
+        nsIPresContext* presContext;
+        shell->GetPresContext(&presContext);
+
+        root->List(presContext, out, 0);
+        NS_IF_RELEASE(presContext);
       }
       NS_RELEASE(shell);
     }