Bug 172031. Make CanvasFrame put back the block preferred size before incrementally reflowing its block, since the block needs that preferred size to incrementally reflow its absolute frames properly. r=karnaze,sr=kin
This commit is contained in:
@@ -170,7 +170,7 @@ protected:
|
|||||||
// Data members
|
// Data members
|
||||||
PRPackedBool mDoPaintFocus;
|
PRPackedBool mDoPaintFocus;
|
||||||
nsCOMPtr<nsIViewManager> mViewManager;
|
nsCOMPtr<nsIViewManager> mViewManager;
|
||||||
|
nscoord mSavedChildWidth, mSavedChildHeight;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
|
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
|
||||||
@@ -572,11 +572,24 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
|
|||||||
NS_UNCONSTRAINEDSIZE),
|
NS_UNCONSTRAINEDSIZE),
|
||||||
reason);
|
reason);
|
||||||
|
|
||||||
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||||
|
// Restore original kid desired dimensions in case it decides to
|
||||||
|
// reuse them during incremental reflow.
|
||||||
|
nsRect r;
|
||||||
|
kidFrame->GetRect(r);
|
||||||
|
r.width = mSavedChildWidth;
|
||||||
|
r.height = mSavedChildHeight;
|
||||||
|
kidFrame->SetRect(aPresContext, r);
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the frame
|
// Reflow the frame
|
||||||
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
||||||
kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
|
kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
|
||||||
0, aStatus);
|
0, aStatus);
|
||||||
|
|
||||||
|
mSavedChildWidth = kidDesiredSize.width;
|
||||||
|
mSavedChildHeight = kidDesiredSize.height;
|
||||||
|
|
||||||
// The document element's background should cover the entire canvas, so
|
// The document element's background should cover the entire canvas, so
|
||||||
// take into account the combined area and any space taken up by
|
// take into account the combined area and any space taken up by
|
||||||
// absolutely positioned elements
|
// absolutely positioned elements
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ protected:
|
|||||||
// Data members
|
// Data members
|
||||||
PRPackedBool mDoPaintFocus;
|
PRPackedBool mDoPaintFocus;
|
||||||
nsCOMPtr<nsIViewManager> mViewManager;
|
nsCOMPtr<nsIViewManager> mViewManager;
|
||||||
|
nscoord mSavedChildWidth, mSavedChildHeight;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
|
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
|
||||||
@@ -572,11 +572,24 @@ CanvasFrame::Reflow(nsIPresContext* aPresContext,
|
|||||||
NS_UNCONSTRAINEDSIZE),
|
NS_UNCONSTRAINEDSIZE),
|
||||||
reason);
|
reason);
|
||||||
|
|
||||||
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
||||||
|
// Restore original kid desired dimensions in case it decides to
|
||||||
|
// reuse them during incremental reflow.
|
||||||
|
nsRect r;
|
||||||
|
kidFrame->GetRect(r);
|
||||||
|
r.width = mSavedChildWidth;
|
||||||
|
r.height = mSavedChildHeight;
|
||||||
|
kidFrame->SetRect(aPresContext, r);
|
||||||
|
}
|
||||||
|
|
||||||
// Reflow the frame
|
// Reflow the frame
|
||||||
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
|
||||||
kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
|
kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
|
||||||
0, aStatus);
|
0, aStatus);
|
||||||
|
|
||||||
|
mSavedChildWidth = kidDesiredSize.width;
|
||||||
|
mSavedChildHeight = kidDesiredSize.height;
|
||||||
|
|
||||||
// The document element's background should cover the entire canvas, so
|
// The document element's background should cover the entire canvas, so
|
||||||
// take into account the combined area and any space taken up by
|
// take into account the combined area and any space taken up by
|
||||||
// absolutely positioned elements
|
// absolutely positioned elements
|
||||||
|
|||||||
Reference in New Issue
Block a user