Skip to content

Commit

Permalink
Bug 1008917 - part 2,3,4, make Reflow() return type 'void', and make …
Browse files Browse the repository at this point in the history
…a few reflow related helper methods 'void' too. r=roc
  • Loading branch information
MatsPalmgren committed May 12, 2014
1 parent e40dfa8 commit 6d69b8b
Show file tree
Hide file tree
Showing 120 changed files with 543 additions and 722 deletions.
23 changes: 9 additions & 14 deletions layout/forms/nsComboboxControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class nsResizeDropdownAtFinalPosition
nsWeakFrame mFrame;
};

nsresult
void
nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState)
{
Expand All @@ -407,7 +407,7 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
// need to reflow it, just bail out here.
if (!aReflowState.ShouldReflowAllKids() &&
!NS_SUBTREE_DIRTY(mDropdownFrame)) {
return NS_OK;
return;
}

// XXXbz this will, for small-height dropdowns, have extra space on the right
Expand Down Expand Up @@ -444,14 +444,12 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
nsRect rect = mDropdownFrame->GetRect();
nsHTMLReflowMetrics desiredSize(aReflowState);
nsReflowStatus ignoredStatus;
nsresult rv = ReflowChild(mDropdownFrame, aPresContext, desiredSize,
kidReflowState, rect.x, rect.y, flags,
ignoredStatus);
ReflowChild(mDropdownFrame, aPresContext, desiredSize,
kidReflowState, rect.x, rect.y, flags, ignoredStatus);

// Set the child's width and height to its desired size
FinishReflowChild(mDropdownFrame, aPresContext, desiredSize,
&kidReflowState, rect.x, rect.y, flags);
return rv;
}

nsPoint
Expand Down Expand Up @@ -759,7 +757,7 @@ nsComboboxControlFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
return prefWidth;
}

nsresult
void
nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand All @@ -778,7 +776,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,

if (!mDisplayFrame || !mButtonFrame || !mDropdownFrame) {
NS_ERROR("Why did the frame constructor allow this to happen? Fix it!!");
return NS_ERROR_UNEXPECTED;
return;
}

// Make sure the displayed text is the same as the selected option, bug 297389.
Expand Down Expand Up @@ -828,9 +826,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,

mDisplayWidth = aReflowState.ComputedWidth() - buttonWidth;

nsresult rv = nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState,
aStatus);
NS_ENSURE_SUCCESS(rv, rv);
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

// The button should occupy the same space as a scrollbar
nsRect buttonRect = mButtonFrame->GetRect();
Expand Down Expand Up @@ -859,7 +855,6 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
// a nsComboboxControlFrame makes no sense, so we override the status here.
aStatus = NS_FRAME_COMPLETE;
}
return rv;
}

//--------------------------------------------------------------
Expand Down Expand Up @@ -1213,7 +1208,7 @@ class nsComboboxDisplayFrame : public nsBlockFrame {
~(nsIFrame::eReplacedContainsBlock));
}

virtual nsresult Reflow(nsPresContext* aPresContext,
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
Expand All @@ -1234,7 +1229,7 @@ nsComboboxDisplayFrame::GetType() const
return nsGkAtoms::comboboxDisplayFrame;
}

nsresult
void
nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down
12 changes: 6 additions & 6 deletions layout/forms/nsComboboxControlFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ class nsComboboxControlFrame : public nsBlockFrame,

virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;

virtual nsresult Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;

virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
Expand Down Expand Up @@ -201,8 +201,8 @@ class nsComboboxControlFrame : public nsBlockFrame,
friend class nsResizeDropdownAtFinalPosition;

// Utilities
nsresult ReflowDropdown(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState);
void ReflowDropdown(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState);

enum DropDownPositionState {
// can't show the dropdown at its current position
Expand Down
3 changes: 1 addition & 2 deletions layout/forms/nsFieldSetFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
return result;
}

nsresult
void
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down Expand Up @@ -554,7 +554,6 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
InvalidateFrame();

NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}

nsresult
Expand Down
8 changes: 4 additions & 4 deletions layout/forms/nsFieldSetFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ class nsFieldSetFrame MOZ_FINAL : public nsContainerFrame
*/
virtual nsRect VisualBorderRectRelativeToSelf() const MOZ_OVERRIDE;

virtual nsresult Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;

virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
Expand Down
9 changes: 2 additions & 7 deletions layout/forms/nsFormControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ nsFormControlFrame::GetBaseline() const
return mRect.height - GetUsedBorderAndPadding().bottom;
}

nsresult
void
nsFormControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand All @@ -86,11 +86,7 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext,
RegUnRegAccessKey(static_cast<nsIFrame*>(this), true);
}

nsresult rv = nsLeafFrame::Reflow(aPresContext, aDesiredSize, aReflowState,
aStatus);
if (NS_FAILED(rv)) {
return rv;
}
nsLeafFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
Expand All @@ -99,7 +95,6 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
}
return NS_OK;
}

nsresult
Expand Down
8 changes: 4 additions & 4 deletions layout/forms/nsFormControlFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class nsFormControlFrame : public nsLeafFrame,
* Respond to the request to resize and/or reflow
* @see nsIFrame::Reflow
*/
virtual nsresult Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;

virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;

Expand Down
3 changes: 1 addition & 2 deletions layout/forms/nsHTMLButtonControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ nsHTMLButtonControlFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
return result;
}

nsresult
void
nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down Expand Up @@ -205,7 +205,6 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
aReflowState, aStatus);

NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}

// Helper-function that lets us clone the button's reflow state, but with its
Expand Down
8 changes: 4 additions & 4 deletions layout/forms/nsHTMLButtonControlFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class nsHTMLButtonControlFrame : public nsContainerFrame,

virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;

virtual nsresult Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;

virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
Expand Down
4 changes: 2 additions & 2 deletions layout/forms/nsImageControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class nsImageControlFrame : public nsImageControlFrameSuper,
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS

virtual nsresult Reflow(nsPresContext* aPresContext,
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
Expand Down Expand Up @@ -124,7 +124,7 @@ nsImageControlFrame::GetType() const
return nsGkAtoms::imageControlFrame;
}

nsresult
void
nsImageControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down
2 changes: 1 addition & 1 deletion layout/forms/nsLegendFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ NS_QUERYFRAME_HEAD(nsLegendFrame)
NS_QUERYFRAME_ENTRY(nsLegendFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)

nsresult
void
nsLegendFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down
8 changes: 4 additions & 4 deletions layout/forms/nsLegendFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class nsLegendFrame : public nsBlockFrame {

nsLegendFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {}

virtual nsresult Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;

virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;

Expand Down
27 changes: 12 additions & 15 deletions layout/forms/nsListControlFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ nsListControlFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
return result;
}

nsresult
void
nsListControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down Expand Up @@ -358,7 +358,8 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
}

if (IsInDropDownMode()) {
return ReflowAsDropdown(aPresContext, aDesiredSize, aReflowState, aStatus);
ReflowAsDropdown(aPresContext, aDesiredSize, aReflowState, aStatus);
return;
}

/*
Expand Down Expand Up @@ -398,9 +399,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
state.SetComputedHeight(computedHeight);
}

nsresult rv = nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize,
state, aStatus);
NS_ENSURE_SUCCESS(rv, rv);
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);

if (!mMightNeedSecondPass) {
NS_ASSERTION(!autoHeight || HeightOfARow() == oldHeightOfARow,
Expand All @@ -426,7 +425,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
}
}

return rv;
return;
}

mMightNeedSecondPass = false;
Expand All @@ -438,7 +437,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
NS_ASSERTION(!IsScrollbarUpdateSuppressed(),
"Shouldn't be suppressing if the height of a row has not "
"changed!");
return rv;
return;
}

SetSuppressScrollbarUpdate(false);
Expand All @@ -461,10 +460,10 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
// XXXbz to make the ascent really correct, we should add our
// mComputedPadding.top to it (and subtract it from descent). Need that
// because nsGfxScrollFrame just adds in the border....
return nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
}

nsresult
void
nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
Expand Down Expand Up @@ -493,9 +492,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
state.SetComputedHeight(mLastDropdownComputedHeight);
}

nsresult rv = nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize,
state, aStatus);
NS_ENSURE_SUCCESS(rv, rv);
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);

if (!mMightNeedSecondPass) {
NS_ASSERTION(oldVisibleHeight == GetScrolledFrame()->GetSize().height,
Expand All @@ -506,7 +503,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
"Shouldn't be suppressing if we don't need a second pass!");
NS_ASSERTION(!(GetStateBits() & NS_FRAME_FIRST_REFLOW),
"How can we avoid a second pass during first reflow?");
return rv;
return;
}

mMightNeedSecondPass = false;
Expand All @@ -517,7 +514,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
// All done. No need to do more reflow.
NS_ASSERTION(!(GetStateBits() & NS_FRAME_FIRST_REFLOW),
"How can we avoid a second pass during first reflow?");
return rv;
return;
}

SetSuppressScrollbarUpdate(false);
Expand Down Expand Up @@ -579,7 +576,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
mLastDropdownComputedHeight = state.ComputedHeight();

nsHTMLScrollFrame::WillReflow(aPresContext);
return nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
}

ScrollbarStyles
Expand Down
16 changes: 8 additions & 8 deletions layout/forms/nsListControlFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class nsListControlFrame : public nsHTMLScrollFrame,
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;

virtual nsresult Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Reflow(nsPresContext* aCX,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) MOZ_OVERRIDE;

virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
Expand Down Expand Up @@ -343,10 +343,10 @@ class nsListControlFrame : public nsHTMLScrollFrame,
* reflow as a listbox because the criteria for needing a second
* pass are different. This will be called from Reflow() as needed.
*/
nsresult ReflowAsDropdown(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
void ReflowAsDropdown(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);

// Selection
bool SetOptionsSelectedFromFrame(int32_t aStartIndex,
Expand Down
Loading

0 comments on commit 6d69b8b

Please sign in to comment.