зеркало из https://github.com/mozilla/pjs.git
When reflowing a frame (such as text controls) that jumps from HTML layout into XUL layout and then jumps back to HTML on the child frame, link the parent reflow state chain correctly. (Bug 627842, patch 3) r=roc
This commit is contained in:
Родитель
d1799c8949
Коммит
045faa99a2
|
@ -7509,8 +7509,21 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||||
|
|
||||||
// Construct the parent chain manually since constructing it normally
|
// Construct the parent chain manually since constructing it normally
|
||||||
// messes up dimensions.
|
// messes up dimensions.
|
||||||
reflowState.parentReflowState = &parentReflowState;
|
const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
|
||||||
reflowState.mCBReflowState = &parentReflowState;
|
NS_ASSERTION(!outerReflowState || outerReflowState->frame != this,
|
||||||
|
"in and out of XUL on a single frame?");
|
||||||
|
if (outerReflowState && outerReflowState->frame == parentFrame) {
|
||||||
|
// We're a frame (such as a text control frame) that jumps into
|
||||||
|
// box reflow and then straight out of it on the child frame.
|
||||||
|
// This means we actually have a real parent reflow state.
|
||||||
|
// nsLayoutUtils::InflationMinFontSizeFor needs this to be linked
|
||||||
|
// up correctly for text control frames, so do so here).
|
||||||
|
reflowState.parentReflowState = outerReflowState;
|
||||||
|
reflowState.mCBReflowState = outerReflowState;
|
||||||
|
} else {
|
||||||
|
reflowState.parentReflowState = &parentReflowState;
|
||||||
|
reflowState.mCBReflowState = &parentReflowState;
|
||||||
|
}
|
||||||
reflowState.mReflowDepth = aState.GetReflowDepth();
|
reflowState.mReflowDepth = aState.GetReflowDepth();
|
||||||
|
|
||||||
// mComputedWidth and mComputedHeight are content-box, not
|
// mComputedWidth and mComputedHeight are content-box, not
|
||||||
|
|
|
@ -676,7 +676,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
|
||||||
|
|
||||||
// create the layout state
|
// create the layout state
|
||||||
nsBoxLayoutState state(aPresContext, aReflowState.rendContext,
|
nsBoxLayoutState state(aPresContext, aReflowState.rendContext,
|
||||||
aReflowState.mReflowDepth);
|
&aReflowState, aReflowState.mReflowDepth);
|
||||||
|
|
||||||
nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
|
nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,11 @@
|
||||||
|
|
||||||
nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
|
nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
|
||||||
nsRenderingContext* aRenderingContext,
|
nsRenderingContext* aRenderingContext,
|
||||||
|
const nsHTMLReflowState* aOuterReflowState,
|
||||||
PRUint16 aReflowDepth)
|
PRUint16 aReflowDepth)
|
||||||
: mPresContext(aPresContext)
|
: mPresContext(aPresContext)
|
||||||
, mRenderingContext(aRenderingContext)
|
, mRenderingContext(aRenderingContext)
|
||||||
|
, mOuterReflowState(aOuterReflowState)
|
||||||
, mLayoutFlags(0)
|
, mLayoutFlags(0)
|
||||||
, mReflowDepth(aReflowDepth)
|
, mReflowDepth(aReflowDepth)
|
||||||
, mPaintingDisabled(false)
|
, mPaintingDisabled(false)
|
||||||
|
@ -59,6 +61,7 @@ nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
|
||||||
nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
|
nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
|
||||||
: mPresContext(aState.mPresContext)
|
: mPresContext(aState.mPresContext)
|
||||||
, mRenderingContext(aState.mRenderingContext)
|
, mRenderingContext(aState.mRenderingContext)
|
||||||
|
, mOuterReflowState(aState.mOuterReflowState)
|
||||||
, mLayoutFlags(aState.mLayoutFlags)
|
, mLayoutFlags(aState.mLayoutFlags)
|
||||||
, mReflowDepth(aState.mReflowDepth + 1)
|
, mReflowDepth(aState.mReflowDepth + 1)
|
||||||
, mPaintingDisabled(aState.mPaintingDisabled)
|
, mPaintingDisabled(aState.mPaintingDisabled)
|
||||||
|
|
|
@ -59,7 +59,10 @@ class nsHTMLReflowCommand;
|
||||||
class NS_STACK_CLASS nsBoxLayoutState
|
class NS_STACK_CLASS nsBoxLayoutState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsBoxLayoutState(nsPresContext* aPresContext, nsRenderingContext* aRenderingContext = nsnull,
|
nsBoxLayoutState(nsPresContext* aPresContext,
|
||||||
|
nsRenderingContext* aRenderingContext = nsnull,
|
||||||
|
// see OuterReflowState() below
|
||||||
|
const nsHTMLReflowState* aOuterReflowState = nsnull,
|
||||||
PRUint16 aReflowDepth = 0) NS_HIDDEN;
|
PRUint16 aReflowDepth = 0) NS_HIDDEN;
|
||||||
nsBoxLayoutState(const nsBoxLayoutState& aState) NS_HIDDEN;
|
nsBoxLayoutState(const nsBoxLayoutState& aState) NS_HIDDEN;
|
||||||
|
|
||||||
|
@ -84,11 +87,16 @@ public:
|
||||||
void* AllocateStackMemory(size_t aSize)
|
void* AllocateStackMemory(size_t aSize)
|
||||||
{ return PresShell()->AllocateStackMemory(aSize); }
|
{ return PresShell()->AllocateStackMemory(aSize); }
|
||||||
|
|
||||||
|
// The HTML reflow state that lives outside the box-block boundary.
|
||||||
|
// May not be set reliably yet.
|
||||||
|
const nsHTMLReflowState* OuterReflowState() { return mOuterReflowState; }
|
||||||
|
|
||||||
PRUint16 GetReflowDepth() { return mReflowDepth; }
|
PRUint16 GetReflowDepth() { return mReflowDepth; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsRefPtr<nsPresContext> mPresContext;
|
nsRefPtr<nsPresContext> mPresContext;
|
||||||
nsRenderingContext *mRenderingContext;
|
nsRenderingContext *mRenderingContext;
|
||||||
|
const nsHTMLReflowState *mOuterReflowState;
|
||||||
PRUint32 mLayoutFlags;
|
PRUint32 mLayoutFlags;
|
||||||
PRUint16 mReflowDepth;
|
PRUint16 mReflowDepth;
|
||||||
bool mPaintingDisabled;
|
bool mPaintingDisabled;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче