Make SVG foreignObject frames reflow roots, instead of their child, so that marking the child dirty still keeps the change constrained to the foreignObject. b=368101 r+sr=roc

This commit is contained in:
dbaron%dbaron.org 2007-01-26 06:58:31 +00:00
parent 7b198df002
commit f12230e5d8
4 changed files with 32 additions and 4 deletions

View File

@ -7328,8 +7328,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, innerPseudoStyle,
NS_BLOCK_SPACE_MGR |
NS_BLOCK_MARGIN_ROOT |
NS_FRAME_REFLOW_ROOT);
NS_BLOCK_MARGIN_ROOT);
if (NS_UNLIKELY(!blockFrame))
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -82,6 +82,7 @@ nsSVGForeignObjectFrame::nsSVGForeignObjectFrame(nsStyleContext* aContext)
: nsSVGForeignObjectFrameBase(aContext),
mPropagateTransform(PR_TRUE), mInReflow(PR_FALSE)
{
AddStateBits(NS_FRAME_REFLOW_ROOT);
}
//----------------------------------------------------------------------
@ -143,6 +144,31 @@ nsSVGForeignObjectFrame::DidSetStyleContext()
return NS_OK;
}
NS_IMETHODIMP
nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
NS_ASSERTION(!aReflowState.parentReflowState,
"should only get reflow from being reflow root");
NS_ASSERTION(aReflowState.mComputedWidth == GetSize().width &&
aReflowState.mComputedHeight == GetSize().height,
"reflow roots should be reflown at existing size and "
"svg.css should ensure we have no padding/border/margin");
DoReflow();
aDesiredSize.width = aReflowState.mComputedWidth;
aDesiredSize.height = aReflowState.mComputedHeight;
aDesiredSize.mOverflowArea =
nsRect(nsPoint(0, 0), nsSize(aDesiredSize.width, aDesiredSize.height));
aStatus = NS_FRAME_COMPLETE;
return NS_OK;
}
//----------------------------------------------------------------------
// nsISVGValueObserver methods:

View File

@ -79,6 +79,11 @@ public:
NS_IMETHOD DidSetStyleContext();
NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus);
/**
* Get the "type" of the frame
*

View File

@ -72,6 +72,4 @@ foreignObject {
*|*::-moz-svg-foreign-content {
display: block !important;
position: static !important;
/* so we don't report overflow that confuses the reflow root code */
overflow: -moz-hidden-unscrollable ! important;
}