зеркало из https://github.com/mozilla/pjs.git
Changes to allow absolutely positioned frames to move
This commit is contained in:
Родитель
10d7588f1e
Коммит
9ca7863d5e
|
@ -836,6 +836,14 @@ PresShell::DocumentWillBeDestroyed(nsIDocument *aDocument)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsZeroSizedFrame(nsIFrame *aFrame)
|
||||
{
|
||||
nsSize size;
|
||||
aFrame->GetSize(size);
|
||||
return ((0 == size.width) && (0 == size.height));
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
|
||||
{
|
||||
|
@ -843,8 +851,17 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
|
|||
|
||||
aFrame->GetContent(frameContent);
|
||||
if (frameContent == aContent) {
|
||||
NS_RELEASE(frameContent);
|
||||
return aFrame;
|
||||
// XXX Sleazy hack to check whether this is a placeholder frame.
|
||||
// If it is, we skip it and go on to (hopefully) find the
|
||||
// absolutely positioned frame.
|
||||
const nsStylePosition* position;
|
||||
|
||||
aFrame->GetStyleData(eStyleStruct_Position, (nsStyleStruct*&)position);
|
||||
if ((NS_STYLE_POSITION_ABSOLUTE != position->mPosition) ||
|
||||
!IsZeroSizedFrame(aFrame)) {
|
||||
NS_RELEASE(frameContent);
|
||||
return aFrame;
|
||||
}
|
||||
}
|
||||
NS_RELEASE(frameContent);
|
||||
|
||||
|
|
|
@ -195,6 +195,9 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
|
|||
nextFrame->SizeTo(aDesiredSize.width, aDesiredSize.height);
|
||||
}
|
||||
|
||||
// XXX Commented this out because the absolute positioning code
|
||||
// above doesn't check if it needs to position the absolute frame.
|
||||
#if 0
|
||||
// XXX Temporary code: if the frame we just reflowed is a
|
||||
// floating frame then fall through into the main reflow pathway
|
||||
// after clearing out our incremental reflow status. This forces
|
||||
|
@ -211,6 +214,7 @@ nsBodyFrame::Reflow(nsIPresContext& aPresContext,
|
|||
if (NS_STYLE_FLOAT_NONE == display->mFloats) {
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Switch over to a reflow-state that is called resize instead
|
||||
// of an incremental reflow state like we were passed in.
|
||||
|
|
|
@ -836,6 +836,14 @@ PresShell::DocumentWillBeDestroyed(nsIDocument *aDocument)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsZeroSizedFrame(nsIFrame *aFrame)
|
||||
{
|
||||
nsSize size;
|
||||
aFrame->GetSize(size);
|
||||
return ((0 == size.width) && (0 == size.height));
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
|
||||
{
|
||||
|
@ -843,8 +851,17 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent)
|
|||
|
||||
aFrame->GetContent(frameContent);
|
||||
if (frameContent == aContent) {
|
||||
NS_RELEASE(frameContent);
|
||||
return aFrame;
|
||||
// XXX Sleazy hack to check whether this is a placeholder frame.
|
||||
// If it is, we skip it and go on to (hopefully) find the
|
||||
// absolutely positioned frame.
|
||||
const nsStylePosition* position;
|
||||
|
||||
aFrame->GetStyleData(eStyleStruct_Position, (nsStyleStruct*&)position);
|
||||
if ((NS_STYLE_POSITION_ABSOLUTE != position->mPosition) ||
|
||||
!IsZeroSizedFrame(aFrame)) {
|
||||
NS_RELEASE(frameContent);
|
||||
return aFrame;
|
||||
}
|
||||
}
|
||||
NS_RELEASE(frameContent);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче