Bug 919813 part 1: Remove never-checked return value from frame methods SetPrevInFlow, SetNextInFlow, SetPrevContinuation, SetNextContinuation. r=mats

This commit is contained in:
Daniel Holbert 2013-09-25 10:54:55 -07:00
parent 5c20906d19
commit cbd5c87eeb
7 changed files with 32 additions and 40 deletions

View File

@ -4246,15 +4246,13 @@ nsIFrame* nsFrame::GetPrevContinuation() const
return nullptr;
}
NS_IMETHODIMP nsFrame::SetPrevContinuation(nsIFrame* aPrevContinuation)
void
nsFrame::SetPrevContinuation(nsIFrame* aPrevContinuation)
{
// Ignore harmless requests to set it to NULL
if (aPrevContinuation) {
NS_ERROR("not splittable");
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
nsIFrame* nsFrame::GetNextContinuation() const
@ -4262,10 +4260,10 @@ nsIFrame* nsFrame::GetNextContinuation() const
return nullptr;
}
NS_IMETHODIMP nsFrame::SetNextContinuation(nsIFrame*)
void
nsFrame::SetNextContinuation(nsIFrame*)
{
NS_ERROR("not splittable");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIFrame* nsFrame::GetPrevInFlowVirtual() const
@ -4273,15 +4271,13 @@ nsIFrame* nsFrame::GetPrevInFlowVirtual() const
return nullptr;
}
NS_IMETHODIMP nsFrame::SetPrevInFlow(nsIFrame* aPrevInFlow)
void
nsFrame::SetPrevInFlow(nsIFrame* aPrevInFlow)
{
// Ignore harmless requests to set it to NULL
if (aPrevInFlow) {
NS_ERROR("not splittable");
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
nsIFrame* nsFrame::GetNextInFlowVirtual() const
@ -4289,10 +4285,10 @@ nsIFrame* nsFrame::GetNextInFlowVirtual() const
return nullptr;
}
NS_IMETHODIMP nsFrame::SetNextInFlow(nsIFrame*)
void
nsFrame::SetNextInFlow(nsIFrame*)
{
NS_ERROR("not splittable");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIFrame* nsIFrame::GetTailContinuation()

View File

@ -191,13 +191,13 @@ public:
int32_t aModType) MOZ_OVERRIDE;
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
virtual nsIFrame* GetPrevContinuation() const MOZ_OVERRIDE;
NS_IMETHOD SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual void SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual nsIFrame* GetNextContinuation() const MOZ_OVERRIDE;
NS_IMETHOD SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual void SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual nsIFrame* GetPrevInFlowVirtual() const MOZ_OVERRIDE;
NS_IMETHOD SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
virtual void SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
virtual nsIFrame* GetNextInFlowVirtual() const MOZ_OVERRIDE;
NS_IMETHOD SetNextInFlow(nsIFrame*) MOZ_OVERRIDE;
virtual void SetNextInFlow(nsIFrame*) MOZ_OVERRIDE;
NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsView** aView) const MOZ_OVERRIDE;
virtual nsIAtom* GetType() const MOZ_OVERRIDE;

View File

@ -1485,9 +1485,9 @@ public:
* Continuation member functions
*/
virtual nsIFrame* GetPrevContinuation() const = 0;
NS_IMETHOD SetPrevContinuation(nsIFrame*) = 0;
virtual void SetPrevContinuation(nsIFrame*) = 0;
virtual nsIFrame* GetNextContinuation() const = 0;
NS_IMETHOD SetNextContinuation(nsIFrame*) = 0;
virtual void SetNextContinuation(nsIFrame*) = 0;
virtual nsIFrame* FirstContinuation() const {
return const_cast<nsIFrame*>(this);
}
@ -1507,11 +1507,11 @@ public:
*/
virtual nsIFrame* GetPrevInFlowVirtual() const = 0;
nsIFrame* GetPrevInFlow() const { return GetPrevInFlowVirtual(); }
NS_IMETHOD SetPrevInFlow(nsIFrame*) = 0;
virtual void SetPrevInFlow(nsIFrame*) = 0;
virtual nsIFrame* GetNextInFlowVirtual() const = 0;
nsIFrame* GetNextInFlow() const { return GetNextInFlowVirtual(); }
NS_IMETHOD SetNextInFlow(nsIFrame*) = 0;
virtual void SetNextInFlow(nsIFrame*) = 0;
/**
* Return the first frame in our current flow.

View File

@ -50,13 +50,13 @@ nsIFrame* nsSplittableFrame::GetPrevContinuation() const
return mPrevContinuation;
}
NS_METHOD nsSplittableFrame::SetPrevContinuation(nsIFrame* aFrame)
void
nsSplittableFrame::SetPrevContinuation(nsIFrame* aFrame)
{
NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a prev continuation with incorrect type!");
NS_ASSERTION (!IsInPrevContinuationChain(aFrame, this), "creating a loop in continuation chain!");
mPrevContinuation = aFrame;
RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
nsIFrame* nsSplittableFrame::GetNextContinuation() const
@ -64,14 +64,14 @@ nsIFrame* nsSplittableFrame::GetNextContinuation() const
return mNextContinuation;
}
NS_METHOD nsSplittableFrame::SetNextContinuation(nsIFrame* aFrame)
void
nsSplittableFrame::SetNextContinuation(nsIFrame* aFrame)
{
NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a next continuation with incorrect type!");
NS_ASSERTION (!IsInNextContinuationChain(aFrame, this), "creating a loop in continuation chain!");
mNextContinuation = aFrame;
if (aFrame)
aFrame->RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
nsIFrame*
@ -129,13 +129,13 @@ nsIFrame* nsSplittableFrame::GetPrevInFlow() const
return (GetStateBits() & NS_FRAME_IS_FLUID_CONTINUATION) ? mPrevContinuation : nullptr;
}
NS_METHOD nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame)
void
nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame)
{
NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a prev in flow with incorrect type!");
NS_ASSERTION (!IsInPrevContinuationChain(aFrame, this), "creating a loop in continuation chain!");
mPrevContinuation = aFrame;
AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
nsIFrame* nsSplittableFrame::GetNextInFlow() const
@ -144,14 +144,14 @@ nsIFrame* nsSplittableFrame::GetNextInFlow() const
mNextContinuation : nullptr;
}
NS_METHOD nsSplittableFrame::SetNextInFlow(nsIFrame* aFrame)
void
nsSplittableFrame::SetNextInFlow(nsIFrame* aFrame)
{
NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a next in flow with incorrect type!");
NS_ASSERTION (!IsInNextContinuationChain(aFrame, this), "creating a loop in continuation chain!");
mNextContinuation = aFrame;
if (aFrame)
aFrame->AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
nsIFrame*

View File

@ -41,8 +41,8 @@ public:
virtual nsIFrame* GetNextContinuation() const MOZ_OVERRIDE;
// Set a previous/next non-fluid continuation.
NS_IMETHOD SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
NS_IMETHOD SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual void SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual void SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
// Get the first/last continuation for this frame.
virtual nsIFrame* FirstContinuation() const MOZ_OVERRIDE;
@ -62,8 +62,8 @@ public:
virtual nsIFrame* GetNextInFlowVirtual() const MOZ_OVERRIDE { return GetNextInFlow(); }
// Set a previous/next fluid continuation.
NS_IMETHOD SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
NS_IMETHOD SetNextInFlow(nsIFrame*) MOZ_OVERRIDE;
virtual void SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
virtual void SetNextInFlow(nsIFrame*) MOZ_OVERRIDE;
// Get the first/last frame in the current flow.
virtual nsIFrame* FirstInFlow() const MOZ_OVERRIDE;

View File

@ -3902,27 +3902,25 @@ public:
virtual nsIFrame* GetPrevContinuation() const {
return mPrevContinuation;
}
NS_IMETHOD SetPrevContinuation(nsIFrame* aPrevContinuation) {
virtual void SetPrevContinuation(nsIFrame* aPrevContinuation) {
NS_ASSERTION (!aPrevContinuation || GetType() == aPrevContinuation->GetType(),
"setting a prev continuation with incorrect type!");
NS_ASSERTION (!nsSplittableFrame::IsInPrevContinuationChain(aPrevContinuation, this),
"creating a loop in continuation chain!");
mPrevContinuation = aPrevContinuation;
RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
virtual nsIFrame* GetPrevInFlowVirtual() const { return GetPrevInFlow(); }
nsIFrame* GetPrevInFlow() const {
return (GetStateBits() & NS_FRAME_IS_FLUID_CONTINUATION) ? mPrevContinuation : nullptr;
}
NS_IMETHOD SetPrevInFlow(nsIFrame* aPrevInFlow) {
virtual void SetPrevInFlow(nsIFrame* aPrevInFlow) MOZ_OVERRIDE {
NS_ASSERTION (!aPrevInFlow || GetType() == aPrevInFlow->GetType(),
"setting a prev in flow with incorrect type!");
NS_ASSERTION (!nsSplittableFrame::IsInPrevContinuationChain(aPrevInFlow, this),
"creating a loop in continuation chain!");
mPrevContinuation = aPrevInFlow;
AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
virtual nsIFrame* FirstInFlow() const MOZ_OVERRIDE;
virtual nsIFrame* FirstContinuation() const MOZ_OVERRIDE;

View File

@ -71,7 +71,7 @@ public:
virtual nsIFrame* GetNextContinuation() const MOZ_OVERRIDE {
return mNextContinuation;
}
NS_IMETHOD SetNextContinuation(nsIFrame* aNextContinuation) MOZ_OVERRIDE {
virtual void SetNextContinuation(nsIFrame* aNextContinuation) MOZ_OVERRIDE {
NS_ASSERTION (!aNextContinuation || GetType() == aNextContinuation->GetType(),
"setting a next continuation with incorrect type!");
NS_ASSERTION (!nsSplittableFrame::IsInNextContinuationChain(aNextContinuation, this),
@ -79,14 +79,13 @@ public:
mNextContinuation = aNextContinuation;
if (aNextContinuation)
aNextContinuation->RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
virtual nsIFrame* GetNextInFlowVirtual() const MOZ_OVERRIDE { return GetNextInFlow(); }
nsIFrame* GetNextInFlow() const {
return mNextContinuation && (mNextContinuation->GetStateBits() & NS_FRAME_IS_FLUID_CONTINUATION) ?
mNextContinuation : nullptr;
}
NS_IMETHOD SetNextInFlow(nsIFrame* aNextInFlow) MOZ_OVERRIDE {
virtual void SetNextInFlow(nsIFrame* aNextInFlow) MOZ_OVERRIDE {
NS_ASSERTION (!aNextInFlow || GetType() == aNextInFlow->GetType(),
"setting a next in flow with incorrect type!");
NS_ASSERTION (!nsSplittableFrame::IsInNextContinuationChain(aNextInFlow, this),
@ -94,7 +93,6 @@ public:
mNextContinuation = aNextInFlow;
if (aNextInFlow)
aNextInFlow->AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
return NS_OK;
}
virtual nsIFrame* LastInFlow() const MOZ_OVERRIDE;
virtual nsIFrame* LastContinuation() const MOZ_OVERRIDE;