diff --git a/mozilla/layout/forms/nsButtonFrameRenderer.cpp b/mozilla/layout/forms/nsButtonFrameRenderer.cpp index eea7887bae9..92fe38b64f4 100644 --- a/mozilla/layout/forms/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/forms/nsButtonFrameRenderer.cpp @@ -400,16 +400,18 @@ nsButtonFrameRenderer::GetStyleContext(PRInt32 aIndex, nsIStyleContext** aStyleC switch (aIndex) { case NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX: *aStyleContext = mOutlineStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: *aStyleContext = mInnerFocusStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; case NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX: *aStyleContext = mOuterFocusStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; + default: + return NS_ERROR_INVALID_ARG; } return NS_OK; } diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp index 52e0481598a..b1fd132f81d 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp @@ -70,8 +70,10 @@ nsGfxRadioControlFrame::GetAdditionalStyleContext(PRInt32 aIndex, switch (aIndex) { case NS_GFX_RADIO_CONTROL_FRAME_FACE_CONTEXT_INDEX: *aStyleContext = mRadioButtonFaceStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; + default: + return NS_ERROR_INVALID_ARG; } return NS_OK; } @@ -94,41 +96,6 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, } -NS_IMETHODIMP -nsGfxRadioControlFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // this re-resolves |mStyleContext|, so it may change - nsresult rv = Inherited::ReResolveStyleContext(aPresContext, aParentContext, aParentChange, - aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { // frame style changed - if (aLocalChange) { - aParentChange = *aLocalChange; // tell children about or change - } - } - - // see if the outline has changed. - nsCOMPtr oldRadioButtonFaceStyle = mRadioButtonFaceStyle; - aPresContext->ProbePseudoStyleContextFor(mContent, nsHTMLAtoms::radioPseudo, mStyleContext, - PR_FALSE, - &mRadioButtonFaceStyle); - - if ((mRadioButtonFaceStyle && oldRadioButtonFaceStyle.get()) && (mRadioButtonFaceStyle != oldRadioButtonFaceStyle.get())) { - nsRadioControlFrame::CaptureStyleChangeFor(this, oldRadioButtonFaceStyle, mRadioButtonFaceStyle, - aParentChange, aChangeList, aLocalChange); - } - - return rv; -} - - NS_IMETHODIMP nsGfxRadioControlFrame::SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext) { diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.h b/mozilla/layout/forms/nsGfxRadioControlFrame.h index 3a3bd312f07..553add19e3e 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.h +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.h @@ -44,12 +44,6 @@ public: nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange); - // // XXX: The following paint methods are TEMPORARY. It is being used to get printing working // under windows. Later it may be used to GFX-render the controls to the display. diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 97e48bd19a4..a2d15747efb 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -647,33 +647,6 @@ nsHTMLButtonControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, return mRenderer.SetStyleContext(aIndex, aStyleContext); } -// -// ReResolveStyleContext -// -// When the style context changes, make sure that all of our styles are still up to date. -// -NS_IMETHODIMP -nsHTMLButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext, - PRInt32 aParentChange, nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // this re-resolves |mStyleContext|, so it may change - nsresult rv = nsHTMLContainerFrame::ReResolveStyleContext(aPresContext, aParentContext, - aParentChange, aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { // frame style changed - if (aLocalChange) { - aParentChange = *aLocalChange; // tell children about or change - } - } - mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange); - - return rv; - -} // ReResolveStyleContext NS_IMETHODIMP nsHTMLButtonControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight) { diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.h b/mozilla/layout/forms/nsHTMLButtonControlFrame.h index 53dad01cdd0..ed56614886a 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.h @@ -91,12 +91,6 @@ public: nsIStyleContext** aStyleContext) const; NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) ; - NS_IMETHOD GetFrameName(nsString& aResult) const { diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index e034bb65e58..9b334624c56 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -1011,114 +1011,6 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } -static nsresult -ReResolveLineList(nsIPresContext* aPresContext, - nsLineBox* aLine, - nsIStyleContext* aStyleContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList) -{ - nsresult rv = NS_OK; - PRInt32 childChange; - while (nsnull != aLine) { - nsIFrame* child = aLine->mFirstChild; - PRInt32 n = aLine->mChildCount; - while ((--n >= 0) && NS_SUCCEEDED(rv)) { - rv = child->ReResolveStyleContext(aPresContext, aStyleContext, - aParentChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - aLine = aLine->mNext; - } - return rv; -} - -NS_IMETHODIMP -nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // NOTE: using nsFrame's ReResolveStyleContext method to avoid - // version in container frame that will do our children - PRInt32 ourChange = aParentChange; - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, - &ourChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - if (aLocalChange) { - *aLocalChange = ourChange; - } - - // Update the child frames on each line - rv = ReResolveLineList(aPresContext, mLines, mStyleContext, - ourChange, aChangeList); - - // Update any overflow lines too - if (NS_SUCCEEDED(rv) && (nsnull != mOverflowLines)) { - rv = ReResolveLineList(aPresContext, mOverflowLines, mStyleContext, - ourChange, aChangeList); - } - - // Just in case, we update the prev-in-flow's overflow lines too - // XXX try to make this go away.... - if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) { - nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines; - if (nsnull != lines) { - rv = ReResolveLineList(aPresContext, lines, mStyleContext, - ourChange, aChangeList); - } - } - - // Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - GetAdditionalChildListName(listIndex++, &childList); - while (childList) { - nsIFrame* child = nsnull; - rv = FirstChild(childList, &child); - while ((NS_SUCCEEDED(rv)) && (child)) { - rv = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } - } - -#ifdef BLOCK_DOES_FIRST_LINE - // It is possible that we just acquired first-line style. See if - // this is the case, and if so, fix things up. - if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) { - nsCOMPtr fls(getter_AddRefs(GetFirstLineStyle(aPresContext))); - if (fls) { - // Now we do have first-line style. Therefore we need to wrap up - // the inline-frames in a first-line frame. - mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE; - WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes - - // Force a reflow so that the first-line is reflowed properly - aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW); - if (ourChange < NS_STYLE_HINT_REFLOW) { - ourChange = NS_STYLE_HINT_REFLOW; - } - if (aLocalChange) { - *aLocalChange = ourChange; - } - } - } -#endif - return rv; -} - NS_IMETHODIMP nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const { diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index 14c35392685..07dbc04220d 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -88,11 +88,6 @@ public: nsIAtom** aListName) const; NS_IMETHOD Destroy(nsIPresContext& aPresContext); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; - NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange); NS_IMETHOD IsPercentageBase(PRBool& aBase) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/generic/nsBlockReflowState.cpp b/mozilla/layout/generic/nsBlockReflowState.cpp index e034bb65e58..9b334624c56 100644 --- a/mozilla/layout/generic/nsBlockReflowState.cpp +++ b/mozilla/layout/generic/nsBlockReflowState.cpp @@ -1011,114 +1011,6 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } -static nsresult -ReResolveLineList(nsIPresContext* aPresContext, - nsLineBox* aLine, - nsIStyleContext* aStyleContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList) -{ - nsresult rv = NS_OK; - PRInt32 childChange; - while (nsnull != aLine) { - nsIFrame* child = aLine->mFirstChild; - PRInt32 n = aLine->mChildCount; - while ((--n >= 0) && NS_SUCCEEDED(rv)) { - rv = child->ReResolveStyleContext(aPresContext, aStyleContext, - aParentChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - aLine = aLine->mNext; - } - return rv; -} - -NS_IMETHODIMP -nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // NOTE: using nsFrame's ReResolveStyleContext method to avoid - // version in container frame that will do our children - PRInt32 ourChange = aParentChange; - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, - &ourChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - if (aLocalChange) { - *aLocalChange = ourChange; - } - - // Update the child frames on each line - rv = ReResolveLineList(aPresContext, mLines, mStyleContext, - ourChange, aChangeList); - - // Update any overflow lines too - if (NS_SUCCEEDED(rv) && (nsnull != mOverflowLines)) { - rv = ReResolveLineList(aPresContext, mOverflowLines, mStyleContext, - ourChange, aChangeList); - } - - // Just in case, we update the prev-in-flow's overflow lines too - // XXX try to make this go away.... - if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) { - nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines; - if (nsnull != lines) { - rv = ReResolveLineList(aPresContext, lines, mStyleContext, - ourChange, aChangeList); - } - } - - // Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - GetAdditionalChildListName(listIndex++, &childList); - while (childList) { - nsIFrame* child = nsnull; - rv = FirstChild(childList, &child); - while ((NS_SUCCEEDED(rv)) && (child)) { - rv = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } - } - -#ifdef BLOCK_DOES_FIRST_LINE - // It is possible that we just acquired first-line style. See if - // this is the case, and if so, fix things up. - if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) { - nsCOMPtr fls(getter_AddRefs(GetFirstLineStyle(aPresContext))); - if (fls) { - // Now we do have first-line style. Therefore we need to wrap up - // the inline-frames in a first-line frame. - mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE; - WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes - - // Force a reflow so that the first-line is reflowed properly - aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW); - if (ourChange < NS_STYLE_HINT_REFLOW) { - ourChange = NS_STYLE_HINT_REFLOW; - } - if (aLocalChange) { - *aLocalChange = ourChange; - } - } - } -#endif - return rv; -} - NS_IMETHODIMP nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const { diff --git a/mozilla/layout/generic/nsBlockReflowState.h b/mozilla/layout/generic/nsBlockReflowState.h index e034bb65e58..9b334624c56 100644 --- a/mozilla/layout/generic/nsBlockReflowState.h +++ b/mozilla/layout/generic/nsBlockReflowState.h @@ -1011,114 +1011,6 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } -static nsresult -ReResolveLineList(nsIPresContext* aPresContext, - nsLineBox* aLine, - nsIStyleContext* aStyleContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList) -{ - nsresult rv = NS_OK; - PRInt32 childChange; - while (nsnull != aLine) { - nsIFrame* child = aLine->mFirstChild; - PRInt32 n = aLine->mChildCount; - while ((--n >= 0) && NS_SUCCEEDED(rv)) { - rv = child->ReResolveStyleContext(aPresContext, aStyleContext, - aParentChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - aLine = aLine->mNext; - } - return rv; -} - -NS_IMETHODIMP -nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // NOTE: using nsFrame's ReResolveStyleContext method to avoid - // version in container frame that will do our children - PRInt32 ourChange = aParentChange; - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, - &ourChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - if (aLocalChange) { - *aLocalChange = ourChange; - } - - // Update the child frames on each line - rv = ReResolveLineList(aPresContext, mLines, mStyleContext, - ourChange, aChangeList); - - // Update any overflow lines too - if (NS_SUCCEEDED(rv) && (nsnull != mOverflowLines)) { - rv = ReResolveLineList(aPresContext, mOverflowLines, mStyleContext, - ourChange, aChangeList); - } - - // Just in case, we update the prev-in-flow's overflow lines too - // XXX try to make this go away.... - if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) { - nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines; - if (nsnull != lines) { - rv = ReResolveLineList(aPresContext, lines, mStyleContext, - ourChange, aChangeList); - } - } - - // Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - GetAdditionalChildListName(listIndex++, &childList); - while (childList) { - nsIFrame* child = nsnull; - rv = FirstChild(childList, &child); - while ((NS_SUCCEEDED(rv)) && (child)) { - rv = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } - } - -#ifdef BLOCK_DOES_FIRST_LINE - // It is possible that we just acquired first-line style. See if - // this is the case, and if so, fix things up. - if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) { - nsCOMPtr fls(getter_AddRefs(GetFirstLineStyle(aPresContext))); - if (fls) { - // Now we do have first-line style. Therefore we need to wrap up - // the inline-frames in a first-line frame. - mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE; - WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes - - // Force a reflow so that the first-line is reflowed properly - aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW); - if (ourChange < NS_STYLE_HINT_REFLOW) { - ourChange = NS_STYLE_HINT_REFLOW; - } - if (aLocalChange) { - *aLocalChange = ourChange; - } - } - } -#endif - return rv; -} - NS_IMETHODIMP nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const { diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index e70f4e98deb..8e88c244ea2 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -141,73 +141,6 @@ nsContainerFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const } } -///////////////////////////////////////////////////////////////////////////// -// Style support - -NS_IMETHODIMP -nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - PRInt32 ourChange = aParentChange; - nsresult result = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, &ourChange); - if (NS_FAILED(result)) { - return result; - } - - if (aLocalChange) { - *aLocalChange = ourChange; - } - - if (NS_COMFALSE != result) { - // Update all children since our context changed - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - nsIFrame* child; - - do { - child = nsnull; - result = FirstChild(childList, &child); - while ((NS_SUCCEEDED(result)) && (child)) { - result = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } while (childList); - - // Update overflow list too (XXX this is not just another child list?) - child = mOverflowFrames.FirstChild(); - while ((NS_SUCCEEDED(result)) && (nsnull != child)) { - result = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - // And just to be complete, update our prev-in-flows overflow list - // too (since in theory, those frames will become our frames) - // XXX Eeek, this is potentially re-resolving these frames twice, can this be optimized? - // Better yet, this should just go away, overflow push/pull code should re-resolve - // as needed for parent changes - if (nsnull != mPrevInFlow) { - child = ((nsContainerFrame*)mPrevInFlow)->mOverflowFrames.FirstChild(); - while ((NS_SUCCEEDED(result)) && (nsnull != child)) { - result = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - } - - } - return result; -} - ///////////////////////////////////////////////////////////////////////////// // Painting/Events diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index 1988c99b8d2..710407bc6ed 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -39,11 +39,6 @@ public: nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); - NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange); NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, nsIAtom* aListName, diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index e034bb65e58..9b334624c56 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -1011,114 +1011,6 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } -static nsresult -ReResolveLineList(nsIPresContext* aPresContext, - nsLineBox* aLine, - nsIStyleContext* aStyleContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList) -{ - nsresult rv = NS_OK; - PRInt32 childChange; - while (nsnull != aLine) { - nsIFrame* child = aLine->mFirstChild; - PRInt32 n = aLine->mChildCount; - while ((--n >= 0) && NS_SUCCEEDED(rv)) { - rv = child->ReResolveStyleContext(aPresContext, aStyleContext, - aParentChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - aLine = aLine->mNext; - } - return rv; -} - -NS_IMETHODIMP -nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // NOTE: using nsFrame's ReResolveStyleContext method to avoid - // version in container frame that will do our children - PRInt32 ourChange = aParentChange; - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, - &ourChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - if (aLocalChange) { - *aLocalChange = ourChange; - } - - // Update the child frames on each line - rv = ReResolveLineList(aPresContext, mLines, mStyleContext, - ourChange, aChangeList); - - // Update any overflow lines too - if (NS_SUCCEEDED(rv) && (nsnull != mOverflowLines)) { - rv = ReResolveLineList(aPresContext, mOverflowLines, mStyleContext, - ourChange, aChangeList); - } - - // Just in case, we update the prev-in-flow's overflow lines too - // XXX try to make this go away.... - if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) { - nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines; - if (nsnull != lines) { - rv = ReResolveLineList(aPresContext, lines, mStyleContext, - ourChange, aChangeList); - } - } - - // Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - GetAdditionalChildListName(listIndex++, &childList); - while (childList) { - nsIFrame* child = nsnull; - rv = FirstChild(childList, &child); - while ((NS_SUCCEEDED(rv)) && (child)) { - rv = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } - } - -#ifdef BLOCK_DOES_FIRST_LINE - // It is possible that we just acquired first-line style. See if - // this is the case, and if so, fix things up. - if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) { - nsCOMPtr fls(getter_AddRefs(GetFirstLineStyle(aPresContext))); - if (fls) { - // Now we do have first-line style. Therefore we need to wrap up - // the inline-frames in a first-line frame. - mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE; - WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes - - // Force a reflow so that the first-line is reflowed properly - aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW); - if (ourChange < NS_STYLE_HINT_REFLOW) { - ourChange = NS_STYLE_HINT_REFLOW; - } - if (aLocalChange) { - *aLocalChange = ourChange; - } - } - } -#endif - return rv; -} - NS_IMETHODIMP nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const { diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index 14c35392685..07dbc04220d 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -88,11 +88,6 @@ public: nsIAtom** aListName) const; NS_IMETHOD Destroy(nsIPresContext& aPresContext); NS_IMETHOD IsSplittable(nsSplittableType& aIsSplittable) const; - NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange); NS_IMETHOD IsPercentageBase(PRBool& aBase) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.cpp b/mozilla/layout/html/base/src/nsBlockReflowState.cpp index e034bb65e58..9b334624c56 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.cpp +++ b/mozilla/layout/html/base/src/nsBlockReflowState.cpp @@ -1011,114 +1011,6 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } -static nsresult -ReResolveLineList(nsIPresContext* aPresContext, - nsLineBox* aLine, - nsIStyleContext* aStyleContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList) -{ - nsresult rv = NS_OK; - PRInt32 childChange; - while (nsnull != aLine) { - nsIFrame* child = aLine->mFirstChild; - PRInt32 n = aLine->mChildCount; - while ((--n >= 0) && NS_SUCCEEDED(rv)) { - rv = child->ReResolveStyleContext(aPresContext, aStyleContext, - aParentChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - aLine = aLine->mNext; - } - return rv; -} - -NS_IMETHODIMP -nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // NOTE: using nsFrame's ReResolveStyleContext method to avoid - // version in container frame that will do our children - PRInt32 ourChange = aParentChange; - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, - &ourChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - if (aLocalChange) { - *aLocalChange = ourChange; - } - - // Update the child frames on each line - rv = ReResolveLineList(aPresContext, mLines, mStyleContext, - ourChange, aChangeList); - - // Update any overflow lines too - if (NS_SUCCEEDED(rv) && (nsnull != mOverflowLines)) { - rv = ReResolveLineList(aPresContext, mOverflowLines, mStyleContext, - ourChange, aChangeList); - } - - // Just in case, we update the prev-in-flow's overflow lines too - // XXX try to make this go away.... - if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) { - nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines; - if (nsnull != lines) { - rv = ReResolveLineList(aPresContext, lines, mStyleContext, - ourChange, aChangeList); - } - } - - // Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - GetAdditionalChildListName(listIndex++, &childList); - while (childList) { - nsIFrame* child = nsnull; - rv = FirstChild(childList, &child); - while ((NS_SUCCEEDED(rv)) && (child)) { - rv = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } - } - -#ifdef BLOCK_DOES_FIRST_LINE - // It is possible that we just acquired first-line style. See if - // this is the case, and if so, fix things up. - if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) { - nsCOMPtr fls(getter_AddRefs(GetFirstLineStyle(aPresContext))); - if (fls) { - // Now we do have first-line style. Therefore we need to wrap up - // the inline-frames in a first-line frame. - mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE; - WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes - - // Force a reflow so that the first-line is reflowed properly - aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW); - if (ourChange < NS_STYLE_HINT_REFLOW) { - ourChange = NS_STYLE_HINT_REFLOW; - } - if (aLocalChange) { - *aLocalChange = ourChange; - } - } - } -#endif - return rv; -} - NS_IMETHODIMP nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const { diff --git a/mozilla/layout/html/base/src/nsBlockReflowState.h b/mozilla/layout/html/base/src/nsBlockReflowState.h index e034bb65e58..9b334624c56 100644 --- a/mozilla/layout/html/base/src/nsBlockReflowState.h +++ b/mozilla/layout/html/base/src/nsBlockReflowState.h @@ -1011,114 +1011,6 @@ nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } -static nsresult -ReResolveLineList(nsIPresContext* aPresContext, - nsLineBox* aLine, - nsIStyleContext* aStyleContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList) -{ - nsresult rv = NS_OK; - PRInt32 childChange; - while (nsnull != aLine) { - nsIFrame* child = aLine->mFirstChild; - PRInt32 n = aLine->mChildCount; - while ((--n >= 0) && NS_SUCCEEDED(rv)) { - rv = child->ReResolveStyleContext(aPresContext, aStyleContext, - aParentChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - aLine = aLine->mNext; - } - return rv; -} - -NS_IMETHODIMP -nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // NOTE: using nsFrame's ReResolveStyleContext method to avoid - // version in container frame that will do our children - PRInt32 ourChange = aParentChange; - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, - &ourChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - if (aLocalChange) { - *aLocalChange = ourChange; - } - - // Update the child frames on each line - rv = ReResolveLineList(aPresContext, mLines, mStyleContext, - ourChange, aChangeList); - - // Update any overflow lines too - if (NS_SUCCEEDED(rv) && (nsnull != mOverflowLines)) { - rv = ReResolveLineList(aPresContext, mOverflowLines, mStyleContext, - ourChange, aChangeList); - } - - // Just in case, we update the prev-in-flow's overflow lines too - // XXX try to make this go away.... - if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) { - nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines; - if (nsnull != lines) { - rv = ReResolveLineList(aPresContext, lines, mStyleContext, - ourChange, aChangeList); - } - } - - // Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - GetAdditionalChildListName(listIndex++, &childList); - while (childList) { - nsIFrame* child = nsnull; - rv = FirstChild(childList, &child); - while ((NS_SUCCEEDED(rv)) && (child)) { - rv = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } - } - -#ifdef BLOCK_DOES_FIRST_LINE - // It is possible that we just acquired first-line style. See if - // this is the case, and if so, fix things up. - if (0 == (NS_BLOCK_HAS_FIRST_LINE_STYLE & mState)) { - nsCOMPtr fls(getter_AddRefs(GetFirstLineStyle(aPresContext))); - if (fls) { - // Now we do have first-line style. Therefore we need to wrap up - // the inline-frames in a first-line frame. - mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE; - WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes - - // Force a reflow so that the first-line is reflowed properly - aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW); - if (ourChange < NS_STYLE_HINT_REFLOW) { - ourChange = NS_STYLE_HINT_REFLOW; - } - if (aLocalChange) { - *aLocalChange = ourChange; - } - } - } -#endif - return rv; -} - NS_IMETHODIMP nsBlockFrame::IsSplittable(nsSplittableType& aIsSplittable) const { diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index e70f4e98deb..8e88c244ea2 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -141,73 +141,6 @@ nsContainerFrame::FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const } } -///////////////////////////////////////////////////////////////////////////// -// Style support - -NS_IMETHODIMP -nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - PRInt32 ourChange = aParentChange; - nsresult result = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, - ourChange, aChangeList, &ourChange); - if (NS_FAILED(result)) { - return result; - } - - if (aLocalChange) { - *aLocalChange = ourChange; - } - - if (NS_COMFALSE != result) { - // Update all children since our context changed - PRInt32 listIndex = 0; - nsIAtom* childList = nsnull; - PRInt32 childChange; - nsIFrame* child; - - do { - child = nsnull; - result = FirstChild(childList, &child); - while ((NS_SUCCEEDED(result)) && (child)) { - result = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - NS_IF_RELEASE(childList); - GetAdditionalChildListName(listIndex++, &childList); - } while (childList); - - // Update overflow list too (XXX this is not just another child list?) - child = mOverflowFrames.FirstChild(); - while ((NS_SUCCEEDED(result)) && (nsnull != child)) { - result = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - - // And just to be complete, update our prev-in-flows overflow list - // too (since in theory, those frames will become our frames) - // XXX Eeek, this is potentially re-resolving these frames twice, can this be optimized? - // Better yet, this should just go away, overflow push/pull code should re-resolve - // as needed for parent changes - if (nsnull != mPrevInFlow) { - child = ((nsContainerFrame*)mPrevInFlow)->mOverflowFrames.FirstChild(); - while ((NS_SUCCEEDED(result)) && (nsnull != child)) { - result = child->ReResolveStyleContext(aPresContext, mStyleContext, - ourChange, aChangeList, &childChange); - child->GetNextSibling(&child); - } - } - - } - return result; -} - ///////////////////////////////////////////////////////////////////////////// // Painting/Events diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index 1988c99b8d2..710407bc6ed 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -39,11 +39,6 @@ public: nsFramePaintLayer aWhichLayer); NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, nsIFrame** aFrame); - NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange); NS_IMETHOD ReplaceFrame(nsIPresContext& aPresContext, nsIPresShell& aPresShell, nsIAtom* aListName, diff --git a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp index eea7887bae9..92fe38b64f4 100644 --- a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp @@ -400,16 +400,18 @@ nsButtonFrameRenderer::GetStyleContext(PRInt32 aIndex, nsIStyleContext** aStyleC switch (aIndex) { case NS_BUTTON_RENDERER_OUTLINE_CONTEXT_INDEX: *aStyleContext = mOutlineStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: *aStyleContext = mInnerFocusStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; case NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX: *aStyleContext = mOuterFocusStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; + default: + return NS_ERROR_INVALID_ARG; } return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp index 52e0481598a..b1fd132f81d 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -70,8 +70,10 @@ nsGfxRadioControlFrame::GetAdditionalStyleContext(PRInt32 aIndex, switch (aIndex) { case NS_GFX_RADIO_CONTROL_FRAME_FACE_CONTEXT_INDEX: *aStyleContext = mRadioButtonFaceStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; + default: + return NS_ERROR_INVALID_ARG; } return NS_OK; } @@ -94,41 +96,6 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, } -NS_IMETHODIMP -nsGfxRadioControlFrame::ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // this re-resolves |mStyleContext|, so it may change - nsresult rv = Inherited::ReResolveStyleContext(aPresContext, aParentContext, aParentChange, - aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { // frame style changed - if (aLocalChange) { - aParentChange = *aLocalChange; // tell children about or change - } - } - - // see if the outline has changed. - nsCOMPtr oldRadioButtonFaceStyle = mRadioButtonFaceStyle; - aPresContext->ProbePseudoStyleContextFor(mContent, nsHTMLAtoms::radioPseudo, mStyleContext, - PR_FALSE, - &mRadioButtonFaceStyle); - - if ((mRadioButtonFaceStyle && oldRadioButtonFaceStyle.get()) && (mRadioButtonFaceStyle != oldRadioButtonFaceStyle.get())) { - nsRadioControlFrame::CaptureStyleChangeFor(this, oldRadioButtonFaceStyle, mRadioButtonFaceStyle, - aParentChange, aChangeList, aLocalChange); - } - - return rv; -} - - NS_IMETHODIMP nsGfxRadioControlFrame::SetRadioButtonFaceStyleContext(nsIStyleContext *aRadioButtonFaceStyleContext) { diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h index 3a3bd312f07..553add19e3e 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.h @@ -44,12 +44,6 @@ public: nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange); - // // XXX: The following paint methods are TEMPORARY. It is being used to get printing working // under windows. Later it may be used to GFX-render the controls to the display. diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 97e48bd19a4..a2d15747efb 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -647,33 +647,6 @@ nsHTMLButtonControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, return mRenderer.SetStyleContext(aIndex, aStyleContext); } -// -// ReResolveStyleContext -// -// When the style context changes, make sure that all of our styles are still up to date. -// -NS_IMETHODIMP -nsHTMLButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext, - PRInt32 aParentChange, nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // this re-resolves |mStyleContext|, so it may change - nsresult rv = nsHTMLContainerFrame::ReResolveStyleContext(aPresContext, aParentContext, - aParentChange, aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { // frame style changed - if (aLocalChange) { - aParentChange = *aLocalChange; // tell children about or change - } - } - mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange); - - return rv; - -} // ReResolveStyleContext NS_IMETHODIMP nsHTMLButtonControlFrame::SetSuggestedSize(nscoord aWidth, nscoord aHeight) { diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h index 53dad01cdd0..ed56614886a 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.h @@ -91,12 +91,6 @@ public: nsIStyleContext** aStyleContext) const; NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) ; - NS_IMETHOD GetFrameName(nsString& aResult) const { diff --git a/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp b/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp index 2fd6363bdae..baabefa4018 100644 --- a/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp +++ b/mozilla/layout/xul/base/src/nsProgressMeterFrame.cpp @@ -235,6 +235,11 @@ nsProgressMeterFrame::Init(nsIPresContext& aPresContext, mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::mode, mode); setMode(mode); + nsCOMPtr barPseudo ( dont_AddRef(NS_NewAtom(":progressmeter-stripe")) ); + nsIStyleContext* barStyle = nsnull; + aPresContext.ProbePseudoStyleContextFor(aContent, barPseudo, aContext, + PR_FALSE, &barStyle); + mBarStyle = barStyle; return rv; } @@ -743,8 +748,10 @@ nsProgressMeterFrame::GetAdditionalStyleContext(PRInt32 aIndex, switch (aIndex) { case NS_PROGRESS_METER_STRIPE_CONTEXT_INDEX: *aStyleContext = mBarStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; + default: + return NS_ERROR_INVALID_ARG; } return NS_OK; } @@ -764,54 +771,7 @@ nsProgressMeterFrame::SetAdditionalStyleContext(PRInt32 aIndex, return NS_OK; } -// -// RefreshStyleContext -// -// Not exactly sure what this does ;) -// -void -nsProgressMeterFrame :: RefreshStyleContext(nsIPresContext* aPresContext, - nsIAtom * aNewContentPseudo, - nsCOMPtr* aCurrentStyle, - nsIContent * aContent, - nsIStyleContext* aParentStyle) -{ - nsIStyleContext* newStyleContext; - aPresContext->ProbePseudoStyleContextFor(aContent, - aNewContentPseudo, - aParentStyle, - PR_FALSE, - &newStyleContext); - if (newStyleContext != aCurrentStyle->get()) - *aCurrentStyle = dont_QueryInterface(newStyleContext); - -} // RefreshStyleContext - - -// -// ReResolveStyleContext -// -// When the style context changes, make sure that all of our styles are still up to date. -// -NS_IMETHODIMP -nsProgressMeterFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext, - PRInt32 aParentChange, nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // this re-resolves |mStyleContext|, so it may change - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, aParentChange, aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - nsCOMPtr barPseudo ( dont_AddRef(NS_NewAtom(":progressmeter-stripe")) ); - RefreshStyleContext(aPresContext, barPseudo, &mBarStyle, mContent, mStyleContext); - } - - return rv; - -} // ReResolveStyleContext + diff --git a/mozilla/layout/xul/base/src/nsProgressMeterFrame.h b/mozilla/layout/xul/base/src/nsProgressMeterFrame.h index e618640ef62..4d752526774 100644 --- a/mozilla/layout/xul/base/src/nsProgressMeterFrame.h +++ b/mozilla/layout/xul/base/src/nsProgressMeterFrame.h @@ -83,12 +83,6 @@ public: nsIStyleContext** aStyleContext) const; NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) ; - virtual void animate(); @@ -125,13 +119,6 @@ protected: virtual nsRect TransformXtoY(const nsRect& rect); virtual nsRect TransformYtoX(const nsRect& rect); - virtual void RefreshStyleContext(nsIPresContext* aPresContext, - nsIAtom * aNewContentPseudo, - nsCOMPtr* aCurrentStyle, - nsIContent * aContent, - nsIStyleContext* aParentStyle) ; - - // pass-by-value not allowed for a coordinator because it corresponds 1-to-1 // with an element in the UI. nsProgressMeterFrame ( const nsProgressMeterFrame& aFrame ) ; // DO NOT IMPLEMENT diff --git a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp index a01eabf5bda..086790676b6 100644 --- a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -1297,35 +1297,19 @@ nsTitledButtonFrame::SetAdditionalStyleContext(PRInt32 aIndex, } // -// ReResolveStyleContext +// DidSetStyleContext // -// When the style context changes, make sure that all of our styles are still up to date. +// When the style context changes, make sure that all of our image is up to date. // NS_IMETHODIMP -nsTitledButtonFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext, - PRInt32 aParentChange, nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) +nsTitledButtonFrame :: DidSetStyleContext( nsIPresContext* aPresContext ) { - // this re-resolves |mStyleContext|, so it may change - nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext, aParentChange, - aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { // frame style changed - if (aLocalChange) { - aParentChange = *aLocalChange; // tell children about or change - } - } - mRenderer->ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange); - // if list-style-image change we want to change the image UpdateImage(*aPresContext); - return rv; + return NS_OK; -} // ReResolveStyleContext +} // DidSetStyleContext void nsTitledButtonFrame::GetImageSize(nsIPresContext* aPresContext) diff --git a/mozilla/layout/xul/base/src/nsTitledButtonFrame.h b/mozilla/layout/xul/base/src/nsTitledButtonFrame.h index 6927af60764..49c561d72e9 100644 --- a/mozilla/layout/xul/base/src/nsTitledButtonFrame.h +++ b/mozilla/layout/xul/base/src/nsTitledButtonFrame.h @@ -55,11 +55,7 @@ public: nsIStyleContext** aStyleContext) const; NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) ; + NS_IMETHOD DidSetStyleContext (nsIPresContext* aPresContext); NS_IMETHOD Destroy(nsIPresContext& aPresContext); diff --git a/mozilla/layout/xul/base/src/nsToolboxFrame.cpp b/mozilla/layout/xul/base/src/nsToolboxFrame.cpp index 576829a6b94..6704ffdaf06 100644 --- a/mozilla/layout/xul/base/src/nsToolboxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsToolboxFrame.cpp @@ -178,12 +178,14 @@ nsToolboxFrame::GetAdditionalStyleContext(PRInt32 aIndex, switch (aIndex) { case NS_TOOLBOX_GRIPPY_NORMAL_CONTEXT_INDEX: *aStyleContext = mGrippyNormalStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; case NS_TOOLBOX_GRIPPY_ROLLOVER_CONTEXT_INDEX: *aStyleContext = mGrippyRolloverStyle; - NS_ADDREF(*aStyleContext); + NS_IF_ADDREF(*aStyleContext); break; + default: + return NS_ERROR_INVALID_ARG; } return NS_OK; } @@ -206,31 +208,6 @@ nsToolboxFrame::SetAdditionalStyleContext(PRInt32 aIndex, return NS_OK; } -// -// ReResolveStyleContext -// -// When the style context changes, make sure that all of our styles are still up to date. -// -NS_IMETHODIMP -nsToolboxFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsIStyleContext* aParentContext, - PRInt32 aParentChange, nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) -{ - // this re-resolves |mStyleContext|, so it may change - nsresult rv = nsBoxFrame::ReResolveStyleContext(aPresContext, aParentContext, - aParentChange, aChangeList, aLocalChange); - if (NS_FAILED(rv)) { - return rv; - } - - if (NS_COMFALSE != rv) { - UpdateStyles(aPresContext); - } - - return rv; - -} // ReResolveStyleContext - NS_IMETHODIMP nsToolboxFrame::Init(nsIPresContext& aPresContext, nsIContent* aContent, diff --git a/mozilla/layout/xul/base/src/nsToolboxFrame.h b/mozilla/layout/xul/base/src/nsToolboxFrame.h index 39bd89bacd9..cf4d71fb4be 100644 --- a/mozilla/layout/xul/base/src/nsToolboxFrame.h +++ b/mozilla/layout/xul/base/src/nsToolboxFrame.h @@ -81,11 +81,6 @@ public: nsIStyleContext** aStyleContext) const; NS_IMETHOD SetAdditionalStyleContext(PRInt32 aIndex, nsIStyleContext* aStyleContext); - NS_IMETHOD ReResolveStyleContext ( nsIPresContext* aPresContext, - nsIStyleContext* aParentContext, - PRInt32 aParentChange, - nsStyleChangeList* aChangeList, - PRInt32* aLocalChange) ; // Overridden to capture events NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,