зеркало из https://github.com/mozilla/gecko-dev.git
Use the correct term "float" instead of "floater". b=218654 r+sr=bzbarsky
This commit is contained in:
Родитель
098a01af5b
Коммит
3de4dc91e0
|
@ -81,7 +81,7 @@ LAYOUT_ATOM(captionList, "Caption-list")
|
|||
LAYOUT_ATOM(colGroupList, "ColGroup-list")
|
||||
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
|
||||
LAYOUT_ATOM(fixedList, "Fixed-list")
|
||||
LAYOUT_ATOM(floaterList, "Floater-list")
|
||||
LAYOUT_ATOM(floatList, "Float-list")
|
||||
LAYOUT_ATOM(overflowList, "Overflow-list")
|
||||
LAYOUT_ATOM(popupList, "Popup-list")
|
||||
|
||||
|
@ -224,7 +224,7 @@ LAYOUT_ATOM(imageMap, "ImageMap")
|
|||
LAYOUT_ATOM(lineBoxBig, "LineBox:inline,big")
|
||||
LAYOUT_ATOM(lineBoxBlockBig, "LineBox:block,big")
|
||||
LAYOUT_ATOM(lineBoxBlockSmall, "LineBox:block,small")
|
||||
LAYOUT_ATOM(lineBoxFloaters, "LineBoxFloaters")
|
||||
LAYOUT_ATOM(lineBoxFloats, "LineBoxFloats")
|
||||
LAYOUT_ATOM(lineBoxSmall, "LineBox:inline,small")
|
||||
LAYOUT_ATOM(spaceManager, "SpaceManager")
|
||||
LAYOUT_ATOM(tableColCache, "TableColumnCache")
|
||||
|
|
|
@ -745,13 +745,13 @@ public:
|
|||
nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock,
|
||||
nsIFrame* aFloatContainingBlock,
|
||||
nsILayoutHistoryState* aHistoryState);
|
||||
// Get the history state from the pres context's pres shell.
|
||||
nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock);
|
||||
nsIFrame* aFloatContainingBlock);
|
||||
|
||||
// Function to push the existing absolute containing block state and
|
||||
// create a new scope
|
||||
|
@ -759,9 +759,9 @@ public:
|
|||
nsIFrame* aNewAbsoluteContainingBlock,
|
||||
nsFrameConstructorSaveState& aSaveState);
|
||||
|
||||
// Function to push the existing floater containing block state and
|
||||
// Function to push the existing float containing block state and
|
||||
// create a new scope
|
||||
void PushFloaterContainingBlock(nsIFrame* aNewFloaterContainingBlock,
|
||||
void PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock,
|
||||
nsFrameConstructorSaveState& aSaveState,
|
||||
PRBool aFirstLetterStyle,
|
||||
PRBool aFirstLineStyle);
|
||||
|
@ -770,11 +770,11 @@ public:
|
|||
nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock,
|
||||
nsIFrame* aFloatContainingBlock,
|
||||
nsILayoutHistoryState* aHistoryState)
|
||||
: mFixedItems(aFixedContainingBlock),
|
||||
mAbsoluteItems(aAbsoluteContainingBlock),
|
||||
mFloatedItems(aFloaterContainingBlock),
|
||||
mFloatedItems(aFloatContainingBlock),
|
||||
mFirstLetterStyle(PR_FALSE),
|
||||
mFirstLineStyle(PR_FALSE),
|
||||
mFrameState(aHistoryState),
|
||||
|
@ -787,10 +787,10 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresCon
|
|||
nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock)
|
||||
nsIFrame* aFloatContainingBlock)
|
||||
: mFixedItems(aFixedContainingBlock),
|
||||
mAbsoluteItems(aAbsoluteContainingBlock),
|
||||
mFloatedItems(aFloaterContainingBlock),
|
||||
mFloatedItems(aFloatContainingBlock),
|
||||
mFirstLetterStyle(PR_FALSE),
|
||||
mFirstLineStyle(PR_FALSE),
|
||||
mPseudoFrames()
|
||||
|
@ -836,7 +836,7 @@ nsFrameConstructorState::PushAbsoluteContainingBlock(nsIPresContext* aPresContex
|
|||
}
|
||||
|
||||
void
|
||||
nsFrameConstructorState::PushFloaterContainingBlock(nsIFrame* aNewFloaterContainingBlock,
|
||||
nsFrameConstructorState::PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock,
|
||||
nsFrameConstructorSaveState& aSaveState,
|
||||
PRBool aFirstLetterStyle,
|
||||
PRBool aFirstLineStyle)
|
||||
|
@ -847,7 +847,7 @@ nsFrameConstructorState::PushFloaterContainingBlock(nsIFrame* aNewFloaterContain
|
|||
aSaveState.mSavedItems = mFloatedItems;
|
||||
aSaveState.mSavedFirstLetterStyle = mFirstLetterStyle;
|
||||
aSaveState.mSavedFirstLineStyle = mFirstLineStyle;
|
||||
mFloatedItems = nsAbsoluteItems(aNewFloaterContainingBlock);
|
||||
mFloatedItems = nsAbsoluteItems(aNewFloatContainingBlock);
|
||||
mFirstLetterStyle = aFirstLetterStyle;
|
||||
mFirstLineStyle = aFirstLineStyle;
|
||||
}
|
||||
|
@ -896,12 +896,12 @@ GetRealFrame(nsIFrame* aFrame)
|
|||
// We may be a placeholder. If we are, go to the real frame.
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
|
||||
// See if it's a placeholder frame for a floater.
|
||||
// See if it's a placeholder frame for a float.
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get());
|
||||
if (isPlaceholder) {
|
||||
// Get the out-of-flow frame that the placeholder points to.
|
||||
// This is the real floater that we should examine.
|
||||
// This is the real float that we should examine.
|
||||
result = NS_STATIC_CAST(nsPlaceholderFrame*,aFrame)->GetOutOfFlowFrame();
|
||||
NS_ASSERTION(result, "No out of flow frame found for placeholder!\n");
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
|
|||
if (outOfFlowFrame && outOfFlowFrame != aFrame) {
|
||||
|
||||
// Get the display data for the outOfFlowFrame so we can
|
||||
// figure out if it is a floater or absolutely positioned element.
|
||||
// figure out if it is a float or absolutely positioned element.
|
||||
|
||||
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
|
||||
|
||||
|
@ -974,7 +974,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
|
|||
return;
|
||||
}
|
||||
|
||||
// XXX_kin: Since we're only handling floaters at the moment,
|
||||
// XXX_kin: Since we're only handling floats at the moment,
|
||||
// XXX_kin: we don't need to cross block boundaries.
|
||||
|
||||
if (IsBlockFrame(aPresContext, aFrame))
|
||||
|
@ -991,7 +991,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
|
|||
// XXX_kin: Once we add support for adjusting absolutely positioned
|
||||
// XXX_kin: frames, we will be crossing block boundaries, we/ll need
|
||||
// XXX_kin: to update aState's containingBlock info to avoid incorrectly
|
||||
// XXX_kin: reparenting floaters, etc.
|
||||
// XXX_kin: reparenting floats, etc.
|
||||
// XXX_kin:
|
||||
// XXX_kin: Do we need to prevent descent into anonymous content here?
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ GetChildListNameFor(nsIPresContext* aPresContext,
|
|||
} else {
|
||||
NS_ASSERTION(aChildFrame->GetStyleDisplay()->IsFloating(),
|
||||
"not a floated frame");
|
||||
listName = nsLayoutAtoms::floaterList;
|
||||
listName = nsLayoutAtoms::floatList;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2935,9 +2935,9 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresShell* aPresShe
|
|||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
|
||||
// The block frame is a floater container
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(aNewCellInnerFrame, floaterSaveState,
|
||||
// The block frame is a float container
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(aNewCellInnerFrame, floatSaveState,
|
||||
haveFirstLetterStyle, haveFirstLineStyle);
|
||||
|
||||
// Process the child content
|
||||
|
@ -2949,7 +2949,7 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresShell* aPresShe
|
|||
|
||||
aNewCellInnerFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewCellInnerFrame->SetInitialChildList(aPresContext, nsLayoutAtoms::floaterList,
|
||||
aNewCellInnerFrame->SetInitialChildList(aPresContext, nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -3495,7 +3495,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
if (!docElemIsTable) {
|
||||
// Process the child content
|
||||
nsFrameConstructorSaveState absoluteSaveState;
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
nsFrameItems childItems;
|
||||
|
||||
if (isBlockFrame) {
|
||||
|
@ -3503,7 +3503,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
HaveSpecialBlockStyle(aPresContext, aDocElement, styleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
aState.PushAbsoluteContainingBlock(aPresContext, contentFrame, absoluteSaveState);
|
||||
aState.PushFloaterContainingBlock(contentFrame, floaterSaveState,
|
||||
aState.PushFloatContainingBlock(contentFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
}
|
||||
|
@ -3531,7 +3531,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
contentFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -4301,12 +4301,12 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsIPresShell* aPresShell,
|
|||
aState.mFrameManager->RestoreFrameStateFor(scrollFrame, aState.mFrameState);
|
||||
}
|
||||
|
||||
// The area frame is a floater container
|
||||
// The area frame is a float container
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(scrolledFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(scrolledFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
|
||||
|
@ -4350,7 +4350,7 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsIPresShell* aPresShell,
|
|||
|
||||
if (aState.mFloatedItems.childList) {
|
||||
scrolledFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -4410,12 +4410,12 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
|
|||
|
||||
|
||||
|
||||
// The area frame is a floater container
|
||||
// The area frame is a float container
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(areaFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(areaFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
|
||||
|
@ -4471,7 +4471,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
|
|||
|
||||
if (aState.mFloatedItems.childList) {
|
||||
areaFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -4552,7 +4552,7 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
|
|||
nsIFrame* newFrame = nsnull; // the frame we construct
|
||||
PRBool isReplaced = PR_FALSE;
|
||||
PRBool addToHashTable = PR_TRUE;
|
||||
PRBool isFloaterContainer = PR_FALSE;
|
||||
PRBool isFloatContainer = PR_FALSE;
|
||||
PRBool isPositionedContainingBlock = PR_FALSE;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -4848,24 +4848,24 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
|
|||
aState.mAbsoluteItems.childList);
|
||||
}
|
||||
}
|
||||
else if (isFloaterContainer) {
|
||||
// If the frame can contain floaters, then push a floater
|
||||
else if (isFloatContainer) {
|
||||
// If the frame can contain floats, then push a float
|
||||
// containing block
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(newFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(newFrame, floatSaveState,
|
||||
PR_FALSE, PR_FALSE);
|
||||
|
||||
// Process the child frames
|
||||
rv = ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame,
|
||||
PR_TRUE, childItems, PR_FALSE);
|
||||
|
||||
// Set the frame's floater list if there were any floated children
|
||||
// Set the frame's float list if there were any floated children
|
||||
if (aState.mFloatedItems.childList) {
|
||||
newFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -6188,12 +6188,12 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
|
||||
//-----
|
||||
|
||||
// The area frame is a floater container
|
||||
// The area frame is a float container
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(scrolledFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(scrolledFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
|
||||
|
@ -6228,7 +6228,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
|
||||
if (aState.mFloatedItems.childList) {
|
||||
scrolledFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
///------
|
||||
|
@ -6262,7 +6262,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
// Process the child content. The area frame becomes a container for child
|
||||
// frames that are absolutely positioned
|
||||
nsFrameConstructorSaveState absoluteSaveState;
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
nsFrameItems childItems;
|
||||
|
||||
PRBool haveFirstLetterStyle = PR_FALSE, haveFirstLineStyle = PR_FALSE;
|
||||
|
@ -6271,7 +6271,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
}
|
||||
aState.PushAbsoluteContainingBlock(aPresContext, newFrame, absoluteSaveState);
|
||||
aState.PushFloaterContainingBlock(newFrame, floaterSaveState,
|
||||
aState.PushFloatContainingBlock(newFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE,
|
||||
|
@ -6290,7 +6290,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
newFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -7505,7 +7505,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsIFrame*
|
||||
nsCSSFrameConstructor::GetFloaterContainingBlock(nsIPresContext* aPresContext,
|
||||
nsCSSFrameConstructor::GetFloatContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
NS_PRECONDITION(mInitialContainingBlock, "no initial containing block");
|
||||
|
@ -8257,7 +8257,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
nsFrameItems frameItems;
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, parentFrame),
|
||||
GetFloaterContainingBlock(aPresContext, parentFrame));
|
||||
GetFloatContainingBlock(aPresContext, parentFrame));
|
||||
|
||||
// See if the containing block has :first-letter style applied.
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
|
@ -8416,7 +8416,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
// determine where in the list they should be inserted...
|
||||
if (state.mFloatedItems.childList) {
|
||||
state.mFloatedItems.containingBlock->AppendFrames(aPresContext, *shell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -8922,7 +8922,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
nsFrameItems frameItems;
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, parentFrame),
|
||||
GetFloaterContainingBlock(aPresContext, parentFrame),
|
||||
GetFloatContainingBlock(aPresContext, parentFrame),
|
||||
aFrameState);
|
||||
|
||||
// Recover state for the containing block - we need to know if
|
||||
|
@ -9104,7 +9104,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
// determine where in the list they should be inserted...
|
||||
if (state.mFloatedItems.childList) {
|
||||
state.mFloatedItems.containingBlock->AppendFrames(aPresContext, *shell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -9477,7 +9477,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
// Examine the containing-block for the removed content and see if
|
||||
// :first-letter style applies.
|
||||
nsIFrame* containingBlock =
|
||||
GetFloaterContainingBlock(aPresContext, parentFrame);
|
||||
GetFloatContainingBlock(aPresContext, parentFrame);
|
||||
nsStyleContext* blockSC = containingBlock->GetStyleContext();
|
||||
nsIContent* blockContent = containingBlock->GetContent();
|
||||
PRBool haveFLS = HaveFirstLetterStyle(aPresContext, blockContent, blockSC);
|
||||
|
@ -9594,11 +9594,11 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
|
||||
// XXX has to be done first for now: the blocks line list
|
||||
// contains an array of pointers to the placeholder - we have to
|
||||
// remove the floater first (which gets rid of the lines
|
||||
// reference to the placeholder and floater) and then remove the
|
||||
// remove the float first (which gets rid of the lines
|
||||
// reference to the placeholder and float) and then remove the
|
||||
// placeholder
|
||||
rv = frameManager->RemoveFrame(parentFrame,
|
||||
nsLayoutAtoms::floaterList, childFrame);
|
||||
nsLayoutAtoms::floatList, childFrame);
|
||||
|
||||
// Remove the placeholder frame first (XXX second for now) (so
|
||||
// that it doesn't retain a dangling pointer to memory)
|
||||
|
@ -9653,8 +9653,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext,
|
||||
parentFrame),
|
||||
GetFloaterContainingBlock(aPresContext,
|
||||
parentFrame));
|
||||
GetFloatContainingBlock(aPresContext,
|
||||
parentFrame));
|
||||
RecoverLetterFrames(shell, aPresContext, state, containingBlock);
|
||||
}
|
||||
|
||||
|
@ -9939,7 +9939,7 @@ nsCSSFrameConstructor::ContentChanged(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(aContent));
|
||||
if (textContent) {
|
||||
// Ok, it's text content. Now do some real work...
|
||||
nsIFrame* block = GetFloaterContainingBlock(aPresContext, frame);
|
||||
nsIFrame* block = GetFloatContainingBlock(aPresContext, frame);
|
||||
if (block) {
|
||||
// See if the block has first-letter style applied to it.
|
||||
nsIContent* blockContent = block->GetContent();
|
||||
|
@ -10592,7 +10592,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
// new frame
|
||||
frameManager->RegisterPlaceholderFrame(placeholderFrame);
|
||||
|
||||
// XXX Work around a bug in the block code where the floater won't get
|
||||
// XXX Work around a bug in the block code where the float won't get
|
||||
// reflowed unless the line containing the placeholder frame is reflowed...
|
||||
placeholderFrame->GetParent()->
|
||||
ReflowDirtyChild(aPresShell, placeholderFrame);
|
||||
|
@ -10605,34 +10605,34 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
// It's an OBJECT, EMBED, or APPLET, so we should display the contents
|
||||
// instead
|
||||
nsIFrame* absoluteContainingBlock;
|
||||
nsIFrame* floaterContainingBlock;
|
||||
nsIFrame* floatContainingBlock;
|
||||
nsIFrame* inFlowParent = parentFrame;
|
||||
|
||||
// If the OBJECT frame is out-of-flow, then get the placeholder frame's
|
||||
// parent and use that when determining the absolute containing block and
|
||||
// floater containing block
|
||||
// float containing block
|
||||
if (placeholderFrame) {
|
||||
inFlowParent = placeholderFrame->GetParent();
|
||||
}
|
||||
|
||||
absoluteContainingBlock = GetAbsoluteContainingBlock(aPresContext, inFlowParent);
|
||||
floaterContainingBlock = GetFloaterContainingBlock(aPresContext, inFlowParent);
|
||||
floatContainingBlock = GetFloatContainingBlock(aPresContext, inFlowParent);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
// Verify that we calculated the same containing block
|
||||
if (listName.get() == nsLayoutAtoms::absoluteList) {
|
||||
NS_ASSERTION(absoluteContainingBlock == parentFrame,
|
||||
"wrong absolute containing block");
|
||||
} else if (listName.get() == nsLayoutAtoms::floaterList) {
|
||||
NS_ASSERTION(floaterContainingBlock == parentFrame,
|
||||
"wrong floater containing block");
|
||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
||||
NS_ASSERTION(floatContainingBlock == parentFrame,
|
||||
"wrong float containing block");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Now initialize the frame construction state
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
absoluteContainingBlock,
|
||||
floaterContainingBlock);
|
||||
floatContainingBlock);
|
||||
nsFrameItems frameItems;
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
|
||||
|
@ -10707,7 +10707,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
} else if (listName.get() == nsLayoutAtoms::fixedList) {
|
||||
newFrame = state.mFixedItems.childList;
|
||||
state.mFixedItems.childList = nsnull;
|
||||
} else if (listName.get() == nsLayoutAtoms::floaterList) {
|
||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
||||
newFrame = state.mFloatedItems.childList;
|
||||
state.mFloatedItems.childList = nsnull;
|
||||
}
|
||||
|
@ -10746,7 +10746,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
if (state.mFloatedItems.childList) {
|
||||
rv = state.mFloatedItems.containingBlock->AppendFrames(aPresContext,
|
||||
*presShell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -10826,7 +10826,7 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
|
|||
// XXX Deal with absolute and fixed frames...
|
||||
if (state.mFloatedItems.childList) {
|
||||
captionFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
newChildFrames.AddChild(captionFrame);
|
||||
|
@ -12486,19 +12486,19 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
nsIFrame* aBlockFrame,
|
||||
PRBool* aStopLooking)
|
||||
{
|
||||
// First look for the floater frame that is a letter frame
|
||||
nsIFrame* floater;
|
||||
aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floaterList, &floater);
|
||||
while (floater) {
|
||||
// First look for the float frame that is a letter frame
|
||||
nsIFrame* floatFrame;
|
||||
aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floatList, &floatFrame);
|
||||
while (floatFrame) {
|
||||
// See if we found a floating letter frame
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
floater->GetFrameType(getter_AddRefs(frameType));
|
||||
floatFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (nsLayoutAtoms::letterFrame == frameType.get()) {
|
||||
break;
|
||||
}
|
||||
floater = floater->GetNextSibling();
|
||||
floatFrame = floatFrame->GetNextSibling();
|
||||
}
|
||||
if (!floater) {
|
||||
if (!floatFrame) {
|
||||
// No such frame
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12506,7 +12506,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// Take the text frame away from the letter frame (so it isn't
|
||||
// destroyed when we destroy the letter frame).
|
||||
nsIFrame* textFrame;
|
||||
floater->FirstChild(aPresContext, nsnull, &textFrame);
|
||||
floatFrame->FirstChild(aPresContext, nsnull, &textFrame);
|
||||
if (!textFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12514,7 +12514,8 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// Discover the placeholder frame for the letter frame
|
||||
nsIFrame* parentFrame;
|
||||
nsPlaceholderFrame* placeholderFrame;
|
||||
aFrameManager->GetPlaceholderFrameFor(floater, (nsIFrame**)&placeholderFrame);
|
||||
aFrameManager->GetPlaceholderFrameFor(floatFrame,
|
||||
(nsIFrame**)&placeholderFrame);
|
||||
if (!placeholderFrame) {
|
||||
// Somethings really wrong
|
||||
return NS_OK;
|
||||
|
@ -12581,10 +12582,10 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// and skip this call?
|
||||
aFrameManager->UnregisterPlaceholderFrame(placeholderFrame);
|
||||
|
||||
// Remove the floater frame
|
||||
DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, floater);
|
||||
aFrameManager->RemoveFrame(aBlockFrame, nsLayoutAtoms::floaterList,
|
||||
floater);
|
||||
// Remove the float frame
|
||||
DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, floatFrame);
|
||||
aFrameManager->RemoveFrame(aBlockFrame, nsLayoutAtoms::floatList,
|
||||
floatFrame);
|
||||
|
||||
// Remove placeholder frame
|
||||
aFrameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
|
||||
|
@ -12713,10 +12714,10 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont
|
|||
parentFrame->InsertFrames(aPresContext, *aState.mPresShell.get(),
|
||||
nsnull, prevFrame, letterFrames.childList);
|
||||
|
||||
// Insert in floaters too if needed
|
||||
// Insert in floats too if needed
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aBlockFrame->AppendFrames(aPresContext, *aState.mPresShell.get(),
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -12747,7 +12748,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
|
|||
nsFrameItems frameItems;
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, aParentFrame),
|
||||
GetFloaterContainingBlock(aPresContext, aParentFrame),
|
||||
GetFloatContainingBlock(aPresContext, aParentFrame),
|
||||
mTempFrameTreeState);
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
|
@ -12810,7 +12811,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
|
|||
// determine where in the list they should be inserted...
|
||||
if (state.mFloatedItems.childList) {
|
||||
rv = state.mFloatedItems.containingBlock->AppendFrames(aPresContext, *shell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -12846,7 +12847,7 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||
|
||||
// If we're the first block to be created (e.g., because we're
|
||||
// contained inside a XUL document), then make sure that we've got a
|
||||
// space manager so we can handle floaters...
|
||||
// space manager so we can handle floats...
|
||||
if (! aState.mFloatedItems.containingBlock) {
|
||||
aNewFrame->AddStateBits(NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
@ -12865,8 +12866,8 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||
|
||||
// Process the child content
|
||||
nsFrameItems childItems;
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(aNewFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(aNewFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
|
||||
|
@ -12880,10 +12881,10 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||
// Set the frame's initial child list
|
||||
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||
|
||||
// Set the frame's floater list if there were any floated children
|
||||
// Set the frame's float list if there were any floated children
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
// and the same for absolutely positioned children.
|
||||
|
@ -12961,7 +12962,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -13014,7 +13015,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -13055,7 +13056,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, blockFrame),
|
||||
GetFloaterContainingBlock(aPresContext, blockFrame));
|
||||
GetFloatContainingBlock(aPresContext, blockFrame));
|
||||
|
||||
MoveChildrenTo(aPresContext, blockSC, blockFrame, list2, &state);
|
||||
|
||||
|
@ -13640,9 +13641,9 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF
|
|||
// wraps some of its content in an anonymous block; see
|
||||
// ConstructInline)
|
||||
|
||||
// NOTE: We used to get the FloaterContainingBlock here, but it was often wrong.
|
||||
// NOTE: We used to get the FloatContainingBlock here, but it was often wrong.
|
||||
// GetIBContainingBlock works much better and provides the correct container in all cases
|
||||
// so GetFloaterContainingBlock(aPresContext, aFrame) has been removed
|
||||
// so GetFloatContainingBlock(aPresContext, aFrame) has been removed
|
||||
|
||||
// And get the containingBlock's content
|
||||
nsCOMPtr<nsIContent> blockContent = containingBlock->GetContent();
|
||||
|
|
|
@ -658,8 +658,8 @@ protected:
|
|||
nsIFrame* GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
nsIFrame* GetFloaterContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
nsIFrame* GetFloatContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
|
||||
// Build a scroll frame:
|
||||
|
|
|
@ -522,14 +522,14 @@ nsFocusIterator::GetRealFrame(nsIFrame* aFrame)
|
|||
{
|
||||
nsIFrame* result = aFrame;
|
||||
|
||||
// See if it's a placeholder frame for a floater.
|
||||
// See if it's a placeholder frame for a float.
|
||||
if (aFrame) {
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get());
|
||||
if (isPlaceholder) {
|
||||
// Get the out-of-flow frame that the placeholder points to.
|
||||
// This is the real floater that we should examine.
|
||||
// This is the real float that we should examine.
|
||||
result = NS_STATIC_CAST(nsPlaceholderFrame*,aFrame)->GetOutOfFlowFrame();
|
||||
NS_ASSERTION(result, "No out of flow frame found for placeholder!\n");
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ LAYOUT_ATOM(captionList, "Caption-list")
|
|||
LAYOUT_ATOM(colGroupList, "ColGroup-list")
|
||||
LAYOUT_ATOM(editorDisplayList, "EditorDisplay-List")
|
||||
LAYOUT_ATOM(fixedList, "Fixed-list")
|
||||
LAYOUT_ATOM(floaterList, "Floater-list")
|
||||
LAYOUT_ATOM(floatList, "Float-list")
|
||||
LAYOUT_ATOM(overflowList, "Overflow-list")
|
||||
LAYOUT_ATOM(popupList, "Popup-list")
|
||||
|
||||
|
@ -224,7 +224,7 @@ LAYOUT_ATOM(imageMap, "ImageMap")
|
|||
LAYOUT_ATOM(lineBoxBig, "LineBox:inline,big")
|
||||
LAYOUT_ATOM(lineBoxBlockBig, "LineBox:block,big")
|
||||
LAYOUT_ATOM(lineBoxBlockSmall, "LineBox:block,small")
|
||||
LAYOUT_ATOM(lineBoxFloaters, "LineBoxFloaters")
|
||||
LAYOUT_ATOM(lineBoxFloats, "LineBoxFloats")
|
||||
LAYOUT_ATOM(lineBoxSmall, "LineBox:inline,small")
|
||||
LAYOUT_ATOM(spaceManager, "SpaceManager")
|
||||
LAYOUT_ATOM(tableColCache, "TableColumnCache")
|
||||
|
|
|
@ -5759,7 +5759,7 @@ PresShell::Paint(nsIView *aView,
|
|||
rv = frame->Paint(mPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
rv = frame->Paint(mPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
rv = frame->Paint(mPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
|
@ -6073,7 +6073,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
&mCurrentEventFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = frame->GetFrameForPoint(mPresContext, eventPoint,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS,
|
||||
NS_FRAME_PAINT_LAYER_FLOATS,
|
||||
&mCurrentEventFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = frame->GetFrameForPoint(mPresContext, eventPoint,
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef void
|
|||
|
||||
/**
|
||||
* Indication of how the frame can be split. This is used when doing runaround
|
||||
* of floaters, and when pulling up child frames from a next-in-flow.
|
||||
* of floats, and when pulling up child frames from a next-in-flow.
|
||||
*
|
||||
* The choices are splittable, not splittable at all, and splittable in
|
||||
* a non-rectangular fashion. This last type only applies to block-level
|
||||
|
@ -265,7 +265,7 @@ enum nsSpread {
|
|||
// For HTML reflow we rename with the different paint layers are
|
||||
// actually used for.
|
||||
#define NS_FRAME_PAINT_LAYER_BACKGROUND eFramePaintLayer_Underlay
|
||||
#define NS_FRAME_PAINT_LAYER_FLOATERS eFramePaintLayer_Content
|
||||
#define NS_FRAME_PAINT_LAYER_FLOATS eFramePaintLayer_Content
|
||||
#define NS_FRAME_PAINT_LAYER_FOREGROUND eFramePaintLayer_Overlay
|
||||
#define NS_FRAME_PAINT_LAYER_DEBUG eFramePaintLayer_Overlay
|
||||
|
||||
|
|
|
@ -522,14 +522,14 @@ nsFocusIterator::GetRealFrame(nsIFrame* aFrame)
|
|||
{
|
||||
nsIFrame* result = aFrame;
|
||||
|
||||
// See if it's a placeholder frame for a floater.
|
||||
// See if it's a placeholder frame for a float.
|
||||
if (aFrame) {
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get());
|
||||
if (isPlaceholder) {
|
||||
// Get the out-of-flow frame that the placeholder points to.
|
||||
// This is the real floater that we should examine.
|
||||
// This is the real float that we should examine.
|
||||
result = NS_STATIC_CAST(nsPlaceholderFrame*,aFrame)->GetOutOfFlowFrame();
|
||||
NS_ASSERTION(result, "No out of flow frame found for placeholder!\n");
|
||||
}
|
||||
|
|
|
@ -969,7 +969,7 @@ nsSpaceManager::PushState()
|
|||
// of mBandList and mFrameInfoMap and restore them when pop is
|
||||
// called, but I'm not sure it's worth the effort/bloat at this
|
||||
// point, since this push/pop mechanism is only used to undo any
|
||||
// floaters that were added during the unconstrained reflow
|
||||
// floats that were added during the unconstrained reflow
|
||||
// in nsBlockReflowContext::DoReflowBlock(). (See bug 96736)
|
||||
//
|
||||
// It should also be noted that the state for mFloatDamage is
|
||||
|
|
|
@ -28,7 +28,7 @@ a canvas. The primary goal of the Space Manager is to provide information
|
|||
<br>
|
||||
There are three important parts to the Space Manger API: the parts that
|
||||
deal with the coordinate space of the Space Manager, the parts that deal with
|
||||
the regions managed by the Space Manager, and the parts that manage floater
|
||||
the regions managed by the Space Manager, and the parts that manage float
|
||||
impact intervals.<br>
|
||||
<br>
|
||||
The class nsSpaceManager is declared in the file <a href="http://lxr.mozilla.org/seamonkey/source/layout/base/src/nsSpaceManager.h">
|
||||
|
@ -75,7 +75,7 @@ terminated.<br>
|
|||
|
||||
<pre> /**<br> * Returns a band starting at the specified y-offset. The band data<br> * indicates which parts of the band are available, and which parts<br> * are unavailable<br> *<br> * The band data that is returned is in the coordinate space of the<br> * local coordinate system.<br> *<br> * The local coordinate space origin, the y-offset, and the max size<br> * describe a rectangle that's used to clip the underlying band of<br> * available space, i.e.<br> * {0, aYOffset, aMaxSize.width, aMaxSize.height} in the local<br> * coordinate space<br> *<br> * @param aYOffset the y-offset of where the band begins. The coordinate is<br> * relative to the upper-left corner of the local coordinate space<br> * @param aMaxSize the size to use to constrain the band data<br> * @param aBandData [in,out] used to return the list of trapezoids that<br> * describe the available space and the unavailable space<br> * @return NS_OK if successful and NS_ERROR_FAILURE if the band data is not<br> * not large enough. The 'count' member of the band data struct<br> * indicates how large the array of trapezoids needs to be<br> */<br> nsresult GetBandData(nscoord aYOffset,<br> const nsSize& aMaxSize,<br> nsBandData& aBandData) const;<br><br> /**<br> * Add a rectangular region of unavailable space. The space is<br> * relative to the local coordinate system.<br> *<br> * The region is tagged with a frame<br> *<br> * @param aFrame the frame used to identify the region. Must not be NULL<br> * @param aUnavailableSpace the bounding rect of the unavailable space<br> * @return NS_OK if successful<br> * NS_ERROR_FAILURE if there is already a region tagged with aFrame<br> */<br> nsresult AddRectRegion(nsIFrame* aFrame,<br> const nsRect& aUnavailableSpace);<br><br> /**<br> * Resize the rectangular region associated with aFrame by the specified<br> * deltas. The height change always applies to the bottom edge or the existing<br> * rect. You specify whether the width change applies to the left or right edge<br> *<br> * Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region<br> * tagged with aFrame<br> */<br> enum AffectedEdge {LeftEdge, RightEdge};<br> nsresult ResizeRectRegion(nsIFrame* aFrame,<br> nscoord aDeltaWidth,<br> nscoord aDeltaHeight,<br> AffectedEdge aEdge = RightEdge);<br><br> /**<br> * Offset the region associated with aFrame by the specified amount.<br> *<br> * Returns NS_OK if successful, NS_ERROR_INVALID_ARG if there is no region<br> * tagged with aFrame<br> */<br> nsresult OffsetRegion(nsIFrame* aFrame, nscoord dx, nscoord dy);<br><br> /**<br> * Remove the region associated with aFrane.<br> *<br> * Returns NS_OK if successful and NS_ERROR_INVALID_ARG if there is no region<br> * tagged with aFrame<br> */<br> nsresult RemoveRegion(nsIFrame* aFrame);<br><br> /**<br> * Clears the list of regions representing the unavailable space.<br> */<br> void ClearRegions();<br></pre>
|
||||
|
||||
<h4>Floater Impact</h4>
|
||||
<h4>Float Impact</h4>
|
||||
|
||||
<pre> /**<br> * Methods for dealing with the propagation of float damage during<br> * reflow.<br> */<br> PRBool HasFloatDamage()<br> {<br> return !mFloatDamage.IsEmpty();<br> }<br><br> void IncludeInDamage(nscoord aIntervalBegin, nscoord aIntervalEnd)<br> {<br> mFloatDamage.IncludeInterval(aIntervalBegin + mY, aIntervalEnd + mY);<br> }<br><br> PRBool IntersectsDamage(nscoord aIntervalBegin, nscoord aIntervalEnd)<br> {<br> return mFloatDamage.Intersects(aIntervalBegin + mY, aIntervalEnd + mY);<br> }<br></pre>
|
||||
|
||||
|
@ -225,7 +225,7 @@ might be worth verifying that the final result of the inserts is a correctly
|
|||
ordered liest of bandRects (debug mode only).</i><br>
|
||||
|
||||
<h4>Algorithm 3: RemoveRegion</h4>
|
||||
When a floater is removed, the Space Manager is notified by a call to RemoveRegion,
|
||||
When a float is removed, the Space Manager is notified by a call to RemoveRegion,
|
||||
passing in the frame that is being removed.<br>
|
||||
<ul>
|
||||
<li>Get the FrameInfo for the frame passed in. If not found, an error is
|
||||
|
|
|
@ -50,24 +50,24 @@ job. The classes that are considered part of the Space Manager are:<br>
|
|||
frame in the context of a Reflow, and to associate it with the BlockReflowState
|
||||
so it is passed down to child frames' reflow methods. After reflow, the
|
||||
Space Manager is destroyed. During reflow, the space manager stores
|
||||
the space taken up by floaters (UpdateSpaceManager in nsBlockFrame) and
|
||||
the space taken up by floats (UpdateSpaceManager in nsBlockFrame) and
|
||||
provides information about the space available for other elements (GetAvailableSpace
|
||||
in nsBlockReflowState). <br>
|
||||
<br>
|
||||
Additionally, there is a need to manage impacts to lines caused by
|
||||
changes to floated elements. This is referred to as Propagation
|
||||
of Floater Damage and is handled by the Block Frame, making use of the
|
||||
of Float Damage and is handled by the Block Frame, making use of the
|
||||
Space Manager. When a float is incrementally reflowed, the Space
|
||||
Manger is notified if the floater's region has changed. If so, the
|
||||
Manger is notified if the float's region has changed. If so, the
|
||||
vertical space that has been affected (including both the float's old
|
||||
region and the float's new region) is noted in the internal
|
||||
nsIntervalSet as potential floater damage (the method is
|
||||
nsIntervalSet as potential float damage (the method is
|
||||
IncludeInDamage). During the incremental reflow of dirty lines the
|
||||
block frame may encounter lines that are NOT dirty. In this case the
|
||||
Space Manager is also asked if there is any floater damage, and
|
||||
Space Manager is also asked if there is any float damage, and
|
||||
if there is then the block further checks to see if that damage
|
||||
intersects the area of the non-dirty line, marking it dirty if there
|
||||
is intersection. Thus, changes to floaters on other lines may
|
||||
is intersection. Thus, changes to floats on other lines may
|
||||
cause impact to otherwise clean lines, and the Space Manager
|
||||
facilitates the detection of this. <h2>Data Model</h2>
|
||||
|
||||
|
@ -81,12 +81,12 @@ facilitates the detection of this. <h2>Data Model</h2>
|
|||
|
||||
<ul>
|
||||
<li>nsSpaceManager: The central point of management of the space taken
|
||||
up by floaters in a block</li>
|
||||
up by floats in a block</li>
|
||||
<li>nsBandData: Provides information about the frames occupying a band
|
||||
of occupied or available space</li>
|
||||
<li>nsBlockBandData: A specialization of nsBandData that is used by
|
||||
nsBlockReflowState to determine the available space, floater impacts, and
|
||||
where floaters are cleared. Essentially a CSS-specific wrapper for
|
||||
nsBlockReflowState to determine the available space, float impacts, and
|
||||
where floats are cleared. Essentially a CSS-specific wrapper for
|
||||
generic nsBandData.</li>
|
||||
<li>BandRect: Keeps the bounds of a band, along with the frames associated
|
||||
with the band. BandRects are a linked list (provided by PRCListStr
|
||||
|
@ -130,17 +130,17 @@ BlockReflowState instance after the new one has been destroyed. Thus,
|
|||
Space Managers are effectively 'nested' during reflow, with each new block
|
||||
introducing its own Space Manager.
|
||||
|
||||
<h4>Use Case 2: Floater is added to the Space Manager</h4> After a Space Manager is created for a block context's reflow chain, a
|
||||
floated block may be added to it. This happens in the method <i>nsBlockReflowState::RecoverFloaters</i> and
|
||||
<i>nsBlockReflowState::FlowAndPlaceFloater</i> (formerly this was done in nsBlockFrame::UpdateSpaceManager). <br>
|
||||
<h4>Use Case 2: Float is added to the Space Manager</h4> After a Space Manager is created for a block context's reflow chain, a
|
||||
floated block may be added to it. This happens in the method <i>nsBlockReflowState::RecoverFloats</i> and
|
||||
<i>nsBlockReflowState::FlowAndPlaceFloat</i> (formerly this was done in nsBlockFrame::UpdateSpaceManager). <br>
|
||||
<br>
|
||||
The general algorightm in <i>nsBlockReflowState::RecoverFloaters</i> is:<br>
|
||||
The general algorightm in <i>nsBlockReflowState::RecoverFloats</i> is:<br>
|
||||
|
||||
<ul>
|
||||
<li>For each line in the block, see if it has floated blocks</li>
|
||||
<li>If floaters are in the line, iterate over the floaters and add each
|
||||
<li>If floats are in the line, iterate over the floats and add each
|
||||
one to the Space Manger via the AddRectRegion method. The actual rect
|
||||
for the frame is cached in an nsFloaterCache so it does not have to be recomputed.</li>
|
||||
for the frame is cached in an nsFloatCache so it does not have to be recomputed.</li>
|
||||
<li>If the block has any block children, then translate the Space Manager
|
||||
to the child block's origin and update the space manager in the context
|
||||
for the child block, recursively. When done with the child, restore the Space
|
||||
|
@ -150,19 +150,19 @@ origin. <br>
|
|||
|
||||
</ul><br>
|
||||
|
||||
The general algorightm in <i>nsBlockReflowState::FlowAndPlaceFloater</i> is:<br>
|
||||
The general algorightm in <i>nsBlockReflowState::FlowAndPlaceFloat</i> is:<br>
|
||||
<ul>
|
||||
<li>The region that the float currently occupies is recorded.</li>
|
||||
<li>The band of available space is searched (with nsBlockReflowState::GetAvailableSpace);</li>
|
||||
<li>The floater frame that is get from the passed nsFloaterCache argument is reflowed
|
||||
<li>The float frame that is get from the passed nsFloatCache argument is reflowed
|
||||
and its rect is retriven with GetRect;</li>
|
||||
<li>The floaters margins are added;</li>
|
||||
<li>Check if the floater can be placed in the acutal band: if not advance to the next band;</li>
|
||||
<li>Check the floater type and if it can be added to the space manager;</li>
|
||||
<li>Align the floater to its containing block top if rule
|
||||
<li>The floats margins are added;</li>
|
||||
<li>Check if the float can be placed in the acutal band: if not advance to the next band;</li>
|
||||
<li>Check the float type and if it can be added to the space manager;</li>
|
||||
<li>Align the float to its containing block top if rule
|
||||
<a href="http://www.w3.org/TR/REC-CSS2/visuren.html#float-position">CSS2/9.5.1/4</a>
|
||||
is not respected;</li>
|
||||
<li>Add the floater using <i>nsSpaceManager::AddRectRegion</i> </li>
|
||||
<li>Add the float using <i>nsSpaceManager::AddRectRegion</i> </li>
|
||||
<li>Compare the area that the float used to occupy with the area that it now occupies: if different,
|
||||
record the vertically affected interval using <i>nsSpaceManager::IncludeInDamage</i></li>
|
||||
</ul>
|
||||
|
@ -176,7 +176,7 @@ works for reflowing an inline frame within a block (this also occurs for
|
|||
reflowing a block frame and, partially, for preparing for a resize reflow).<br>
|
||||
|
||||
<ul>
|
||||
<li>nsBlockFrame first frees all floater information for the line that
|
||||
<li>nsBlockFrame first frees all float information for the line that
|
||||
is being reflowed.</li>
|
||||
<li>GetAvailableSpace is called on the BlockReflowState</li>
|
||||
<li>the BlockReflowState calls GetAvailableSpace on its BlockBandData
|
||||
|
@ -193,26 +193,26 @@ and determines the right-most edge of the available space.</li>
|
|||
|
||||
</ul>
|
||||
|
||||
<h4>Use Case 4: Propagation of Floater Damage: detecting and handling floater
|
||||
<h4>Use Case 4: Propagation of Float Damage: detecting and handling float
|
||||
damage</h4>
|
||||
This process is driven by the Block Frame.<br>
|
||||
|
||||
<ul>
|
||||
<li>A non-dirty line is encountered by the Block Frame in ReflowDirtyLines</li>
|
||||
<li>Block Frame calls its PropagateFloaterDamage method</li>
|
||||
<li>The Space Manger is checked to see if ther is any floater damage</li>
|
||||
<li>Block Frame calls its PropagateFloatDamage method</li>
|
||||
<li>The Space Manger is checked to see if ther is any float damage</li>
|
||||
<li>If there is, then the block frame asks the Space Manager if the
|
||||
line in question intersects the floater damage</li>
|
||||
line in question intersects the float damage</li>
|
||||
<li>If the line does intersect a damage interval, then the line is marked
|
||||
dirty</li>
|
||||
<li>If the line does not intersect a damage interval, it may still be
|
||||
marked dirty if:</li>
|
||||
|
||||
<ul>
|
||||
<li>it was impacted by floaters before, but is not any longer</li>
|
||||
<li>it was not impacted by floaters befre, but is now</li>
|
||||
<li>it was impacted by floats before, but is not any longer</li>
|
||||
<li>it was not impacted by floats befre, but is now</li>
|
||||
<li><a name="block-line-impact"></a>
|
||||
it is impacted by floaters and is a block<br>
|
||||
it is impacted by floats and is a block<br>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
@ -231,7 +231,7 @@ private (compiles fine)</li>
|
|||
no subclasses. Should be private (compiles fine)</li>
|
||||
<li>nsBlockFrame::Paint is mucking with nsBlockBandData in and #if 0
|
||||
block - remove that and the include (compiles fine)</li>
|
||||
<li>nsSpaceManger has no way of clearing the floater damage interval
|
||||
<li>nsSpaceManger has no way of clearing the float damage interval
|
||||
set - this might be needed if the SpaceManager persists beyond a Reflow</li>
|
||||
</ul>
|
||||
<br>
|
||||
|
|
|
@ -67,7 +67,7 @@ contributors find information on small topics and issues, including simple
|
|||
<p class="wip">Tables balancing (karnaze)
|
||||
<p class="wip">Table Borders collapsing (karnaze)
|
||||
<p class="wip">Block in Inline situations (kin)
|
||||
<p class="good"><a href="http://lxr.mozilla.org/seamonkey/source/layout/doc/HLD-SpaceManager.html">Managing Floaters</a>
|
||||
<p class="good"><a href="http://lxr.mozilla.org/seamonkey/source/layout/doc/HLD-SpaceManager.html">Managing Floats</a>
|
||||
<p class="unassigned">Text Measurement and Text Breaking
|
||||
<p class="unassigned">Image loading and display
|
||||
<p class="unassigned">Margin Collapsing
|
||||
|
|
|
@ -19,7 +19,7 @@ into "lines" and applying all of the css behavior as one might expect,
|
|||
including line-height, vertical-align, relative positioning, etc.</li>
|
||||
|
||||
<li>
|
||||
Floater management. The block is responsible for the reflow and placement
|
||||
Float management. The block is responsible for the reflow and placement
|
||||
of floating elements.</li>
|
||||
|
||||
<li>
|
||||
|
@ -121,22 +121,22 @@ premature breaking.
|
|||
<p>Lines also keep track of the type of "break" that occurred on the line.
|
||||
This is used, for example, to support html's "<br clear=left>" behavior.
|
||||
<h3>
|
||||
<u>Floater Management</u></h3>
|
||||
Since child block elements are containing blocks for floaters, the only
|
||||
place where a block frame will see a floater is as part of an inline line.
|
||||
Consequently, the nsLineBox will only keep track of floaters on inline
|
||||
<u>Float Management</u></h3>
|
||||
Since child block elements are containing blocks for floats, the only
|
||||
place where a block frame will see a float is as part of an inline line.
|
||||
Consequently, the nsLineBox will only keep track of floats on inline
|
||||
lines (saving storage for block lines).
|
||||
<p>The nsLineLayout class and the block frame cooperate in the management
|
||||
of floaters. Since the frame construction code leaves a "placeholder" frame
|
||||
in-flow where the floater was found, when nsLineLayout reflows a placeholder
|
||||
frame it knows to inform the block about it. That triggers the blocks "AddFloater"
|
||||
logic which then determines where the floater should be placed (on the
|
||||
of floats. Since the frame construction code leaves a "placeholder" frame
|
||||
in-flow where the float was found, when nsLineLayout reflows a placeholder
|
||||
frame it knows to inform the block about it. That triggers the blocks "AddFloat"
|
||||
logic which then determines where the float should be placed (on the
|
||||
current line or below the current line).
|
||||
<p>The block frame uses the space manager to manage the effects of floaters,
|
||||
<p>The block frame uses the space manager to manage the effects of floats,
|
||||
namely the consumption of available space. For example, for a left aligned
|
||||
floating element, the inline elements must be placed to the right of the
|
||||
floater. To simplify this process, the spacemanager is used to keep track
|
||||
of available and busy space. Floaters when placed mark space as busy and
|
||||
float. To simplify this process, the spacemanager is used to keep track
|
||||
of available and busy space. Floats when placed mark space as busy and
|
||||
the spacemanager will them compute the available space. Most of this logic
|
||||
is handled by the nsBlockReflowState which uses a helper class, nsBlockBandData,
|
||||
in concert with the space manager, to do the available space computations.
|
||||
|
|
|
@ -89,7 +89,7 @@ above.</li>
|
|||
<li>
|
||||
Give a description of how the above classes interact with each other as
|
||||
a simple HTML document is laid out. Then, add in different features
|
||||
to the HTML that exercise different areas of the code, like floaters, anonymous
|
||||
to the HTML that exercise different areas of the code, like floats, anonymous
|
||||
blocks, etc.</li>
|
||||
</ol>
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ element), a placeholder frame is also created. The placeholder frame is inserted
|
|||
into the flow exactly where the out-of-flow frame would have been inserted.
|
||||
The out-of-flow frame is then inserted as a child of its containing block in
|
||||
one of the additional child lists. Floated frames are inserted into the
|
||||
"Floater-list" and absolutely positioned frames are inserted into the
|
||||
"Float-list" and absolutely positioned frames are inserted into the
|
||||
"Absolute-list".</Body>
|
||||
|
||||
<SectionHeading>Frame Manager</SectionHeading>
|
||||
|
@ -250,7 +250,7 @@ in mozilla/layout/html/src:
|
|||
</Body>
|
||||
|
||||
<Body><RunIn>The core frame classes</RunIn> implement the CSS viewport abstraction, scrolling,
|
||||
block and inline display of flowed elements, floaters, and absolute positioning.</Body>
|
||||
block and inline display of flowed elements, floats, and absolute positioning.</Body>
|
||||
|
||||
<Body>For more information on block layout, click
|
||||
<A xlink:type="simple" xlink:show="replace" xlink:href="block.html">here</A>. For more information about
|
||||
|
|
|
@ -59,8 +59,8 @@ for it (if it doesn't already have one).</li>
|
|||
<li>
|
||||
NS_INLINE_BREAK - some kind of break has been requested. Breaks types include
|
||||
simple line breaks (like the BR tag in html sometime does) and more complex
|
||||
breaks like page breaks, floater breaks, etc. Currently, we only support
|
||||
line breaks, and floater clearing breaks. Breaks can occur before the frame
|
||||
breaks like page breaks, float breaks, etc. Currently, we only support
|
||||
line breaks, and float clearing breaks. Breaks can occur before the frame
|
||||
(NS_INLINE_IS_BREAK_BEFORE) or after the frame (NS_INLINE_IS_BREAK_AFTER)</li>
|
||||
</ul>
|
||||
The handling of the reflow status is done by the container frame using
|
||||
|
|
|
@ -2403,7 +2403,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
|
|
|
@ -412,12 +412,12 @@ nsFormControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
|
||||
rv = nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
// draw selection borders when appropriate
|
||||
rv = nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -445,7 +445,7 @@ nsFormControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsLeafFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS, aFrame);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS, aFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsLeafFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
|
|
|
@ -363,7 +363,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
|
||||
#if 0 // old way
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
#else // temporary
|
||||
|
@ -384,7 +384,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
aRenderingContext.SetClipRect(rect, nsClipCombine_kIntersect, clipEmpty);
|
||||
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
aRenderingContext.PopState(clipEmpty);
|
||||
|
|
|
@ -1985,7 +1985,7 @@ nsTextControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) {
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
}
|
||||
|
@ -2006,7 +2006,7 @@ nsTextControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsStackFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS, aFrame);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS, aFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsStackFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
|
|
|
@ -141,9 +141,9 @@ BRFrame::Reflow(nsIPresContext* aPresContext,
|
|||
if (ll) {
|
||||
// Note that the compatibility mode check excludes AlmostStandards
|
||||
// mode, since this is the inline box model. See bug 161691.
|
||||
if ( ll->CanPlaceFloaterNow() ||
|
||||
if ( ll->CanPlaceFloatNow() ||
|
||||
ll->GetCompatMode() == eCompatibility_FullStandards ) {
|
||||
// If we can place a floater on the line now it means that the
|
||||
// If we can place a float on the line now it means that the
|
||||
// line is effectively empty (there may be zero sized compressed
|
||||
// white-space frames on the line, but they are to be ignored).
|
||||
//
|
||||
|
|
|
@ -71,8 +71,8 @@ nsBlockBandData::Init(nsSpaceManager* aSpaceManager,
|
|||
aSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY);
|
||||
|
||||
mSpace = aSpace;
|
||||
mLeftFloaters = 0;
|
||||
mRightFloaters = 0;
|
||||
mLeftFloats = 0;
|
||||
mRightFloats = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ nsBlockBandData::GetAvailableSpace(nscoord aY, nsRect& aResult)
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
|
||||
// Compute the bounding rect of the available space, i.e. space
|
||||
// between any left and right floaters.
|
||||
// between any left and right floats.
|
||||
ComputeAvailSpaceRect();
|
||||
aResult = mAvailSpace;
|
||||
#ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT
|
||||
|
@ -142,7 +142,7 @@ nsBlockBandData::GetBandData(nscoord aY)
|
|||
|
||||
/**
|
||||
* Computes the bounding rect of the available space, i.e. space
|
||||
* between any left and right floaters. Uses the current trapezoid
|
||||
* between any left and right floats. Uses the current trapezoid
|
||||
* data, see nsISpaceManager::GetBandData(). Also updates member
|
||||
* data "availSpace".
|
||||
*/
|
||||
|
@ -157,22 +157,22 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
mAvailSpace.y = 0;
|
||||
mAvailSpace.width = 0;
|
||||
mAvailSpace.height = 0;
|
||||
mLeftFloaters = 0;
|
||||
mRightFloaters = 0;
|
||||
mLeftFloats = 0;
|
||||
mRightFloats = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
nsBandTrapezoid* trapezoid = mTrapezoids;
|
||||
nsBandTrapezoid* rightTrapezoid = nsnull;
|
||||
|
||||
PRInt32 leftFloaters = 0;
|
||||
PRInt32 rightFloaters = 0;
|
||||
PRInt32 leftFloats = 0;
|
||||
PRInt32 rightFloats = 0;
|
||||
if (mCount > 1) {
|
||||
// If there's more than one trapezoid that means there are floaters
|
||||
// If there's more than one trapezoid that means there are floats
|
||||
PRInt32 i;
|
||||
|
||||
// Examine each trapezoid in the band, counting up the number of
|
||||
// left and right floaters. Use the right-most floater to
|
||||
// left and right floats. Use the right-most float to
|
||||
// determine where the right edge of the available space is.
|
||||
NS_PRECONDITION(mCount<=mSize, "bad state, count > size");
|
||||
for (i = 0; i < mCount; i++) {
|
||||
|
@ -188,10 +188,10 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
nsIFrame* f = (nsIFrame*) trapezoid->mFrames->ElementAt(j);
|
||||
const nsStyleDisplay* display = f->GetStyleDisplay();
|
||||
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
|
||||
leftFloaters++;
|
||||
leftFloats++;
|
||||
}
|
||||
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
|
||||
rightFloaters++;
|
||||
rightFloats++;
|
||||
if ((nsnull == rightTrapezoid) && (i > 0)) {
|
||||
rightTrapezoid = &mTrapezoids[i - 1];
|
||||
}
|
||||
|
@ -200,10 +200,10 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
} else {
|
||||
const nsStyleDisplay* display = trapezoid->mFrame->GetStyleDisplay();
|
||||
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
|
||||
leftFloaters++;
|
||||
leftFloats++;
|
||||
}
|
||||
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
|
||||
rightFloaters++;
|
||||
rightFloats++;
|
||||
if ((nsnull == rightTrapezoid) && (i > 0)) {
|
||||
rightTrapezoid = &mTrapezoids[i - 1];
|
||||
}
|
||||
|
@ -213,14 +213,14 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
}
|
||||
}
|
||||
else if (mTrapezoids[0].mState != nsBandTrapezoid::Available) {
|
||||
// We have a floater using up all the available space
|
||||
leftFloaters = 1;
|
||||
// We have a float using up all the available space
|
||||
leftFloats = 1;
|
||||
}
|
||||
#ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT
|
||||
printf("band %p has floaters %d, %d\n", this, leftFloaters, rightFloaters);
|
||||
printf("band %p has floats %d, %d\n", this, leftFloats, rightFloats);
|
||||
#endif
|
||||
mLeftFloaters = leftFloaters;
|
||||
mRightFloaters = rightFloaters;
|
||||
mLeftFloats = leftFloats;
|
||||
mRightFloats = rightFloats;
|
||||
|
||||
if (nsnull != rightTrapezoid) {
|
||||
trapezoid = rightTrapezoid;
|
||||
|
@ -233,8 +233,8 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {
|
||||
// It's not clear what coordinate to use when there is no
|
||||
// available space and the space is multiply occupied...So: If
|
||||
// any of the floaters that are a part of the trapezoid are left
|
||||
// floaters then we move over to the right edge of the
|
||||
// any of the floats that are a part of the trapezoid are left
|
||||
// floats then we move over to the right edge of the
|
||||
// unavaliable space.
|
||||
PRInt32 j, numFrames = trapezoid->mFrames->Count();
|
||||
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
|
||||
|
@ -291,9 +291,9 @@ nsBlockBandData::ShouldClearFrame(nsIFrame* aFrame, PRUint8 aBreakType)
|
|||
return result;
|
||||
}
|
||||
|
||||
// XXX optimization? use mFloaters to avoid doing anything
|
||||
// XXX optimization? use mFloats to avoid doing anything
|
||||
nscoord
|
||||
nsBlockBandData::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
||||
nsBlockBandData::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
||||
{
|
||||
for (;;) {
|
||||
nsresult rv = GetBandData(aY);
|
||||
|
@ -305,7 +305,7 @@ nsBlockBandData::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
|||
// Compute aYS as aY in space-manager "root" coordinates.
|
||||
nscoord aYS = aY + mSpaceManagerY;
|
||||
|
||||
// Find the largest frame YMost for the appropriate floaters in
|
||||
// Find the largest frame YMost for the appropriate floats in
|
||||
// this band.
|
||||
nscoord yMost = aYS;
|
||||
PRInt32 i;
|
||||
|
@ -332,7 +332,7 @@ nsBlockBandData::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
|||
}
|
||||
|
||||
// If yMost is unchanged (aYS) then there were no appropriate
|
||||
// floaters in the band. Time to stop clearing.
|
||||
// floats in the band. Time to stop clearing.
|
||||
if (yMost == aYS) {
|
||||
break;
|
||||
}
|
||||
|
@ -347,8 +347,8 @@ void nsBlockBandData::List()
|
|||
printf("nsBlockBandData %p sm=%p, sm coord = (%d,%d), mSpace = (%d,%d)\n",
|
||||
this, mSpaceManager, mSpaceManagerX, mSpaceManagerY,
|
||||
mSpace.width, mSpace.height);
|
||||
printf(" availSpace=(%d, %d, %d, %d), floaters l=%d r=%d\n",
|
||||
printf(" availSpace=(%d, %d, %d, %d), floats l=%d r=%d\n",
|
||||
mAvailSpace.x, mAvailSpace.y, mAvailSpace.width, mAvailSpace.height,
|
||||
mLeftFloaters, mRightFloaters);
|
||||
mLeftFloats, mRightFloats);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
// space manager translation.
|
||||
nsresult GetAvailableSpace(nscoord aY, nsRect& aResult);
|
||||
|
||||
// Clear any current floaters, returning a new Y coordinate
|
||||
nscoord ClearFloaters(nscoord aY, PRUint8 aBreakType);
|
||||
// Clear any current floats, returning a new Y coordinate
|
||||
nscoord ClearFloats(nscoord aY, PRUint8 aBreakType);
|
||||
|
||||
// Get the raw trapezoid count for this band.
|
||||
PRInt32 GetTrapezoidCount() const {
|
||||
|
@ -72,18 +72,18 @@ public:
|
|||
return &mTrapezoids[aIndex];
|
||||
}
|
||||
|
||||
// Get the number of floaters that are impacting the current
|
||||
// Get the number of floats that are impacting the current
|
||||
// band. Note that this value is relative to the current translation
|
||||
// in the space manager which means that some floaters may be hidden
|
||||
// in the space manager which means that some floats may be hidden
|
||||
// by the translation and therefore won't be in the count.
|
||||
PRInt32 GetFloaterCount() const {
|
||||
return mLeftFloaters + mRightFloaters;
|
||||
PRInt32 GetFloatCount() const {
|
||||
return mLeftFloats + mRightFloats;
|
||||
}
|
||||
PRInt32 GetLeftFloaterCount() const {
|
||||
return mLeftFloaters;
|
||||
PRInt32 GetLeftFloatCount() const {
|
||||
return mLeftFloats;
|
||||
}
|
||||
PRInt32 GetRightFloaterCount() const {
|
||||
return mRightFloaters;
|
||||
PRInt32 GetRightFloatCount() const {
|
||||
return mRightFloats;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -110,14 +110,14 @@ protected:
|
|||
// Trapezoids used during band processing
|
||||
nsBandTrapezoid mData[NS_BLOCK_BAND_DATA_TRAPS];
|
||||
|
||||
// Bounding rect of available space between any left and right floaters
|
||||
// Bounding rect of available space between any left and right floats
|
||||
nsRect mAvailSpace;
|
||||
|
||||
// Number of left/right floaters in the current band. Note that this
|
||||
// number may be less than the total number of floaters present in
|
||||
// Number of left/right floats in the current band. Note that this
|
||||
// number may be less than the total number of floats present in
|
||||
// the band, if our translation in the space manager "hides" some
|
||||
// floaters.
|
||||
PRInt32 mLeftFloaters, mRightFloaters;
|
||||
// floats.
|
||||
PRInt32 mLeftFloats, mRightFloats;
|
||||
|
||||
void ComputeAvailSpaceRect();
|
||||
PRBool ShouldClearFrame(nsIFrame* aFrame, PRUint8 aBreakType);
|
||||
|
|
|
@ -44,15 +44,15 @@
|
|||
#undef NOISY_MAX_ELEMENT_SIZE // enables debug output for max element size computation
|
||||
#undef NOISY_MAXIMUM_WIDTH // enables debug output for max width computation
|
||||
#undef NOISY_KIDXMOST // enables debug output for aState.mKidXMost computation
|
||||
#undef NOISY_FLOATER // enables debug output for floater reflow (the in/out metrics for the floated block)
|
||||
#undef NOISY_FLOATER_CLEARING
|
||||
#undef NOISY_FLOAT // enables debug output for float reflow (the in/out metrics for the floated block)
|
||||
#undef NOISY_FLOAT_CLEARING
|
||||
#undef NOISY_FINAL_SIZE // enables debug output for desired width/height computation, once all children have been reflowed
|
||||
#undef NOISY_REMOVE_FRAME
|
||||
#undef NOISY_COMBINED_AREA // enables debug output for combined area computation
|
||||
#undef NOISY_VERTICAL_MARGINS
|
||||
#undef NOISY_REFLOW_REASON // gives a little info about why each reflow was requested
|
||||
#undef REFLOW_STATUS_COVERAGE // I think this is most useful for printing, to see which frames return "incomplete"
|
||||
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floaters and positioned elements
|
||||
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floats and positioned elements
|
||||
#undef NOISY_BLOCK_INVALIDATE // enables debug output for all calls to invalidate
|
||||
#undef REALLY_NOISY_REFLOW // some extra debug info
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -55,7 +55,7 @@ class nsIntervalSet;
|
|||
* Child list name indices
|
||||
* @see #GetAdditionalChildListName()
|
||||
*/
|
||||
#define NS_BLOCK_FRAME_FLOATER_LIST_INDEX 0
|
||||
#define NS_BLOCK_FRAME_FLOAT_LIST_INDEX 0
|
||||
#define NS_BLOCK_FRAME_BULLET_LIST_INDEX 1
|
||||
#define NS_BLOCK_FRAME_OVERFLOW_LIST_INDEX 2
|
||||
#define NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX 3
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
inline nscoord GetAscent() { return mAscent; }
|
||||
|
||||
// Create a contination for aPlaceholder and its out of flow frame and
|
||||
// add it to the list of overflow floaters
|
||||
// add it to the list of overflow floats
|
||||
nsresult SplitPlaceholder(nsIPresContext& aPresContext, nsIFrame& aPlaceholder);
|
||||
|
||||
void UndoSplitPlaceholders(nsBlockReflowState& aState,
|
||||
|
@ -251,7 +251,7 @@ protected:
|
|||
}
|
||||
|
||||
/** move the frames contained by aLine by aDY
|
||||
* if aLine is a block, it's child floaters are added to the state manager
|
||||
* if aLine is a block, it's child floats are added to the state manager
|
||||
*/
|
||||
void SlideLine(nsBlockReflowState& aState,
|
||||
nsLineBox* aLine, nscoord aDY);
|
||||
|
@ -293,7 +293,7 @@ protected:
|
|||
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aDeletedFrame);
|
||||
|
||||
// Remove a floater, abs, rel positioned frame from the appropriate block's list
|
||||
// Remove a float, abs, rel positioned frame from the appropriate block's list
|
||||
static void DoRemoveOutOfFlowFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
|
@ -424,12 +424,12 @@ protected:
|
|||
nsIFrame* aFrame,
|
||||
PRUint8* aLineReflowStatus);
|
||||
|
||||
// An incomplete aReflowStatus indicates the floater should be split
|
||||
// An incomplete aReflowStatus indicates the float should be split
|
||||
// but only if the available height is constrained.
|
||||
nsresult ReflowFloater(nsBlockReflowState& aState,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsFloaterCache* aFloaterCache,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
nsresult ReflowFloat(nsBlockReflowState& aState,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsFloatCache* aFloatCache,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
//----------------------------------------
|
||||
// Methods for pushing/pulling lines/frames
|
||||
|
@ -475,15 +475,15 @@ protected:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
void PaintFloaters(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
void PaintFloats(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
void PropagateFloaterDamage(nsBlockReflowState& aState,
|
||||
nsLineBox* aLine,
|
||||
nscoord aDeltaY);
|
||||
void PropagateFloatDamage(nsBlockReflowState& aState,
|
||||
nsLineBox* aLine,
|
||||
nscoord aDeltaY);
|
||||
|
||||
void BuildFloaterList();
|
||||
void BuildFloatList();
|
||||
|
||||
//----------------------------------------
|
||||
// List handling kludge
|
||||
|
@ -532,8 +532,8 @@ protected:
|
|||
|
||||
nsLineList mLines;
|
||||
|
||||
// List of all floaters in this block
|
||||
nsFrameList mFloaters;
|
||||
// List of all floats in this block
|
||||
nsFrameList mFloats;
|
||||
|
||||
// XXX_fix_me: subclass one more time!
|
||||
// For list-item frames, this is the bullet frame.
|
||||
|
|
|
@ -362,9 +362,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
}
|
||||
|
||||
/* We build a different reflow context based on the width attribute of the block,
|
||||
* if it's a floater.
|
||||
* Auto-width floaters need to have their containing-block size set explicitly,
|
||||
* factoring in other floaters that impact it.
|
||||
* if it's a float.
|
||||
* Auto-width floats need to have their containing-block size set explicitly,
|
||||
* factoring in other floats that impact it.
|
||||
* It's possible this should be quirks-only.
|
||||
* All other blocks proceed normally.
|
||||
*/
|
||||
|
@ -439,7 +439,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
aFrameRS.mComputedBorderPadding.right;
|
||||
}
|
||||
|
||||
// if this is an unconstrained width reflow, then just place the floater at the left margin
|
||||
// if this is an unconstrained width reflow, then just place the float at the left margin
|
||||
if (NS_UNCONSTRAINEDSIZE == mSpace.width)
|
||||
x = mSpace.x;
|
||||
else
|
||||
|
@ -682,7 +682,7 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
|
|||
// always fit. Note: don't force the width to 0
|
||||
aInFlowBounds = nsRect(x, y, mMetrics.width, 0);
|
||||
|
||||
// Retain combined area information in case we contain a floater
|
||||
// Retain combined area information in case we contain a float
|
||||
// and nothing else.
|
||||
aCombinedRect = mMetrics.mOverflowArea;
|
||||
aCombinedRect.x += x;
|
||||
|
|
|
@ -67,7 +67,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
mPrevBottomMargin(),
|
||||
mLineNumber(0),
|
||||
mFlags(0),
|
||||
mFloaterBreakType(NS_STYLE_CLEAR_NONE)
|
||||
mFloatBreakType(NS_STYLE_CLEAR_NONE)
|
||||
{
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
|
||||
|
@ -220,7 +220,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
nsRect& aResult)
|
||||
{
|
||||
#ifdef REALLY_NOISY_REFLOW
|
||||
printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount());
|
||||
printf("CBAS frame=%p has float count %d\n", aFrame, mBand.GetFloatCount());
|
||||
mBand.List();
|
||||
#endif
|
||||
aResult.y = mY;
|
||||
|
@ -246,14 +246,14 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
NS_FRAME_NOT_SPLITTABLE == aSplitType || // things like images mapped to display: block
|
||||
PR_TRUE == treatAsNotSplittable) // text input controls mapped to display: block (special case)
|
||||
{
|
||||
if (mBand.GetFloaterCount()) {
|
||||
if (mBand.GetFloatCount()) {
|
||||
// Use the float-edge property to determine how the child block
|
||||
// will interact with the floater.
|
||||
// will interact with the float.
|
||||
const nsStyleBorder* borderStyle = aFrame->GetStyleBorder();
|
||||
switch (borderStyle->mFloatEdge) {
|
||||
default:
|
||||
case NS_STYLE_FLOAT_EDGE_CONTENT: // content and only content does runaround of floaters
|
||||
// The child block will flow around the floater. Therefore
|
||||
case NS_STYLE_FLOAT_EDGE_CONTENT: // content and only content does runaround of floats
|
||||
// The child block will flow around the float. Therefore
|
||||
// give it all of the available space.
|
||||
aResult.x = borderPadding.left;
|
||||
aResult.width = GetFlag(BRS_UNCONSTRAINEDWIDTH)
|
||||
|
@ -264,7 +264,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
case NS_STYLE_FLOAT_EDGE_PADDING:
|
||||
{
|
||||
// The child block's border should be placed adjacent to,
|
||||
// but not overlap the floater(s).
|
||||
// but not overlap the float(s).
|
||||
nsMargin m(0, 0, 0, 0);
|
||||
const nsStyleMargin* styleMargin = aFrame->GetStyleMargin();
|
||||
styleMargin->GetMargin(m); // XXX percentage margins
|
||||
|
@ -276,7 +276,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
}
|
||||
|
||||
// determine left edge
|
||||
if (mBand.GetLeftFloaterCount()) {
|
||||
if (mBand.GetLeftFloatCount()) {
|
||||
aResult.x = mAvailSpaceRect.x + borderPadding.left - m.left;
|
||||
}
|
||||
else {
|
||||
|
@ -288,8 +288,8 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
aResult.width = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
if (mBand.GetRightFloaterCount()) {
|
||||
if (mBand.GetLeftFloaterCount()) {
|
||||
if (mBand.GetRightFloatCount()) {
|
||||
if (mBand.GetLeftFloatCount()) {
|
||||
aResult.width = mAvailSpaceRect.width + m.left + m.right;
|
||||
}
|
||||
else {
|
||||
|
@ -306,7 +306,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
case NS_STYLE_FLOAT_EDGE_MARGIN:
|
||||
{
|
||||
// The child block's margins should be placed adjacent to,
|
||||
// but not overlap the floater.
|
||||
// but not overlap the float.
|
||||
aResult.x = mAvailSpaceRect.x + borderPadding.left;
|
||||
aResult.width = mAvailSpaceRect.width;
|
||||
}
|
||||
|
@ -314,9 +314,9 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
}
|
||||
}
|
||||
else {
|
||||
// Since there are no floaters present the float-edge property
|
||||
// Since there are no floats present the float-edge property
|
||||
// doesn't matter therefore give the block element all of the
|
||||
// available space since it will flow around the floater itself.
|
||||
// available space since it will flow around the float itself.
|
||||
aResult.x = borderPadding.left;
|
||||
aResult.width = GetFlag(BRS_UNCONSTRAINEDWIDTH)
|
||||
? NS_UNCONSTRAINEDSIZE
|
||||
|
@ -326,7 +326,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
else {
|
||||
// The frame is clueless about the space manager and therefore we
|
||||
// only give it free space. An example is a table frame - the
|
||||
// tables do not flow around floaters.
|
||||
// tables do not flow around floats.
|
||||
aResult.x = mAvailSpaceRect.x + borderPadding.left;
|
||||
aResult.width = mAvailSpaceRect.width;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ nsBlockReflowState::GetAvailableSpace(nscoord aY)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
|
||||
nsBlockReflowState::ClearPastFloats(PRUint8 aBreakType)
|
||||
{
|
||||
nscoord saveY, deltaY;
|
||||
|
||||
|
@ -372,10 +372,10 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
|
|||
case NS_STYLE_CLEAR_LEFT_AND_RIGHT:
|
||||
// Apply the previous margin before clearing
|
||||
saveY = mY + mPrevBottomMargin.get();
|
||||
ClearFloaters(saveY, aBreakType);
|
||||
#ifdef NOISY_FLOATER_CLEARING
|
||||
ClearFloats(saveY, aBreakType);
|
||||
#ifdef NOISY_FLOAT_CLEARING
|
||||
nsFrame::ListTag(stdout, mBlock);
|
||||
printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n",
|
||||
printf(": ClearPastFloats: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n",
|
||||
mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY,
|
||||
mY - saveY);
|
||||
#endif
|
||||
|
@ -389,7 +389,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
|
|||
// Pretend that the distance we just moved is a previous
|
||||
// blocks bottom margin. Note that GetAvailableSpace has been
|
||||
// done so that the available space calculations will be done
|
||||
// after clearing the appropriate floaters.
|
||||
// after clearing the appropriate floats.
|
||||
//
|
||||
// What we are doing here is applying CSS2 section 9.5.2's
|
||||
// rules for clearing - "The top margin of the generated box
|
||||
|
@ -473,43 +473,43 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
}
|
||||
|
||||
/**
|
||||
* Restore information about floaters into the space manager for an
|
||||
* incremental reflow, and simultaneously push the floaters by
|
||||
* Restore information about floats into the space manager for an
|
||||
* incremental reflow, and simultaneously push the floats by
|
||||
* |aDeltaY|, which is the amount |aLine| was pushed relative to its
|
||||
* parent. The recovery of state is one of the things that makes
|
||||
* incremental reflow O(N^2) and this state should really be kept
|
||||
* around, attached to the frame tree.
|
||||
*/
|
||||
void
|
||||
nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
||||
nscoord aDeltaY)
|
||||
nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
|
||||
nscoord aDeltaY)
|
||||
{
|
||||
if (aLine->HasFloaters()) {
|
||||
// Place the floaters into the space-manager again. Also slide
|
||||
if (aLine->HasFloats()) {
|
||||
// Place the floats into the space-manager again. Also slide
|
||||
// them, just like the regular frames on the line.
|
||||
nsFloaterCache* fc = aLine->GetFirstFloater();
|
||||
nsFloatCache* fc = aLine->GetFirstFloat();
|
||||
while (fc) {
|
||||
nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame();
|
||||
nsIFrame* floatFrame = fc->mPlaceholder->GetOutOfFlowFrame();
|
||||
if (aDeltaY != 0) {
|
||||
fc->mRegion.y += aDeltaY;
|
||||
fc->mCombinedArea.y += aDeltaY;
|
||||
nsPoint p = floater->GetPosition();
|
||||
floater->SetPosition(nsPoint(p.x, p.y + aDeltaY));
|
||||
nsPoint p = floatFrame->GetPosition();
|
||||
floatFrame->SetPosition(nsPoint(p.x, p.y + aDeltaY));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
|
||||
nscoord tx, ty;
|
||||
mSpaceManager->GetTranslation(tx, ty);
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("RecoverFloaters: txy=%d,%d (%d,%d) ",
|
||||
printf("RecoverFloats: txy=%d,%d (%d,%d) ",
|
||||
tx, ty, mSpaceManagerX, mSpaceManagerY);
|
||||
nsFrame::ListTag(stdout, floater);
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" aDeltaY=%d region={%d,%d,%d,%d}\n",
|
||||
aDeltaY, fc->mRegion.x, fc->mRegion.y,
|
||||
fc->mRegion.width, fc->mRegion.height);
|
||||
}
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floater, fc->mRegion);
|
||||
mSpaceManager->AddRectRegion(floatFrame, fc->mRegion);
|
||||
fc = fc->Next();
|
||||
}
|
||||
} else if (aLine->IsBlock()) {
|
||||
|
@ -522,10 +522,10 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
|||
line_end = kid->end_lines();
|
||||
line != line_end;
|
||||
++line)
|
||||
// Pass 0, not the real DeltaY, since these floaters aren't
|
||||
// Pass 0, not the real DeltaY, since these floats aren't
|
||||
// moving relative to their parent block, only relative to
|
||||
// the space manager.
|
||||
RecoverFloaters(line, 0);
|
||||
RecoverFloats(line, 0);
|
||||
mSpaceManager->Translate(-kidx, -kidy);
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
|||
* nsBlockReflowState is in the same state that it would have been in
|
||||
* had the line just been reflowed.
|
||||
*
|
||||
* Most of the state recovery that we have to do involves floaters.
|
||||
* Most of the state recovery that we have to do involves floats.
|
||||
*/
|
||||
void
|
||||
nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
||||
|
@ -573,11 +573,11 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
#endif
|
||||
UpdateMaxElementWidth(aLine->mMaxElementWidth);
|
||||
|
||||
// Recover the floater MEWs for floaters in this line (but not in
|
||||
// Recover the float MEWs for floats in this line (but not in
|
||||
// blocks within it, since their MEWs are already part of the block's
|
||||
// MEW).
|
||||
if (aLine->HasFloaters()) {
|
||||
for (nsFloaterCache* fc = aLine->GetFirstFloater(); fc; fc = fc->Next())
|
||||
if (aLine->HasFloats()) {
|
||||
for (nsFloatCache* fc = aLine->GetFirstFloat(); fc; fc = fc->Next())
|
||||
UpdateMaxElementWidth(fc->mMaxElementWidth);
|
||||
}
|
||||
}
|
||||
|
@ -590,15 +590,15 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
UpdateMaximumWidth(aLine->mMaximumWidth);
|
||||
}
|
||||
|
||||
// Place floaters for this line into the space manager
|
||||
if (aLine->HasFloaters() || aLine->IsBlock()) {
|
||||
// Undo border/padding translation since the nsFloaterCache's
|
||||
// Place floats for this line into the space manager
|
||||
if (aLine->HasFloats() || aLine->IsBlock()) {
|
||||
// Undo border/padding translation since the nsFloatCache's
|
||||
// coordinates are relative to the frame not relative to the
|
||||
// border/padding.
|
||||
const nsMargin& bp = BorderPadding();
|
||||
mSpaceManager->Translate(-bp.left, -bp.top);
|
||||
|
||||
RecoverFloaters(aLine, aDeltaY);
|
||||
RecoverFloats(aLine, aDeltaY);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
|
||||
|
@ -611,34 +611,34 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBlockReflowState::IsImpactedByFloater() const
|
||||
nsBlockReflowState::IsImpactedByFloat() const
|
||||
{
|
||||
#ifdef REALLY_NOISY_REFLOW
|
||||
printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n",
|
||||
this, mBand.GetFloaterCount());
|
||||
printf("nsBlockReflowState::IsImpactedByFloat %p returned %d\n",
|
||||
this, mBand.GetFloatCount());
|
||||
#endif
|
||||
return mBand.GetFloaterCount() > 0;
|
||||
return mBand.GetFloatCount() > 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsBlockReflowState::InitFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
nsBlockReflowState::InitFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
// Set the geometric parent of the floater
|
||||
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
|
||||
floater->SetParent(mBlock);
|
||||
// Set the geometric parent of the float
|
||||
nsIFrame* floatFrame = aPlaceholder->GetOutOfFlowFrame();
|
||||
floatFrame->SetParent(mBlock);
|
||||
|
||||
// Then add the floater to the current line and place it when
|
||||
// Then add the float to the current line and place it when
|
||||
// appropriate
|
||||
AddFloater(aLineLayout, aPlaceholder, PR_TRUE, aReflowStatus);
|
||||
AddFloat(aLineLayout, aPlaceholder, PR_TRUE, aReflowStatus);
|
||||
}
|
||||
|
||||
// This is called by the line layout's AddFloater method when a
|
||||
// place-holder frame is reflowed in a line. If the floater is a
|
||||
// This is called by the line layout's AddFloat method when a
|
||||
// place-holder frame is reflowed in a line. If the float is a
|
||||
// left-most child (it's x coordinate is at the line's left margin)
|
||||
// then the floater is place immediately, otherwise the floater
|
||||
// then the float is place immediately, otherwise the float
|
||||
// placement is deferred until the line has been reflowed.
|
||||
|
||||
// XXXldb This behavior doesn't quite fit with CSS1 and CSS2 --
|
||||
|
@ -646,31 +646,31 @@ nsBlockReflowState::InitFloater(nsLineLayout& aLineLayout,
|
|||
// float as well unless it won't fit next to what we already have.
|
||||
// But nobody else implements it that way...
|
||||
void
|
||||
nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
nsBlockReflowState::AddFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
NS_PRECONDITION(mBlock->end_lines() != mCurrentLine, "null ptr");
|
||||
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
// Allocate a nsFloaterCache for the floater
|
||||
nsFloaterCache* fc = mFloaterCacheFreeList.Alloc();
|
||||
// Allocate a nsFloatCache for the float
|
||||
nsFloatCache* fc = mFloatCacheFreeList.Alloc();
|
||||
fc->mPlaceholder = aPlaceholder;
|
||||
fc->mIsCurrentLineFloater = aLineLayout.CanPlaceFloaterNow();
|
||||
fc->mIsCurrentLineFloat = aLineLayout.CanPlaceFloatNow();
|
||||
fc->mMaxElementWidth = 0;
|
||||
|
||||
// Now place the floater immediately if possible. Otherwise stash it
|
||||
// away in mPendingFloaters and place it later.
|
||||
if (fc->mIsCurrentLineFloater) {
|
||||
// Record this floater in the current-line list
|
||||
mCurrentLineFloaters.Append(fc);
|
||||
// Now place the float immediately if possible. Otherwise stash it
|
||||
// away in mPendingFloats and place it later.
|
||||
if (fc->mIsCurrentLineFloat) {
|
||||
// Record this float in the current-line list
|
||||
mCurrentLineFloats.Append(fc);
|
||||
|
||||
// Because we are in the middle of reflowing a placeholder frame
|
||||
// within a line (and possibly nested in an inline frame or two
|
||||
// that's a child of our block) we need to restore the space
|
||||
// manager's translation to the space that the block resides in
|
||||
// before placing the floater.
|
||||
// before placing the float.
|
||||
nscoord ox, oy;
|
||||
mSpaceManager->GetTranslation(ox, oy);
|
||||
nscoord dx = ox - mSpaceManagerX;
|
||||
|
@ -678,24 +678,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
|||
mSpaceManager->Translate(-dx, -dy);
|
||||
|
||||
// And then place it
|
||||
PRBool isLeftFloater;
|
||||
FlowAndPlaceFloater(fc, &isLeftFloater, aReflowStatus);
|
||||
PRBool isLeftFloat;
|
||||
FlowAndPlaceFloat(fc, &isLeftFloat, aReflowStatus);
|
||||
|
||||
// Pass on updated available space to the current inline reflow engine
|
||||
GetAvailableSpace();
|
||||
aLineLayout.UpdateBand(mAvailSpaceRect.x + BorderPadding().left, mY,
|
||||
GetFlag(BRS_UNCONSTRAINEDWIDTH) ? NS_UNCONSTRAINEDSIZE : mAvailSpaceRect.width,
|
||||
mAvailSpaceRect.height,
|
||||
isLeftFloater,
|
||||
isLeftFloat,
|
||||
aPlaceholder->GetOutOfFlowFrame());
|
||||
|
||||
// Restore coordinate system
|
||||
mSpaceManager->Translate(dx, dy);
|
||||
}
|
||||
else {
|
||||
// This floater will be placed after the line is done (it is a
|
||||
// below-current-line floater).
|
||||
mBelowCurrentLineFloaters.Append(fc);
|
||||
// This float will be placed after the line is done (it is a
|
||||
// below-current-line float).
|
||||
mBelowCurrentLineFloats.Append(fc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,61 +735,61 @@ nsBlockReflowState::UpdateMaximumWidth(nscoord aMaximumWidth)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
||||
PRUint8 aFloats)
|
||||
nsBlockReflowState::CanPlaceFloat(const nsRect& aFloatRect,
|
||||
PRUint8 aFloats)
|
||||
{
|
||||
// If the current Y coordinate is not impacted by any floaters
|
||||
// then by definition the floater fits.
|
||||
// If the current Y coordinate is not impacted by any floats
|
||||
// then by definition the float fits.
|
||||
PRBool result = PR_TRUE;
|
||||
if (0 != mBand.GetFloaterCount()) {
|
||||
if (0 != mBand.GetFloatCount()) {
|
||||
// XXX We should allow overflow by up to half a pixel here (bug 21193).
|
||||
if (mAvailSpaceRect.width < aFloaterRect.width) {
|
||||
if (mAvailSpaceRect.width < aFloatRect.width) {
|
||||
// The available width is too narrow (and its been impacted by a
|
||||
// prior floater)
|
||||
// prior float)
|
||||
result = PR_FALSE;
|
||||
}
|
||||
else {
|
||||
// At this point we know that there is enough horizontal space for
|
||||
// the floater (somewhere). Lets see if there is enough vertical
|
||||
// the float (somewhere). Lets see if there is enough vertical
|
||||
// space.
|
||||
if (mAvailSpaceRect.height < aFloaterRect.height) {
|
||||
if (mAvailSpaceRect.height < aFloatRect.height) {
|
||||
// The available height is too short. However, its possible that
|
||||
// there is enough open space below which is not impacted by a
|
||||
// floater.
|
||||
// float.
|
||||
//
|
||||
// Compute the X coordinate for the floater based on its float
|
||||
// Compute the X coordinate for the float based on its float
|
||||
// type, assuming its placed on the current line. This is
|
||||
// where the floater will be placed horizontally if it can go
|
||||
// where the float will be placed horizontally if it can go
|
||||
// here.
|
||||
nscoord xa;
|
||||
if (NS_STYLE_FLOAT_LEFT == aFloats) {
|
||||
xa = mAvailSpaceRect.x;
|
||||
}
|
||||
else {
|
||||
xa = mAvailSpaceRect.XMost() - aFloaterRect.width;
|
||||
xa = mAvailSpaceRect.XMost() - aFloatRect.width;
|
||||
|
||||
// In case the floater is too big, don't go past the left edge
|
||||
// In case the float is too big, don't go past the left edge
|
||||
// XXXldb This seems wrong, but we might want to fix bug 6976
|
||||
// first.
|
||||
if (xa < mAvailSpaceRect.x) {
|
||||
xa = mAvailSpaceRect.x;
|
||||
}
|
||||
}
|
||||
nscoord xb = xa + aFloaterRect.width;
|
||||
nscoord xb = xa + aFloatRect.width;
|
||||
|
||||
// Calculate the top and bottom y coordinates, again assuming
|
||||
// that the floater is placed on the current line.
|
||||
// that the float is placed on the current line.
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
nscoord ya = mY - borderPadding.top;
|
||||
if (ya < 0) {
|
||||
// CSS2 spec, 9.5.1 rule [4]: "A floating box's outer top may not
|
||||
// be higher than the top of its containing block." (Since the
|
||||
// containing block is the content edge of the block box, this
|
||||
// means the margin edge of the floater can't be higher than the
|
||||
// means the margin edge of the float can't be higher than the
|
||||
// content edge of the block that contains it.)
|
||||
ya = 0;
|
||||
}
|
||||
nscoord yb = ya + aFloaterRect.height;
|
||||
nscoord yb = ya + aFloatRect.height;
|
||||
|
||||
nscoord saveY = mY;
|
||||
for (;;) {
|
||||
|
@ -797,24 +797,24 @@ nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
|||
mY += mAvailSpaceRect.height;
|
||||
GetAvailableSpace();
|
||||
|
||||
if (0 == mBand.GetFloaterCount()) {
|
||||
// Winner. This band has no floaters on it, therefore
|
||||
if (0 == mBand.GetFloatCount()) {
|
||||
// Winner. This band has no floats on it, therefore
|
||||
// there can be no overlap.
|
||||
break;
|
||||
}
|
||||
|
||||
// Check and make sure the floater won't intersect any
|
||||
// floaters on this band. The floaters starting and ending
|
||||
// Check and make sure the float won't intersect any
|
||||
// floats on this band. The floats starting and ending
|
||||
// coordinates must be entirely in the available space.
|
||||
if ((xa < mAvailSpaceRect.x) || (xb > mAvailSpaceRect.XMost())) {
|
||||
// The floater can't go here.
|
||||
// The float can't go here.
|
||||
result = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
// See if there is now enough height for the floater.
|
||||
// See if there is now enough height for the float.
|
||||
if (yb < mY + mAvailSpaceRect.height) {
|
||||
// Winner. The bottom Y coordinate of the floater is in
|
||||
// Winner. The bottom Y coordinate of the float is in
|
||||
// this band.
|
||||
break;
|
||||
}
|
||||
|
@ -831,94 +831,94 @@ nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
|||
}
|
||||
|
||||
void
|
||||
nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
||||
PRBool* aIsLeftFloater,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
||||
PRBool* aIsLeftFloat,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
// Save away the Y coordinate before placing the floater. We will
|
||||
// restore mY at the end after placing the floater. This is
|
||||
// necessary because any adjustments to mY during the floater
|
||||
// placement are for the floater only, not for any non-floating
|
||||
// Save away the Y coordinate before placing the float. We will
|
||||
// restore mY at the end after placing the float. This is
|
||||
// necessary because any adjustments to mY during the float
|
||||
// placement are for the float only, not for any non-floating
|
||||
// content.
|
||||
nscoord saveY = mY;
|
||||
|
||||
nsPlaceholderFrame* placeholder = aFloaterCache->mPlaceholder;
|
||||
nsIFrame* floater = placeholder->GetOutOfFlowFrame();
|
||||
nsPlaceholderFrame* placeholder = aFloatCache->mPlaceholder;
|
||||
nsIFrame* floatFrame = placeholder->GetOutOfFlowFrame();
|
||||
|
||||
// Grab the floater's display information
|
||||
const nsStyleDisplay* floaterDisplay = floater->GetStyleDisplay();
|
||||
// Grab the float's display information
|
||||
const nsStyleDisplay* floatDisplay = floatFrame->GetStyleDisplay();
|
||||
|
||||
// This will hold the floater's geometry when we've found a place
|
||||
// This will hold the float's geometry when we've found a place
|
||||
// for it to live.
|
||||
nsRect region;
|
||||
|
||||
// The floater's old region, so we can propagate damage.
|
||||
nsRect oldRegion = floater->GetRect();
|
||||
oldRegion.Inflate(aFloaterCache->mMargins);
|
||||
// The float's old region, so we can propagate damage.
|
||||
nsRect oldRegion = floatFrame->GetRect();
|
||||
oldRegion.Inflate(aFloatCache->mMargins);
|
||||
|
||||
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
|
||||
// ``above'' another float that preceded it in the flow.
|
||||
mY = NS_MAX(mSpaceManager->GetLowestRegionTop() + BorderPadding().top, mY);
|
||||
|
||||
// See if the floater should clear any preceeding floaters...
|
||||
if (NS_STYLE_CLEAR_NONE != floaterDisplay->mBreakType) {
|
||||
// See if the float should clear any preceeding floats...
|
||||
if (NS_STYLE_CLEAR_NONE != floatDisplay->mBreakType) {
|
||||
// XXXldb Does this handle vertical margins correctly?
|
||||
ClearFloaters(mY, floaterDisplay->mBreakType);
|
||||
ClearFloats(mY, floatDisplay->mBreakType);
|
||||
}
|
||||
else {
|
||||
// Get the band of available space
|
||||
GetAvailableSpace();
|
||||
}
|
||||
|
||||
// Reflow the floater
|
||||
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
|
||||
// Reflow the float
|
||||
mBlock->ReflowFloat(*this, placeholder, aFloatCache, aReflowStatus);
|
||||
|
||||
// Get the floaters bounding box and margin information
|
||||
region = floater->GetRect();
|
||||
// Get the floats bounding box and margin information
|
||||
region = floatFrame->GetRect();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("flowed floater: ");
|
||||
nsFrame::ListTag(stdout, floater);
|
||||
printf("flowed float: ");
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" (%d,%d,%d,%d)\n",
|
||||
region.x, region.y, region.width, region.height);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Adjust the floater size by its margin. That's the area that will
|
||||
// Adjust the float size by its margin. That's the area that will
|
||||
// impact the space manager.
|
||||
region.width += aFloaterCache->mMargins.left + aFloaterCache->mMargins.right;
|
||||
region.height += aFloaterCache->mMargins.top + aFloaterCache->mMargins.bottom;
|
||||
region.width += aFloatCache->mMargins.left + aFloatCache->mMargins.right;
|
||||
region.height += aFloatCache->mMargins.top + aFloatCache->mMargins.bottom;
|
||||
|
||||
// Find a place to place the floater. The CSS2 spec doesn't want
|
||||
// floaters overlapping each other or sticking out of the containing
|
||||
// Find a place to place the float. The CSS2 spec doesn't want
|
||||
// floats overlapping each other or sticking out of the containing
|
||||
// block if possible (CSS2 spec section 9.5.1, see the rule list).
|
||||
NS_ASSERTION((NS_STYLE_FLOAT_LEFT == floaterDisplay->mFloats) ||
|
||||
(NS_STYLE_FLOAT_RIGHT == floaterDisplay->mFloats),
|
||||
NS_ASSERTION((NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats) ||
|
||||
(NS_STYLE_FLOAT_RIGHT == floatDisplay->mFloats),
|
||||
"invalid float type");
|
||||
|
||||
// Can the floater fit here?
|
||||
PRBool keepFloaterOnSameLine = PR_FALSE;
|
||||
// Can the float fit here?
|
||||
PRBool keepFloatOnSameLine = PR_FALSE;
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
|
||||
while (! CanPlaceFloater(region, floaterDisplay->mFloats)) {
|
||||
while (! CanPlaceFloat(region, floatDisplay->mFloats)) {
|
||||
// Nope. try to advance to the next band.
|
||||
if (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay ||
|
||||
if (NS_STYLE_DISPLAY_TABLE != floatDisplay->mDisplay ||
|
||||
eCompatibility_NavQuirks != mode ) {
|
||||
|
||||
mY += mAvailSpaceRect.height;
|
||||
GetAvailableSpace();
|
||||
} else {
|
||||
// IE handles floater tables in a very special way
|
||||
// IE handles float tables in a very special way
|
||||
|
||||
// see if the previous floater is also a table and has "align"
|
||||
nsFloaterCache* fc = mCurrentLineFloaters.Head();
|
||||
// see if the previous float is also a table and has "align"
|
||||
nsFloatCache* fc = mCurrentLineFloats.Head();
|
||||
nsIFrame* prevFrame = nsnull;
|
||||
while (fc) {
|
||||
if (fc->mPlaceholder->GetOutOfFlowFrame() == floater) {
|
||||
if (fc->mPlaceholder->GetOutOfFlowFrame() == floatFrame) {
|
||||
break;
|
||||
}
|
||||
prevFrame = fc->mPlaceholder->GetOutOfFlowFrame();
|
||||
|
@ -939,7 +939,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
// we're interested only if previous frame is align=left
|
||||
// IE messes things up when "right" (overlapping frames)
|
||||
if (value.EqualsIgnoreCase("left")) {
|
||||
keepFloaterOnSameLine = PR_TRUE;
|
||||
keepFloatOnSameLine = PR_TRUE;
|
||||
// don't advance to next line (IE quirkie behaviour)
|
||||
// it breaks rule CSS2/9.5.1/1, but what the hell
|
||||
// since we cannot evangelize the world
|
||||
|
@ -953,21 +953,21 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
// the table does not fit anymore in this line so advance to next band
|
||||
mY += mAvailSpaceRect.height;
|
||||
GetAvailableSpace();
|
||||
// reflow the floater again now since we have more space
|
||||
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
|
||||
// Get the floaters bounding box and margin information
|
||||
region = floater->GetRect();
|
||||
// Adjust the floater size by its margin. That's the area that will
|
||||
// reflow the float again now since we have more space
|
||||
mBlock->ReflowFloat(*this, placeholder, aFloatCache, aReflowStatus);
|
||||
// Get the floats bounding box and margin information
|
||||
region = floatFrame->GetRect();
|
||||
// Adjust the float size by its margin. That's the area that will
|
||||
// impact the space manager.
|
||||
region.width += aFloaterCache->mMargins.left + aFloaterCache->mMargins.right;
|
||||
region.height += aFloaterCache->mMargins.top + aFloaterCache->mMargins.bottom;
|
||||
region.width += aFloatCache->mMargins.left + aFloatCache->mMargins.right;
|
||||
region.height += aFloatCache->mMargins.top + aFloatCache->mMargins.bottom;
|
||||
|
||||
}
|
||||
}
|
||||
// If the floater is continued, it will get the same absolute x value as its prev-in-flow
|
||||
// If the float is continued, it will get the same absolute x value as its prev-in-flow
|
||||
nsRect prevRect(0,0,0,0);
|
||||
nsIFrame* prevInFlow;
|
||||
floater->GetPrevInFlow(&prevInFlow);
|
||||
floatFrame->GetPrevInFlow(&prevInFlow);
|
||||
if (prevInFlow) {
|
||||
prevRect = prevInFlow->GetRect();
|
||||
|
||||
|
@ -990,53 +990,53 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
prevRect.x += ancestor->GetRect().x;
|
||||
}
|
||||
}
|
||||
// Assign an x and y coordinate to the floater. Note that the x,y
|
||||
// Assign an x and y coordinate to the float. Note that the x,y
|
||||
// coordinates are computed <b>relative to the translation in the
|
||||
// spacemanager</b> which means that the impacted region will be
|
||||
// <b>inside</b> the border/padding area.
|
||||
PRBool isLeftFloater;
|
||||
if (NS_STYLE_FLOAT_LEFT == floaterDisplay->mFloats) {
|
||||
isLeftFloater = PR_TRUE;
|
||||
PRBool isLeftFloat;
|
||||
if (NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats) {
|
||||
isLeftFloat = PR_TRUE;
|
||||
region.x = (prevInFlow) ? prevRect.x : mAvailSpaceRect.x;
|
||||
}
|
||||
else {
|
||||
isLeftFloater = PR_FALSE;
|
||||
isLeftFloat = PR_FALSE;
|
||||
if (NS_UNCONSTRAINEDSIZE != mAvailSpaceRect.width) {
|
||||
nsIFrame* prevInFlow;
|
||||
floater->GetPrevInFlow(&prevInFlow);
|
||||
floatFrame->GetPrevInFlow(&prevInFlow);
|
||||
if (prevInFlow) {
|
||||
region.x = prevRect.x;
|
||||
}
|
||||
else if (!keepFloaterOnSameLine) {
|
||||
else if (!keepFloatOnSameLine) {
|
||||
region.x = mAvailSpaceRect.XMost() - region.width;
|
||||
}
|
||||
else {
|
||||
// this is the IE quirk (see few lines above)
|
||||
// the table is keept in the same line: don't let it overlap the previous floater
|
||||
// the table is keept in the same line: don't let it overlap the previous float
|
||||
region.x = mAvailSpaceRect.x;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// For unconstrained reflows, pretend that a right floater is
|
||||
// instead a left floater. This will make us end up with the
|
||||
// For unconstrained reflows, pretend that a right float is
|
||||
// instead a left float. This will make us end up with the
|
||||
// correct unconstrained width, and we'll place it later.
|
||||
region.x = mAvailSpaceRect.x;
|
||||
}
|
||||
}
|
||||
*aIsLeftFloater = isLeftFloater;
|
||||
*aIsLeftFloat = isLeftFloat;
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
region.y = mY - borderPadding.top;
|
||||
if (region.y < 0) {
|
||||
// CSS2 spec, 9.5.1 rule [4]: "A floating box's outer top may not
|
||||
// be higher than the top of its containing block." (Since the
|
||||
// containing block is the content edge of the block box, this
|
||||
// means the margin edge of the floater can't be higher than the
|
||||
// means the margin edge of the float can't be higher than the
|
||||
// content edge of the block that contains it.)
|
||||
region.y = 0;
|
||||
}
|
||||
|
||||
// Place the floater in the space manager
|
||||
// if the floater split, then take up all of the vertical height
|
||||
// Place the float in the space manager
|
||||
// if the float split, then take up all of the vertical height
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus) &&
|
||||
(NS_UNCONSTRAINEDSIZE != mContentArea.height)) {
|
||||
region.height = PR_MAX(region.height, mContentArea.height);
|
||||
|
@ -1044,10 +1044,10 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floater, region);
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad floater placement");
|
||||
mSpaceManager->AddRectRegion(floatFrame, region);
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad float placement");
|
||||
|
||||
// If the floater's dimensions have changed, note the damage in the
|
||||
// If the float's dimensions have changed, note the damage in the
|
||||
// space manager.
|
||||
if (region != oldRegion) {
|
||||
// XXXwaterson conservative: we could probably get away with noting
|
||||
|
@ -1059,61 +1059,61 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
mSpaceManager->IncludeInDamage(top, bottom);
|
||||
}
|
||||
|
||||
// Save away the floaters region in the spacemanager, after making
|
||||
// Save away the floats region in the spacemanager, after making
|
||||
// it relative to the containing block's frame instead of relative
|
||||
// to the spacemanager translation (which is inset by the
|
||||
// border+padding).
|
||||
aFloaterCache->mRegion.x = region.x + borderPadding.left;
|
||||
aFloaterCache->mRegion.y = region.y + borderPadding.top;
|
||||
aFloaterCache->mRegion.width = region.width;
|
||||
aFloaterCache->mRegion.height = region.height;
|
||||
aFloatCache->mRegion.x = region.x + borderPadding.left;
|
||||
aFloatCache->mRegion.y = region.y + borderPadding.top;
|
||||
aFloatCache->mRegion.width = region.width;
|
||||
aFloatCache->mRegion.height = region.height;
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
nscoord tx, ty;
|
||||
mSpaceManager->GetTranslation(tx, ty);
|
||||
nsFrame::ListTag(stdout, mBlock);
|
||||
printf(": FlowAndPlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
|
||||
printf(": FlowAndPlaceFloat: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
|
||||
tx, ty, mSpaceManagerX, mSpaceManagerY,
|
||||
aFloaterCache->mRegion.x, aFloaterCache->mRegion.y,
|
||||
aFloaterCache->mRegion.width, aFloaterCache->mRegion.height);
|
||||
aFloatCache->mRegion.x, aFloatCache->mRegion.y,
|
||||
aFloatCache->mRegion.width, aFloatCache->mRegion.height);
|
||||
#endif
|
||||
|
||||
// Set the origin of the floater frame, in frame coordinates. These
|
||||
// Set the origin of the float frame, in frame coordinates. These
|
||||
// coordinates are <b>not</b> relative to the spacemanager
|
||||
// translation, therefore we have to factor in our border/padding.
|
||||
nscoord x = borderPadding.left + aFloaterCache->mMargins.left + region.x;
|
||||
nscoord y = borderPadding.top + aFloaterCache->mMargins.top + region.y;
|
||||
nscoord x = borderPadding.left + aFloatCache->mMargins.left + region.x;
|
||||
nscoord y = borderPadding.top + aFloatCache->mMargins.top + region.y;
|
||||
|
||||
// If floater is relatively positioned, factor that in as well
|
||||
// If float is relatively positioned, factor that in as well
|
||||
// XXXldb Should this be done after handling the combined area
|
||||
// below?
|
||||
if (NS_STYLE_POSITION_RELATIVE == floaterDisplay->mPosition) {
|
||||
x += aFloaterCache->mOffsets.left;
|
||||
y += aFloaterCache->mOffsets.top;
|
||||
if (NS_STYLE_POSITION_RELATIVE == floatDisplay->mPosition) {
|
||||
x += aFloatCache->mOffsets.left;
|
||||
y += aFloatCache->mOffsets.top;
|
||||
}
|
||||
|
||||
// Position the floater and make sure and views are properly
|
||||
// Position the float and make sure and views are properly
|
||||
// positioned. We need to explicitly position its child views as
|
||||
// well, since we're moving the floater after flowing it.
|
||||
floater->SetPosition(nsPoint(x, y));
|
||||
nsContainerFrame::PositionFrameView(mPresContext, floater);
|
||||
nsContainerFrame::PositionChildViews(mPresContext, floater);
|
||||
// well, since we're moving the float after flowing it.
|
||||
floatFrame->SetPosition(nsPoint(x, y));
|
||||
nsContainerFrame::PositionFrameView(mPresContext, floatFrame);
|
||||
nsContainerFrame::PositionChildViews(mPresContext, floatFrame);
|
||||
|
||||
// Update the floater combined area state
|
||||
nsRect combinedArea = aFloaterCache->mCombinedArea;
|
||||
// Update the float combined area state
|
||||
nsRect combinedArea = aFloatCache->mCombinedArea;
|
||||
combinedArea.x += x;
|
||||
combinedArea.y += y;
|
||||
// When we are placing a right floater in an unconstrained situation or
|
||||
// when shrink wrapping, we don't apply it to the floater combined area
|
||||
// When we are placing a right float in an unconstrained situation or
|
||||
// when shrink wrapping, we don't apply it to the float combined area
|
||||
// immediately, since there's no need to since we're guaranteed another
|
||||
// reflow, and since there's no need to change the code that was
|
||||
// necessary back when the floater was positioned relative to
|
||||
// necessary back when the float was positioned relative to
|
||||
// NS_UNCONSTRAINEDSIZE.
|
||||
if (isLeftFloater ||
|
||||
if (isLeftFloat ||
|
||||
!GetFlag(BRS_UNCONSTRAINEDWIDTH) ||
|
||||
!GetFlag(BRS_SHRINKWRAPWIDTH)) {
|
||||
mFloaterCombinedArea.UnionRect(combinedArea, mFloaterCombinedArea);
|
||||
mFloatCombinedArea.UnionRect(combinedArea, mFloatCombinedArea);
|
||||
} else if (GetFlag(BRS_SHRINKWRAPWIDTH)) {
|
||||
// Mark the line dirty so we come back and re-place the floater once
|
||||
// Mark the line dirty so we come back and re-place the float once
|
||||
// the shrink wrap width is determined
|
||||
mCurrentLine->MarkDirty();
|
||||
SetFlag(BRS_NEEDRESIZEREFLOW, PR_TRUE);
|
||||
|
@ -1124,46 +1124,46 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsRect r = floater->GetRect();
|
||||
nsRect r = floatFrame->GetRect();
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("placed floater: ");
|
||||
nsFrame::ListTag(stdout, floater);
|
||||
printf("placed float: ");
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Place below-current-line floaters.
|
||||
* Place below-current-line floats.
|
||||
*/
|
||||
PRBool
|
||||
nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
|
||||
nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheList& aList)
|
||||
{
|
||||
nsFloaterCache* fc = aList.Head();
|
||||
nsFloatCache* fc = aList.Head();
|
||||
while (fc) {
|
||||
NS_ASSERTION(!fc->mIsCurrentLineFloater,
|
||||
"A cl floater crept into the bcl floater list.");
|
||||
if (!fc->mIsCurrentLineFloater) {
|
||||
NS_ASSERTION(!fc->mIsCurrentLineFloat,
|
||||
"A cl float crept into the bcl float list.");
|
||||
if (!fc->mIsCurrentLineFloat) {
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("placing bcl floater: ");
|
||||
printf("placing bcl float: ");
|
||||
nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame());
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Place the floater
|
||||
PRBool isLeftFloater;
|
||||
// Place the float
|
||||
PRBool isLeftFloat;
|
||||
nsReflowStatus reflowStatus;
|
||||
FlowAndPlaceFloater(fc, &isLeftFloater, reflowStatus);
|
||||
FlowAndPlaceFloat(fc, &isLeftFloat, reflowStatus);
|
||||
|
||||
if (NS_FRAME_IS_TRUNCATED(reflowStatus)) {
|
||||
// return before processing all of the floaters, since the line will be pushed.
|
||||
// return before processing all of the floats, since the line will be pushed.
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus)) {
|
||||
// Create a continuation for the incomplete floater and its placeholder.
|
||||
// Create a continuation for the incomplete float and its placeholder.
|
||||
nsresult rv = mBlock->SplitPlaceholder(*mPresContext, *fc->mPlaceholder);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
@ -1175,30 +1175,30 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
|
|||
}
|
||||
|
||||
void
|
||||
nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
||||
nsBlockReflowState::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("clear floaters: in: mY=%d aY=%d(%d)\n",
|
||||
printf("clear floats: in: mY=%d aY=%d(%d)\n",
|
||||
mY, aY, aY - BorderPadding().top);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NOISY_FLOATER_CLEARING
|
||||
printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%d\n",
|
||||
#ifdef NOISY_FLOAT_CLEARING
|
||||
printf("nsBlockReflowState::ClearFloats: aY=%d breakType=%d\n",
|
||||
aY, aBreakType);
|
||||
mSpaceManager->List(stdout);
|
||||
#endif
|
||||
const nsMargin& bp = BorderPadding();
|
||||
nscoord newY = mBand.ClearFloaters(aY - bp.top, aBreakType);
|
||||
nscoord newY = mBand.ClearFloats(aY - bp.top, aBreakType);
|
||||
mY = newY + bp.top;
|
||||
GetAvailableSpace();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top);
|
||||
printf("clear floats: out: mY=%d(%d)\n", mY, mY - bp.top);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -68,29 +68,29 @@ public:
|
|||
|
||||
void GetAvailableSpace(nscoord aY);
|
||||
|
||||
void InitFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
void InitFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
void AddFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
void AddFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool CanPlaceFloater(const nsRect& aFloaterRect, PRUint8 aFloats);
|
||||
PRBool CanPlaceFloat(const nsRect& aFloatRect, PRUint8 aFloats);
|
||||
|
||||
void FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
||||
PRBool* aIsLeftFloater,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
void FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
||||
PRBool* aIsLeftFloat,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aFloaters);
|
||||
PRBool PlaceBelowCurrentLineFloats(nsFloatCacheList& aFloats);
|
||||
|
||||
// called when clearing a line with a break type caused by a BR past
|
||||
// floats, and also used internally by ClearPastFloaters
|
||||
void ClearFloaters(nscoord aY, PRUint8 aBreakType);
|
||||
// floats, and also used internally by ClearPastFloats
|
||||
void ClearFloats(nscoord aY, PRUint8 aBreakType);
|
||||
|
||||
// called when clearing a block past floats
|
||||
PRBool ClearPastFloaters(PRUint8 aBreakType);
|
||||
PRBool ClearPastFloats(PRUint8 aBreakType);
|
||||
|
||||
PRBool IsAdjacentWithTop() const {
|
||||
return mY == mReflowState.mComputedBorderPadding.top;
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
nsRect& aResult);
|
||||
|
||||
protected:
|
||||
void RecoverFloaters(nsLineList::iterator aLine, nscoord aDeltaY);
|
||||
void RecoverFloats(nsLineList::iterator aLine, nscoord aDeltaY);
|
||||
|
||||
public:
|
||||
void RecoverStateFrom(nsLineList::iterator aLine, nscoord aDeltaY);
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
mLineNumber++;
|
||||
}
|
||||
|
||||
PRBool IsImpactedByFloater() const;
|
||||
PRBool IsImpactedByFloat() const;
|
||||
|
||||
nsLineBox* NewLineBox(nsIFrame* aFrame, PRInt32 aCount, PRBool aIsBlock);
|
||||
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
// placed <b>after</b> taking into account the blocks border and
|
||||
// padding. This, therefore, represents the inner "content area" (in
|
||||
// spacemanager coordinates) where child frames will be placed,
|
||||
// including child blocks and floaters.
|
||||
// including child blocks and floats.
|
||||
nscoord mSpaceManagerX, mSpaceManagerY;
|
||||
|
||||
// XXX get rid of this
|
||||
|
@ -184,10 +184,10 @@ public:
|
|||
// The maximum x-most of each line
|
||||
nscoord mKidXMost;
|
||||
|
||||
// The combined area of all floaters placed so far
|
||||
nsRect mFloaterCombinedArea;
|
||||
// The combined area of all floats placed so far
|
||||
nsRect mFloatCombinedArea;
|
||||
|
||||
nsFloaterCacheFreeList mFloaterCacheFreeList;
|
||||
nsFloatCacheFreeList mFloatCacheFreeList;
|
||||
|
||||
// Previous child. This is used when pulling up a frame to update
|
||||
// the sibling list.
|
||||
|
@ -210,16 +210,16 @@ public:
|
|||
// Temporary line-reflow state. This state is used during the reflow
|
||||
// of a given line, but doesn't have meaning before or after.
|
||||
|
||||
// The list of floaters that are "current-line" floaters. These are
|
||||
// The list of floats that are "current-line" floats. These are
|
||||
// added to the line after the line has been reflowed, to keep the
|
||||
// list fiddling from being N^2.
|
||||
nsFloaterCacheFreeList mCurrentLineFloaters;
|
||||
nsFloatCacheFreeList mCurrentLineFloats;
|
||||
|
||||
// The list of floaters which are "below current-line"
|
||||
// floaters. These are reflowed/placed after the line is reflowed
|
||||
// The list of floats which are "below current-line"
|
||||
// floats. These are reflowed/placed after the line is reflowed
|
||||
// and placed. Again, this is done to keep the list fiddling from
|
||||
// being N^2.
|
||||
nsFloaterCacheFreeList mBelowCurrentLineFloaters;
|
||||
nsFloatCacheFreeList mBelowCurrentLineFloats;
|
||||
|
||||
nscoord mMaxElementWidth;
|
||||
nscoord mMaximumWidth;
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
|
||||
PRInt16 mFlags;
|
||||
|
||||
PRUint8 mFloaterBreakType;
|
||||
PRUint8 mFloatBreakType;
|
||||
|
||||
void SetFlag(PRUint32 aFlag, PRBool aValue)
|
||||
{
|
||||
|
|
|
@ -103,7 +103,7 @@ typedef void
|
|||
|
||||
/**
|
||||
* Indication of how the frame can be split. This is used when doing runaround
|
||||
* of floaters, and when pulling up child frames from a next-in-flow.
|
||||
* of floats, and when pulling up child frames from a next-in-flow.
|
||||
*
|
||||
* The choices are splittable, not splittable at all, and splittable in
|
||||
* a non-rectangular fashion. This last type only applies to block-level
|
||||
|
@ -265,7 +265,7 @@ enum nsSpread {
|
|||
// For HTML reflow we rename with the different paint layers are
|
||||
// actually used for.
|
||||
#define NS_FRAME_PAINT_LAYER_BACKGROUND eFramePaintLayer_Underlay
|
||||
#define NS_FRAME_PAINT_LAYER_FLOATERS eFramePaintLayer_Content
|
||||
#define NS_FRAME_PAINT_LAYER_FLOATS eFramePaintLayer_Content
|
||||
#define NS_FRAME_PAINT_LAYER_FOREGROUND eFramePaintLayer_Overlay
|
||||
#define NS_FRAME_PAINT_LAYER_DEBUG eFramePaintLayer_Overlay
|
||||
|
||||
|
|
|
@ -129,10 +129,10 @@ nsLineBox::Cleanup()
|
|||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters)
|
||||
ListFloats(FILE* out, PRInt32 aIndent, const nsFloatCacheList& aFloats)
|
||||
{
|
||||
nsAutoString frameName;
|
||||
nsFloaterCache* fc = aFloaters.Head();
|
||||
nsFloatCache* fc = aFloats.Head();
|
||||
while (fc) {
|
||||
nsFrame::IndentBy(out, aIndent);
|
||||
nsPlaceholderFrame* ph = fc->mPlaceholder;
|
||||
|
@ -148,7 +148,7 @@ ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters)
|
|||
}
|
||||
}
|
||||
fprintf(out, " %s region={%d,%d,%d,%d} combinedArea={%d,%d,%d,%d}",
|
||||
fc->mIsCurrentLineFloater ? "cl" : "bcl",
|
||||
fc->mIsCurrentLineFloat ? "cl" : "bcl",
|
||||
fc->mRegion.x, fc->mRegion.y,
|
||||
fc->mRegion.width, fc->mRegion.height,
|
||||
fc->mCombinedArea.x, fc->mCombinedArea.y,
|
||||
|
@ -187,7 +187,7 @@ nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const
|
|||
IsBlock() ? "block" : "inline",
|
||||
IsDirty() ? "dirty" : "clean",
|
||||
IsPreviousMarginDirty() ? "prevmargindirty" : "prevmarginclean",
|
||||
IsImpactedByFloater() ? "impacted" : "not impacted",
|
||||
IsImpactedByFloat() ? "impacted" : "not impacted",
|
||||
IsLineWrapped() ? "wrapped" : "not wrapped",
|
||||
BreakTypeToString(GetBreakType()),
|
||||
mAllFlags);
|
||||
|
@ -231,9 +231,9 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const
|
|||
}
|
||||
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
if (HasFloaters()) {
|
||||
fputs("> floaters <\n", out);
|
||||
ListFloaters(out, aIndent + 1, mInlineData->mFloaters);
|
||||
if (HasFloats()) {
|
||||
fputs("> floats <\n", out);
|
||||
ListFloats(out, aIndent + 1, mInlineData->mFloats);
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
}
|
||||
fputs(">\n", out);
|
||||
|
@ -390,7 +390,7 @@ nsLineBox::MaybeFreeData()
|
|||
{
|
||||
if (mData && (mData->mCombinedArea == mBounds)) {
|
||||
if (IsInline()) {
|
||||
if (mInlineData->mFloaters.IsEmpty()) {
|
||||
if (mInlineData->mFloats.IsEmpty()) {
|
||||
delete mInlineData;
|
||||
mInlineData = nsnull;
|
||||
}
|
||||
|
@ -403,53 +403,53 @@ nsLineBox::MaybeFreeData()
|
|||
}
|
||||
|
||||
// XXX get rid of this???
|
||||
nsFloaterCache*
|
||||
nsLineBox::GetFirstFloater()
|
||||
nsFloatCache*
|
||||
nsLineBox::GetFirstFloat()
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
return mInlineData ? mInlineData->mFloaters.Head() : nsnull;
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
return mInlineData ? mInlineData->mFloats.Head() : nsnull;
|
||||
}
|
||||
|
||||
// XXX this might be too eager to free memory
|
||||
void
|
||||
nsLineBox::FreeFloaters(nsFloaterCacheFreeList& aFreeList)
|
||||
nsLineBox::FreeFloats(nsFloatCacheFreeList& aFreeList)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
if (IsInline()) {
|
||||
if (mInlineData) {
|
||||
aFreeList.Append(mInlineData->mFloaters);
|
||||
aFreeList.Append(mInlineData->mFloats);
|
||||
MaybeFreeData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsLineBox::AppendFloaters(nsFloaterCacheFreeList& aFreeList)
|
||||
nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
if (IsInline()) {
|
||||
if (aFreeList.NotEmpty()) {
|
||||
if (!mInlineData) {
|
||||
mInlineData = new ExtraInlineData(mBounds);
|
||||
}
|
||||
if (mInlineData) {
|
||||
mInlineData->mFloaters.Append(aFreeList);
|
||||
mInlineData->mFloats.Append(aFreeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLineBox::RemoveFloater(nsIFrame* aFrame)
|
||||
nsLineBox::RemoveFloat(nsIFrame* aFrame)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
if (IsInline() && mInlineData) {
|
||||
nsFloaterCache* fc = mInlineData->mFloaters.Find(aFrame);
|
||||
nsFloatCache* fc = mInlineData->mFloats.Find(aFrame);
|
||||
if (fc) {
|
||||
// Note: the placeholder is part of the line's child list
|
||||
// and will be removed later.
|
||||
fc->mPlaceholder->SetOutOfFlowFrame(nsnull);
|
||||
mInlineData->mFloaters.Remove(fc);
|
||||
mInlineData->mFloats.Remove(fc);
|
||||
MaybeFreeData();
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -970,21 +970,21 @@ nsLineIterator::GetNextSiblingOnLine(nsIFrame*& aFrame, PRInt32 aLineNumber)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsFloaterCacheList::~nsFloaterCacheList()
|
||||
nsFloatCacheList::~nsFloatCacheList()
|
||||
{
|
||||
nsFloaterCache* floater = mHead;
|
||||
while (floater) {
|
||||
nsFloaterCache* next = floater->mNext;
|
||||
delete floater;
|
||||
floater = next;
|
||||
nsFloatCache* fc = mHead;
|
||||
while (fc) {
|
||||
nsFloatCache* next = fc->mNext;
|
||||
delete fc;
|
||||
fc = next;
|
||||
}
|
||||
mHead = nsnull;
|
||||
}
|
||||
|
||||
nsFloaterCache*
|
||||
nsFloaterCacheList::Tail() const
|
||||
nsFloatCache*
|
||||
nsFloatCacheList::Tail() const
|
||||
{
|
||||
nsFloaterCache* fc = mHead;
|
||||
nsFloatCache* fc = mHead;
|
||||
while (fc) {
|
||||
if (!fc->mNext) {
|
||||
break;
|
||||
|
@ -995,9 +995,9 @@ nsFloaterCacheList::Tail() const
|
|||
}
|
||||
|
||||
void
|
||||
nsFloaterCacheList::Append(nsFloaterCacheFreeList& aList)
|
||||
nsFloatCacheList::Append(nsFloatCacheFreeList& aList)
|
||||
{
|
||||
nsFloaterCache* tail = Tail();
|
||||
nsFloatCache* tail = Tail();
|
||||
if (tail) {
|
||||
tail->mNext = aList.mHead;
|
||||
}
|
||||
|
@ -1008,10 +1008,10 @@ nsFloaterCacheList::Append(nsFloaterCacheFreeList& aList)
|
|||
aList.mTail = nsnull;
|
||||
}
|
||||
|
||||
nsFloaterCache*
|
||||
nsFloaterCacheList::Find(nsIFrame* aOutOfFlowFrame)
|
||||
nsFloatCache*
|
||||
nsFloatCacheList::Find(nsIFrame* aOutOfFlowFrame)
|
||||
{
|
||||
nsFloaterCache* fc = mHead;
|
||||
nsFloatCache* fc = mHead;
|
||||
while (fc) {
|
||||
if (fc->mPlaceholder->GetOutOfFlowFrame() == aOutOfFlowFrame) {
|
||||
break;
|
||||
|
@ -1022,10 +1022,10 @@ nsFloaterCacheList::Find(nsIFrame* aOutOfFlowFrame)
|
|||
}
|
||||
|
||||
void
|
||||
nsFloaterCacheList::Remove(nsFloaterCache* aElement)
|
||||
nsFloatCacheList::Remove(nsFloatCache* aElement)
|
||||
{
|
||||
nsFloaterCache** fcp = &mHead;
|
||||
nsFloaterCache* fc;
|
||||
nsFloatCache** fcp = &mHead;
|
||||
nsFloatCache* fc;
|
||||
while (nsnull != (fc = *fcp)) {
|
||||
if (fc == aElement) {
|
||||
*fcp = fc->mNext;
|
||||
|
@ -1038,7 +1038,7 @@ nsFloaterCacheList::Remove(nsFloaterCache* aElement)
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsFloaterCacheFreeList::Append(nsFloaterCacheList& aList)
|
||||
nsFloatCacheFreeList::Append(nsFloatCacheList& aList)
|
||||
{
|
||||
if (mTail) {
|
||||
mTail->mNext = aList.mHead;
|
||||
|
@ -1050,10 +1050,10 @@ nsFloaterCacheFreeList::Append(nsFloaterCacheList& aList)
|
|||
aList.mHead = nsnull;
|
||||
}
|
||||
|
||||
nsFloaterCache*
|
||||
nsFloaterCacheFreeList::Alloc()
|
||||
nsFloatCache*
|
||||
nsFloatCacheFreeList::Alloc()
|
||||
{
|
||||
nsFloaterCache* fc = mHead;
|
||||
nsFloatCache* fc = mHead;
|
||||
if (mHead) {
|
||||
if (mHead == mTail) {
|
||||
mHead = mTail = nsnull;
|
||||
|
@ -1064,42 +1064,42 @@ nsFloaterCacheFreeList::Alloc()
|
|||
fc->mNext = nsnull;
|
||||
}
|
||||
else {
|
||||
fc = new nsFloaterCache();
|
||||
fc = new nsFloatCache();
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
|
||||
void
|
||||
nsFloaterCacheFreeList::Append(nsFloaterCache* aFloater)
|
||||
nsFloatCacheFreeList::Append(nsFloatCache* aFloat)
|
||||
{
|
||||
aFloater->mNext = nsnull;
|
||||
aFloat->mNext = nsnull;
|
||||
if (mTail) {
|
||||
mTail->mNext = aFloater;
|
||||
mTail = aFloater;
|
||||
mTail->mNext = aFloat;
|
||||
mTail = aFloat;
|
||||
}
|
||||
else {
|
||||
mHead = mTail = aFloater;
|
||||
mHead = mTail = aFloat;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsFloaterCache)
|
||||
MOZ_DECL_CTOR_COUNTER(nsFloatCache)
|
||||
|
||||
nsFloaterCache::nsFloaterCache()
|
||||
nsFloatCache::nsFloatCache()
|
||||
: mPlaceholder(nsnull),
|
||||
mIsCurrentLineFloater(PR_TRUE),
|
||||
mIsCurrentLineFloat(PR_TRUE),
|
||||
mMargins(0, 0, 0, 0),
|
||||
mOffsets(0, 0, 0, 0),
|
||||
mCombinedArea(0, 0, 0, 0),
|
||||
mNext(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsFloaterCache);
|
||||
MOZ_COUNT_CTOR(nsFloatCache);
|
||||
}
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
nsFloaterCache::~nsFloaterCache()
|
||||
nsFloatCache::~nsFloatCache()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsFloaterCache);
|
||||
MOZ_COUNT_DTOR(nsFloatCache);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,60 +45,60 @@
|
|||
|
||||
class nsSpaceManager;
|
||||
class nsLineBox;
|
||||
class nsFloaterCache;
|
||||
class nsFloaterCacheList;
|
||||
class nsFloaterCacheFreeList;
|
||||
class nsFloatCache;
|
||||
class nsFloatCacheList;
|
||||
class nsFloatCacheFreeList;
|
||||
|
||||
// State cached after reflowing a floater. This state is used during
|
||||
// incremental reflow when we avoid reflowing a floater.
|
||||
class nsFloaterCache {
|
||||
// State cached after reflowing a float. This state is used during
|
||||
// incremental reflow when we avoid reflowing a float.
|
||||
class nsFloatCache {
|
||||
public:
|
||||
nsFloaterCache();
|
||||
nsFloatCache();
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
~nsFloaterCache();
|
||||
~nsFloatCache();
|
||||
#else
|
||||
~nsFloaterCache() { }
|
||||
~nsFloatCache() { }
|
||||
#endif
|
||||
|
||||
nsFloaterCache* Next() const { return mNext; }
|
||||
nsFloatCache* Next() const { return mNext; }
|
||||
|
||||
nsPlaceholderFrame* mPlaceholder; // nsPlaceholderFrame
|
||||
|
||||
// This will be true if the floater was placed on the current line
|
||||
// This will be true if the float was placed on the current line
|
||||
// instead of below the current line.
|
||||
PRBool mIsCurrentLineFloater;
|
||||
PRBool mIsCurrentLineFloat;
|
||||
|
||||
nsMargin mMargins; // computed margins
|
||||
|
||||
nsMargin mOffsets; // computed offsets (relative pos)
|
||||
|
||||
// Region in the spacemanager impacted by this floater; the
|
||||
// Region in the spacemanager impacted by this float; the
|
||||
// coordinates are relative to the containing block frame. The
|
||||
// region includes the margins around the floater, but doesn't
|
||||
// region includes the margins around the float, but doesn't
|
||||
// include the relative offsets.
|
||||
nsRect mRegion;
|
||||
|
||||
// Combined area for the floater. This will not include the margins
|
||||
// for the floater. Like mRegion, the coordinates are relative to
|
||||
// Combined area for the float. This will not include the margins
|
||||
// for the float. Like mRegion, the coordinates are relative to
|
||||
// the containing block frame.
|
||||
nsRect mCombinedArea;
|
||||
|
||||
// The floater's max-element-width.
|
||||
// The float's max-element-width.
|
||||
nscoord mMaxElementWidth;
|
||||
|
||||
protected:
|
||||
nsFloaterCache* mNext;
|
||||
nsFloatCache* mNext;
|
||||
|
||||
friend class nsFloaterCacheList;
|
||||
friend class nsFloaterCacheFreeList;
|
||||
friend class nsFloatCacheList;
|
||||
friend class nsFloatCacheFreeList;
|
||||
};
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
class nsFloaterCacheList {
|
||||
class nsFloatCacheList {
|
||||
public:
|
||||
nsFloaterCacheList() : mHead(nsnull) { }
|
||||
~nsFloaterCacheList();
|
||||
nsFloatCacheList() : mHead(nsnull) { }
|
||||
~nsFloatCacheList();
|
||||
|
||||
PRBool IsEmpty() const {
|
||||
return nsnull == mHead;
|
||||
|
@ -108,44 +108,44 @@ public:
|
|||
return nsnull != mHead;
|
||||
}
|
||||
|
||||
nsFloaterCache* Head() const {
|
||||
nsFloatCache* Head() const {
|
||||
return mHead;
|
||||
}
|
||||
|
||||
nsFloaterCache* Tail() const;
|
||||
nsFloatCache* Tail() const;
|
||||
|
||||
nsFloaterCache* Find(nsIFrame* aOutOfFlowFrame);
|
||||
nsFloatCache* Find(nsIFrame* aOutOfFlowFrame);
|
||||
|
||||
void Remove(nsFloaterCache* aElement);
|
||||
void Remove(nsFloatCache* aElement);
|
||||
|
||||
void Append(nsFloaterCacheFreeList& aList);
|
||||
void Append(nsFloatCacheFreeList& aList);
|
||||
|
||||
protected:
|
||||
nsFloaterCache* mHead;
|
||||
nsFloatCache* mHead;
|
||||
|
||||
friend class nsFloaterCacheFreeList;
|
||||
friend class nsFloatCacheFreeList;
|
||||
};
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
class nsFloaterCacheFreeList : public nsFloaterCacheList {
|
||||
class nsFloatCacheFreeList : public nsFloatCacheList {
|
||||
public:
|
||||
nsFloaterCacheFreeList() : mTail(nsnull) { }
|
||||
~nsFloaterCacheFreeList() { }
|
||||
nsFloatCacheFreeList() : mTail(nsnull) { }
|
||||
~nsFloatCacheFreeList() { }
|
||||
|
||||
// Steal away aList's nsFloaterCache objects and put them on this
|
||||
// Steal away aList's nsFloatCache objects and put them on this
|
||||
// free-list.
|
||||
void Append(nsFloaterCacheList& aList);
|
||||
void Append(nsFloatCacheList& aList);
|
||||
|
||||
void Append(nsFloaterCache* aFloaterCache);
|
||||
void Append(nsFloatCache* aFloatCache);
|
||||
|
||||
// Allocate a new nsFloaterCache object
|
||||
nsFloaterCache* Alloc();
|
||||
// Allocate a new nsFloatCache object
|
||||
nsFloatCache* Alloc();
|
||||
|
||||
protected:
|
||||
nsFloaterCache* mTail;
|
||||
nsFloatCache* mTail;
|
||||
|
||||
friend class nsFloaterCacheList;
|
||||
friend class nsFloatCacheList;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -246,13 +246,13 @@ public:
|
|||
return mFlags.mPreviousMarginDirty;
|
||||
}
|
||||
|
||||
// mImpactedByFloater bit
|
||||
void SetLineIsImpactedByFloater(PRBool aValue) {
|
||||
// mImpactedByFloat bit
|
||||
void SetLineIsImpactedByFloat(PRBool aValue) {
|
||||
NS_ASSERTION((PR_FALSE==aValue || PR_TRUE==aValue), "somebody is playing fast and loose with bools and bits!");
|
||||
mFlags.mImpactedByFloater = aValue;
|
||||
mFlags.mImpactedByFloat = aValue;
|
||||
}
|
||||
PRBool IsImpactedByFloater() const {
|
||||
return mFlags.mImpactedByFloater;
|
||||
PRBool IsImpactedByFloat() const {
|
||||
return mFlags.mImpactedByFloat;
|
||||
}
|
||||
|
||||
// mHasPercentageChild bit
|
||||
|
@ -324,14 +324,14 @@ public:
|
|||
nsCollapsingMargin GetCarriedOutBottomMargin() const;
|
||||
void SetCarriedOutBottomMargin(nsCollapsingMargin aValue);
|
||||
|
||||
// mFloaters
|
||||
PRBool HasFloaters() const {
|
||||
return (IsInline() && mInlineData) && mInlineData->mFloaters.NotEmpty();
|
||||
// mFloats
|
||||
PRBool HasFloats() const {
|
||||
return (IsInline() && mInlineData) && mInlineData->mFloats.NotEmpty();
|
||||
}
|
||||
nsFloaterCache* GetFirstFloater();
|
||||
void FreeFloaters(nsFloaterCacheFreeList& aFreeList);
|
||||
void AppendFloaters(nsFloaterCacheFreeList& aFreeList);
|
||||
PRBool RemoveFloater(nsIFrame* aFrame);
|
||||
nsFloatCache* GetFirstFloat();
|
||||
void FreeFloats(nsFloatCacheFreeList& aFreeList);
|
||||
void AppendFloats(nsFloatCacheFreeList& aFreeList);
|
||||
PRBool RemoveFloat(nsIFrame* aFrame);
|
||||
|
||||
// Combined area is the area of the line that should influence the
|
||||
// overflow area of its parent block. The combined area should be
|
||||
|
@ -416,7 +416,7 @@ public:
|
|||
PRUint32 mDirty : 1;
|
||||
PRUint32 mPreviousMarginDirty : 1;
|
||||
PRUint32 mBlock : 1;
|
||||
PRUint32 mImpactedByFloater : 1;
|
||||
PRUint32 mImpactedByFloat : 1;
|
||||
PRUint32 mHasPercentageChild : 1;
|
||||
PRUint32 mLineWrapped: 1;
|
||||
PRUint32 mForceInvalidate: 1; // default 0 = means this line handles it's own invalidation. 1 = always invalidate this entire line
|
||||
|
@ -444,7 +444,7 @@ public:
|
|||
struct ExtraInlineData : public ExtraData {
|
||||
ExtraInlineData(const nsRect& aBounds) : ExtraData(aBounds) {
|
||||
}
|
||||
nsFloaterCacheList mFloaters;
|
||||
nsFloatCacheList mFloats;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
@ -169,7 +169,7 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
|
|||
mColumn = 0;
|
||||
mFlags = 0; // default all flags to false except those that follow here...
|
||||
SetFlag(LL_ENDSINWHITESPACE, PR_TRUE);
|
||||
mPlacedFloaters = 0;
|
||||
mPlacedFloats = 0;
|
||||
mTotalPlacedFrames = 0;
|
||||
mTopEdge = mBottomEdge = 0;
|
||||
|
||||
|
@ -229,7 +229,7 @@ HasPrevInFlow(nsIFrame *aFrame)
|
|||
void
|
||||
nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aImpactedByFloaters,
|
||||
PRBool aImpactedByFloats,
|
||||
PRBool aIsTopOfPage)
|
||||
{
|
||||
NS_ASSERTION(nsnull == mRootSpan, "bad linelayout user");
|
||||
|
@ -251,7 +251,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
printf(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n",
|
||||
aX, aY, aWidth, aHeight,
|
||||
aImpactedByFloaters?"true":"false",
|
||||
aImpactedByFloats?"true":"false",
|
||||
aIsTopOfPage ? "top-of-page" : "");
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
|
@ -265,10 +265,10 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE);
|
||||
SetFlag(LL_ISTOPOFPAGE, aIsTopOfPage);
|
||||
SetFlag(LL_UPDATEDBAND, PR_FALSE);
|
||||
mPlacedFloaters = 0;
|
||||
SetFlag(LL_IMPACTEDBYFLOATERS, aImpactedByFloaters);
|
||||
mPlacedFloats = 0;
|
||||
SetFlag(LL_IMPACTEDBYFLOATS, aImpactedByFloats);
|
||||
mTotalPlacedFrames = 0;
|
||||
SetFlag(LL_CANPLACEFLOATER, PR_TRUE);
|
||||
SetFlag(LL_CANPLACEFLOAT, PR_TRUE);
|
||||
SetFlag(LL_LINEENDSINBR, PR_FALSE);
|
||||
mSpanDepth = 0;
|
||||
mMaxTopBoxHeight = mMaxBottomBoxHeight = 0;
|
||||
|
@ -374,12 +374,12 @@ nsLineLayout::EndLineReflow()
|
|||
void
|
||||
nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPlacedLeftFloater,
|
||||
nsIFrame* aFloaterFrame)
|
||||
PRBool aPlacedLeftFloat,
|
||||
nsIFrame* aFloatFrame)
|
||||
{
|
||||
#ifdef REALLY_NOISY_REFLOW
|
||||
printf("nsLL::UpdateBand %d, %d, %d, %d, frame=%p placedLeft=%s\n will set mImpacted to PR_TRUE\n",
|
||||
aX, aY, aWidth, aHeight, aFloaterFrame, aPlacedLeftFloater?"true":"false");
|
||||
aX, aY, aWidth, aHeight, aFloatFrame, aPlacedLeftFloat?"true":"false");
|
||||
#endif
|
||||
PerSpanData* psd = mRootSpan;
|
||||
NS_PRECONDITION(psd->mX == psd->mLeftEdge, "update-band called late");
|
||||
|
@ -405,9 +405,9 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
}
|
||||
#ifdef NOISY_REFLOW
|
||||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s floater\n",
|
||||
printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s float\n",
|
||||
aX, aY, aWidth, aHeight, deltaWidth,
|
||||
aPlacedLeftFloater ? "left" : "right");
|
||||
aPlacedLeftFloat ? "left" : "right");
|
||||
#endif
|
||||
|
||||
psd->mLeftEdge = aX;
|
||||
|
@ -426,29 +426,29 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
mBottomEdge = aY + aHeight;
|
||||
}
|
||||
SetFlag(LL_UPDATEDBAND, PR_TRUE);
|
||||
mPlacedFloaters |= (aPlacedLeftFloater ? PLACED_LEFT : PLACED_RIGHT);
|
||||
SetFlag(LL_IMPACTEDBYFLOATERS, PR_TRUE);
|
||||
mPlacedFloats |= (aPlacedLeftFloat ? PLACED_LEFT : PLACED_RIGHT);
|
||||
SetFlag(LL_IMPACTEDBYFLOATS, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFloaterFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
SetFlag(LL_LASTFLOATERWASLETTERFRAME, (nsLayoutAtoms::letterFrame == frameType.get()));
|
||||
aFloatFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
SetFlag(LL_LASTFLOATWASLETTERFRAME, (nsLayoutAtoms::letterFrame == frameType.get()));
|
||||
|
||||
// Now update all of the open spans...
|
||||
mRootSpan->mContainsFloater = PR_TRUE; // make sure mRootSpan gets updated too
|
||||
mRootSpan->mContainsFloat = PR_TRUE; // make sure mRootSpan gets updated too
|
||||
psd = mCurrentSpan;
|
||||
while (psd != mRootSpan) {
|
||||
NS_ASSERTION(nsnull != psd, "null ptr");
|
||||
if (nsnull == psd) {
|
||||
break;
|
||||
}
|
||||
NS_ASSERTION(psd->mX == psd->mLeftEdge, "bad floater placement");
|
||||
NS_ASSERTION(psd->mX == psd->mLeftEdge, "bad float placement");
|
||||
if (NS_UNCONSTRAINEDSIZE == aWidth) {
|
||||
psd->mRightEdge = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
psd->mRightEdge += deltaWidth;
|
||||
}
|
||||
psd->mContainsFloater = PR_TRUE;
|
||||
psd->mContainsFloat = PR_TRUE;
|
||||
#ifdef NOISY_REFLOW
|
||||
printf(" span %p: oldRightEdge=%d newRightEdge=%d\n",
|
||||
psd, psd->mRightEdge - deltaWidth, psd->mRightEdge);
|
||||
|
@ -468,7 +468,7 @@ nsLineLayout::UpdateFrames()
|
|||
|
||||
PerSpanData* psd = mRootSpan;
|
||||
if (NS_STYLE_DIRECTION_LTR == psd->mDirection) {
|
||||
if (PLACED_LEFT & mPlacedFloaters) {
|
||||
if (PLACED_LEFT & mPlacedFloats) {
|
||||
PerFrameData* pfd = psd->mFirstFrame;
|
||||
while (nsnull != pfd) {
|
||||
pfd->mBounds.x = psd->mX;
|
||||
|
@ -476,7 +476,7 @@ nsLineLayout::UpdateFrames()
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (PLACED_RIGHT & mPlacedFloaters) {
|
||||
else if (PLACED_RIGHT & mPlacedFloats) {
|
||||
// XXX handle DIR=right-to-left
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ nsLineLayout::NewPerSpanData(PerSpanData** aResult)
|
|||
psd->mFrame = nsnull;
|
||||
psd->mFirstFrame = nsnull;
|
||||
psd->mLastFrame = nsnull;
|
||||
psd->mContainsFloater = PR_FALSE;
|
||||
psd->mContainsFloat = PR_FALSE;
|
||||
psd->mZeroEffectiveSpanBox = PR_FALSE;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -795,9 +795,9 @@ nsLineLayout::NewPerFrameData(PerFrameData** aResult)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsLineLayout::CanPlaceFloaterNow() const
|
||||
nsLineLayout::CanPlaceFloatNow() const
|
||||
{
|
||||
return GetFlag(LL_CANPLACEFLOATER);
|
||||
return GetFlag(LL_CANPLACEFLOAT);
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -809,7 +809,7 @@ nsLineLayout::LineIsEmpty() const
|
|||
PRBool
|
||||
nsLineLayout::LineIsBreakable() const
|
||||
{
|
||||
if ((0 != mTotalPlacedFrames) || GetFlag(LL_IMPACTEDBYFLOATERS)) {
|
||||
if ((0 != mTotalPlacedFrames) || GetFlag(LL_IMPACTEDBYFLOATS)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -956,7 +956,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
// We want to guarantee that we always make progress when
|
||||
// formatting. Therefore, if the object being placed on the line is
|
||||
// too big for the line, but it is the only thing on the line
|
||||
// (including counting floaters) then we go ahead and place it
|
||||
// (including counting floats) then we go ahead and place it
|
||||
// anyway. Its also true that if the object is a part of a larger
|
||||
// object (a multiple frame word) then we will place it on the line
|
||||
// too.
|
||||
|
@ -964,7 +964,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
// Capture this state *before* we reflow the frame in case it clears
|
||||
// the state out. We need to know how to treat the current frame
|
||||
// when breaking.
|
||||
PRBool notSafeToBreak = CanPlaceFloaterNow() || InWord();
|
||||
PRBool notSafeToBreak = CanPlaceFloatNow() || InWord();
|
||||
|
||||
// Apply start margins (as appropriate) to the frame computing the
|
||||
// new starting x,y coordinates for the frame.
|
||||
|
@ -1063,7 +1063,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
pfd->mJustificationNumLetters = mTextJustificationNumLetters;
|
||||
|
||||
// XXX See if the frame is a placeholderFrame and if it is process
|
||||
// the floater.
|
||||
// the float.
|
||||
if (frameType) {
|
||||
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
|
||||
nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame();
|
||||
|
@ -1072,18 +1072,19 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
|
||||
if (!display->IsAbsolutelyPositioned()) {
|
||||
if (eReflowReason_Incremental == reason) {
|
||||
InitFloater((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
InitFloat((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
}
|
||||
else {
|
||||
AddFloater((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
AddFloat((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
}
|
||||
nsIAtom* oofft;
|
||||
outOfFlowFrame->GetFrameType(&oofft);
|
||||
if (oofft) {
|
||||
if (oofft == nsLayoutAtoms::letterFrame) {
|
||||
SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE);
|
||||
// An incomplete reflow status means we should split the floater if the
|
||||
// height is constrained (bug 145305). We never split floating first letters.
|
||||
// An incomplete reflow status means we should split the
|
||||
// float if the height is constrained (bug 145305). We
|
||||
// never split floating first letters.
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus))
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
}
|
||||
|
@ -1417,9 +1418,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
|
||||
if (aNotSafeToBreak) {
|
||||
// There are no frames on the line or we are in the first word on
|
||||
// the line. If the line isn't impacted by a floater then the
|
||||
// the line. If the line isn't impacted by a float then the
|
||||
// current frame fits.
|
||||
if (!GetFlag(LL_IMPACTEDBYFLOATERS)) {
|
||||
if (!GetFlag(LL_IMPACTEDBYFLOATS)) {
|
||||
#ifdef NOISY_CAN_PLACE_FRAME
|
||||
printf(" ==> not-safe and not-impacted fits: ");
|
||||
while (nsnull != psd) {
|
||||
|
@ -1430,8 +1431,8 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (GetFlag(LL_LASTFLOATERWASLETTERFRAME)) {
|
||||
// Another special case: see if the floater is a letter
|
||||
else if (GetFlag(LL_LASTFLOATWASLETTERFRAME)) {
|
||||
// Another special case: see if the float is a letter
|
||||
// frame. If it is, then allow the frame next to it to fit.
|
||||
if (pfd->GetFlag(PFD_ISNONEMPTYTEXTFRAME)) {
|
||||
// This must be the first piece of non-empty text (because
|
||||
|
@ -1453,7 +1454,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
|
||||
if (pfd->GetFlag(PFD_ISSTICKY)) {
|
||||
#ifdef NOISY_CAN_PLACE_FRAME
|
||||
printf(" ==> last floater was letter frame && frame is sticky\n");
|
||||
printf(" ==> last float was letter frame && frame is sticky\n");
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1490,8 +1491,8 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
}
|
||||
|
||||
// Special check for span frames
|
||||
if (pfd->mSpan && pfd->mSpan->mContainsFloater) {
|
||||
// If the span either directly or indirectly contains a floater then
|
||||
if (pfd->mSpan && pfd->mSpan->mContainsFloat) {
|
||||
// If the span either directly or indirectly contains a float then
|
||||
// it fits. Why? It's kind of complicated, but here goes:
|
||||
//
|
||||
// 1. CanPlaceFrame is used for all frame placements on a line,
|
||||
|
@ -1500,19 +1501,19 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
// checks for room before proceeding (the code above here), the
|
||||
// only things on a line will be those things that "fit".
|
||||
//
|
||||
// 2. Before a floater is placed on a line, the line has to be empty
|
||||
// 2. Before a float is placed on a line, the line has to be empty
|
||||
// (otherwise its a "below current line" flaoter and will be placed
|
||||
// after the line).
|
||||
//
|
||||
// Therefore, if the span directly or indirectly has a floater
|
||||
// then it means that at the time of the placement of the floater
|
||||
// Therefore, if the span directly or indirectly has a float
|
||||
// then it means that at the time of the placement of the float
|
||||
// the line was empty. Because of #1, only the frames that fit can
|
||||
// be added after that point, therefore we can assume that the
|
||||
// current span being placed has fit.
|
||||
//
|
||||
// So how do we get here and have a span that should already fit
|
||||
// and yet doesn't: Simple: span's that have the no-wrap attribute
|
||||
// set on them and contain a floater and are placed where they
|
||||
// set on them and contain a float and are placed where they
|
||||
// don't naturally fit.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1565,8 +1566,8 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics)
|
|||
mTotalPlacedFrames++;
|
||||
if (psd->mX != psd->mLeftEdge || pfd->mBounds.x != psd->mLeftEdge) {
|
||||
// As soon as a frame placed on the line advances an X coordinate
|
||||
// of any span we can no longer place a floater on the line.
|
||||
SetFlag(LL_CANPLACEFLOATER, PR_FALSE);
|
||||
// of any span we can no longer place a float on the line.
|
||||
SetFlag(LL_CANPLACEFLOAT, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,14 +72,14 @@ public:
|
|||
|
||||
void BeginLineReflow(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aImpactedByFloaters,
|
||||
PRBool aImpactedByFloats,
|
||||
PRBool aIsTopOfPage);
|
||||
|
||||
void EndLineReflow();
|
||||
|
||||
void UpdateBand(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPlacedLeftFloater,
|
||||
nsIFrame* aFloaterFrame);
|
||||
PRBool aPlacedLeftFloat,
|
||||
nsIFrame* aFloatFrame);
|
||||
|
||||
nsresult BeginSpan(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState* aSpanReflowState,
|
||||
|
@ -134,9 +134,9 @@ protected:
|
|||
#define LL_FIRSTLETTERSTYLEOK 0x00000008
|
||||
#define LL_ISTOPOFPAGE 0x00000010
|
||||
#define LL_UPDATEDBAND 0x00000020
|
||||
#define LL_IMPACTEDBYFLOATERS 0x00000040
|
||||
#define LL_LASTFLOATERWASLETTERFRAME 0x00000080
|
||||
#define LL_CANPLACEFLOATER 0x00000100
|
||||
#define LL_IMPACTEDBYFLOATS 0x00000040
|
||||
#define LL_LASTFLOATWASLETTERFRAME 0x00000080
|
||||
#define LL_CANPLACEFLOAT 0x00000100
|
||||
#define LL_LINEENDSINBR 0x00000200
|
||||
#define LL_LASTFLAG LL_LINEENDSINBR
|
||||
|
||||
|
@ -200,7 +200,7 @@ public:
|
|||
|
||||
nsIFrame* FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame);
|
||||
|
||||
PRBool CanPlaceFloaterNow() const;
|
||||
PRBool CanPlaceFloatNow() const;
|
||||
|
||||
PRBool LineIsEmpty() const;
|
||||
|
||||
|
@ -229,12 +229,12 @@ public:
|
|||
//----------------------------------------
|
||||
// Inform the line-layout about the presence of a floating frame
|
||||
// XXX get rid of this: use get-frame-type?
|
||||
void InitFloater(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->InitFloater(*this, aFrame, aReflowStatus);
|
||||
void InitFloat(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->InitFloat(*this, aFrame, aReflowStatus);
|
||||
}
|
||||
|
||||
void AddFloater(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->AddFloater(*this, aFrame, PR_FALSE, aReflowStatus);
|
||||
void AddFloat(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->AddFloat(*this, aFrame, PR_FALSE, aReflowStatus);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
@ -280,7 +280,7 @@ protected:
|
|||
PRPackedBool mComputeMaxElementWidth;
|
||||
PRUint8 mTextAlign;
|
||||
|
||||
PRUint8 mPlacedFloaters;
|
||||
PRUint8 mPlacedFloats;
|
||||
|
||||
// The amount of text indent that we applied to this line, needed for
|
||||
// max-element-size calculation.
|
||||
|
@ -406,7 +406,7 @@ protected:
|
|||
PRUint8 mDirection;
|
||||
PRPackedBool mChangedFrameDirection;
|
||||
PRPackedBool mZeroEffectiveSpanBox;
|
||||
PRPackedBool mContainsFloater;
|
||||
PRPackedBool mContainsFloat;
|
||||
|
||||
nscoord mLeftEdge;
|
||||
nscoord mX;
|
||||
|
|
|
@ -969,7 +969,7 @@ nsSpaceManager::PushState()
|
|||
// of mBandList and mFrameInfoMap and restore them when pop is
|
||||
// called, but I'm not sure it's worth the effort/bloat at this
|
||||
// point, since this push/pop mechanism is only used to undo any
|
||||
// floaters that were added during the unconstrained reflow
|
||||
// floats that were added during the unconstrained reflow
|
||||
// in nsBlockReflowContext::DoReflowBlock(). (See bug 96736)
|
||||
//
|
||||
// It should also be noted that the state for mFloatDamage is
|
||||
|
|
|
@ -3878,7 +3878,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset,
|
|||
}
|
||||
}
|
||||
|
||||
if (inContentOffset < mContentOffset) //could happen with floaters!
|
||||
if (inContentOffset < mContentOffset) //could happen with floats!
|
||||
{
|
||||
result = GetPrevInFlow(outChildFrame);
|
||||
if (NS_SUCCEEDED(result) && *outChildFrame)
|
||||
|
|
|
@ -141,9 +141,9 @@ BRFrame::Reflow(nsIPresContext* aPresContext,
|
|||
if (ll) {
|
||||
// Note that the compatibility mode check excludes AlmostStandards
|
||||
// mode, since this is the inline box model. See bug 161691.
|
||||
if ( ll->CanPlaceFloaterNow() ||
|
||||
if ( ll->CanPlaceFloatNow() ||
|
||||
ll->GetCompatMode() == eCompatibility_FullStandards ) {
|
||||
// If we can place a floater on the line now it means that the
|
||||
// If we can place a float on the line now it means that the
|
||||
// line is effectively empty (there may be zero sized compressed
|
||||
// white-space frames on the line, but they are to be ignored).
|
||||
//
|
||||
|
|
|
@ -71,8 +71,8 @@ nsBlockBandData::Init(nsSpaceManager* aSpaceManager,
|
|||
aSpaceManager->GetTranslation(mSpaceManagerX, mSpaceManagerY);
|
||||
|
||||
mSpace = aSpace;
|
||||
mLeftFloaters = 0;
|
||||
mRightFloaters = 0;
|
||||
mLeftFloats = 0;
|
||||
mRightFloats = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ nsBlockBandData::GetAvailableSpace(nscoord aY, nsRect& aResult)
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
|
||||
// Compute the bounding rect of the available space, i.e. space
|
||||
// between any left and right floaters.
|
||||
// between any left and right floats.
|
||||
ComputeAvailSpaceRect();
|
||||
aResult = mAvailSpace;
|
||||
#ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT
|
||||
|
@ -142,7 +142,7 @@ nsBlockBandData::GetBandData(nscoord aY)
|
|||
|
||||
/**
|
||||
* Computes the bounding rect of the available space, i.e. space
|
||||
* between any left and right floaters. Uses the current trapezoid
|
||||
* between any left and right floats. Uses the current trapezoid
|
||||
* data, see nsISpaceManager::GetBandData(). Also updates member
|
||||
* data "availSpace".
|
||||
*/
|
||||
|
@ -157,22 +157,22 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
mAvailSpace.y = 0;
|
||||
mAvailSpace.width = 0;
|
||||
mAvailSpace.height = 0;
|
||||
mLeftFloaters = 0;
|
||||
mRightFloaters = 0;
|
||||
mLeftFloats = 0;
|
||||
mRightFloats = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
nsBandTrapezoid* trapezoid = mTrapezoids;
|
||||
nsBandTrapezoid* rightTrapezoid = nsnull;
|
||||
|
||||
PRInt32 leftFloaters = 0;
|
||||
PRInt32 rightFloaters = 0;
|
||||
PRInt32 leftFloats = 0;
|
||||
PRInt32 rightFloats = 0;
|
||||
if (mCount > 1) {
|
||||
// If there's more than one trapezoid that means there are floaters
|
||||
// If there's more than one trapezoid that means there are floats
|
||||
PRInt32 i;
|
||||
|
||||
// Examine each trapezoid in the band, counting up the number of
|
||||
// left and right floaters. Use the right-most floater to
|
||||
// left and right floats. Use the right-most float to
|
||||
// determine where the right edge of the available space is.
|
||||
NS_PRECONDITION(mCount<=mSize, "bad state, count > size");
|
||||
for (i = 0; i < mCount; i++) {
|
||||
|
@ -188,10 +188,10 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
nsIFrame* f = (nsIFrame*) trapezoid->mFrames->ElementAt(j);
|
||||
const nsStyleDisplay* display = f->GetStyleDisplay();
|
||||
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
|
||||
leftFloaters++;
|
||||
leftFloats++;
|
||||
}
|
||||
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
|
||||
rightFloaters++;
|
||||
rightFloats++;
|
||||
if ((nsnull == rightTrapezoid) && (i > 0)) {
|
||||
rightTrapezoid = &mTrapezoids[i - 1];
|
||||
}
|
||||
|
@ -200,10 +200,10 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
} else {
|
||||
const nsStyleDisplay* display = trapezoid->mFrame->GetStyleDisplay();
|
||||
if (NS_STYLE_FLOAT_LEFT == display->mFloats) {
|
||||
leftFloaters++;
|
||||
leftFloats++;
|
||||
}
|
||||
else if (NS_STYLE_FLOAT_RIGHT == display->mFloats) {
|
||||
rightFloaters++;
|
||||
rightFloats++;
|
||||
if ((nsnull == rightTrapezoid) && (i > 0)) {
|
||||
rightTrapezoid = &mTrapezoids[i - 1];
|
||||
}
|
||||
|
@ -213,14 +213,14 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
}
|
||||
}
|
||||
else if (mTrapezoids[0].mState != nsBandTrapezoid::Available) {
|
||||
// We have a floater using up all the available space
|
||||
leftFloaters = 1;
|
||||
// We have a float using up all the available space
|
||||
leftFloats = 1;
|
||||
}
|
||||
#ifdef REALLY_NOISY_COMPUTEAVAILSPACERECT
|
||||
printf("band %p has floaters %d, %d\n", this, leftFloaters, rightFloaters);
|
||||
printf("band %p has floats %d, %d\n", this, leftFloats, rightFloats);
|
||||
#endif
|
||||
mLeftFloaters = leftFloaters;
|
||||
mRightFloaters = rightFloaters;
|
||||
mLeftFloats = leftFloats;
|
||||
mRightFloats = rightFloats;
|
||||
|
||||
if (nsnull != rightTrapezoid) {
|
||||
trapezoid = rightTrapezoid;
|
||||
|
@ -233,8 +233,8 @@ nsBlockBandData::ComputeAvailSpaceRect()
|
|||
if (nsBandTrapezoid::OccupiedMultiple == trapezoid->mState) {
|
||||
// It's not clear what coordinate to use when there is no
|
||||
// available space and the space is multiply occupied...So: If
|
||||
// any of the floaters that are a part of the trapezoid are left
|
||||
// floaters then we move over to the right edge of the
|
||||
// any of the floats that are a part of the trapezoid are left
|
||||
// floats then we move over to the right edge of the
|
||||
// unavaliable space.
|
||||
PRInt32 j, numFrames = trapezoid->mFrames->Count();
|
||||
NS_ASSERTION(numFrames > 0, "bad trapezoid frame list");
|
||||
|
@ -291,9 +291,9 @@ nsBlockBandData::ShouldClearFrame(nsIFrame* aFrame, PRUint8 aBreakType)
|
|||
return result;
|
||||
}
|
||||
|
||||
// XXX optimization? use mFloaters to avoid doing anything
|
||||
// XXX optimization? use mFloats to avoid doing anything
|
||||
nscoord
|
||||
nsBlockBandData::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
||||
nsBlockBandData::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
||||
{
|
||||
for (;;) {
|
||||
nsresult rv = GetBandData(aY);
|
||||
|
@ -305,7 +305,7 @@ nsBlockBandData::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
|||
// Compute aYS as aY in space-manager "root" coordinates.
|
||||
nscoord aYS = aY + mSpaceManagerY;
|
||||
|
||||
// Find the largest frame YMost for the appropriate floaters in
|
||||
// Find the largest frame YMost for the appropriate floats in
|
||||
// this band.
|
||||
nscoord yMost = aYS;
|
||||
PRInt32 i;
|
||||
|
@ -332,7 +332,7 @@ nsBlockBandData::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
|||
}
|
||||
|
||||
// If yMost is unchanged (aYS) then there were no appropriate
|
||||
// floaters in the band. Time to stop clearing.
|
||||
// floats in the band. Time to stop clearing.
|
||||
if (yMost == aYS) {
|
||||
break;
|
||||
}
|
||||
|
@ -347,8 +347,8 @@ void nsBlockBandData::List()
|
|||
printf("nsBlockBandData %p sm=%p, sm coord = (%d,%d), mSpace = (%d,%d)\n",
|
||||
this, mSpaceManager, mSpaceManagerX, mSpaceManagerY,
|
||||
mSpace.width, mSpace.height);
|
||||
printf(" availSpace=(%d, %d, %d, %d), floaters l=%d r=%d\n",
|
||||
printf(" availSpace=(%d, %d, %d, %d), floats l=%d r=%d\n",
|
||||
mAvailSpace.x, mAvailSpace.y, mAvailSpace.width, mAvailSpace.height,
|
||||
mLeftFloaters, mRightFloaters);
|
||||
mLeftFloats, mRightFloats);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
// space manager translation.
|
||||
nsresult GetAvailableSpace(nscoord aY, nsRect& aResult);
|
||||
|
||||
// Clear any current floaters, returning a new Y coordinate
|
||||
nscoord ClearFloaters(nscoord aY, PRUint8 aBreakType);
|
||||
// Clear any current floats, returning a new Y coordinate
|
||||
nscoord ClearFloats(nscoord aY, PRUint8 aBreakType);
|
||||
|
||||
// Get the raw trapezoid count for this band.
|
||||
PRInt32 GetTrapezoidCount() const {
|
||||
|
@ -72,18 +72,18 @@ public:
|
|||
return &mTrapezoids[aIndex];
|
||||
}
|
||||
|
||||
// Get the number of floaters that are impacting the current
|
||||
// Get the number of floats that are impacting the current
|
||||
// band. Note that this value is relative to the current translation
|
||||
// in the space manager which means that some floaters may be hidden
|
||||
// in the space manager which means that some floats may be hidden
|
||||
// by the translation and therefore won't be in the count.
|
||||
PRInt32 GetFloaterCount() const {
|
||||
return mLeftFloaters + mRightFloaters;
|
||||
PRInt32 GetFloatCount() const {
|
||||
return mLeftFloats + mRightFloats;
|
||||
}
|
||||
PRInt32 GetLeftFloaterCount() const {
|
||||
return mLeftFloaters;
|
||||
PRInt32 GetLeftFloatCount() const {
|
||||
return mLeftFloats;
|
||||
}
|
||||
PRInt32 GetRightFloaterCount() const {
|
||||
return mRightFloaters;
|
||||
PRInt32 GetRightFloatCount() const {
|
||||
return mRightFloats;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -110,14 +110,14 @@ protected:
|
|||
// Trapezoids used during band processing
|
||||
nsBandTrapezoid mData[NS_BLOCK_BAND_DATA_TRAPS];
|
||||
|
||||
// Bounding rect of available space between any left and right floaters
|
||||
// Bounding rect of available space between any left and right floats
|
||||
nsRect mAvailSpace;
|
||||
|
||||
// Number of left/right floaters in the current band. Note that this
|
||||
// number may be less than the total number of floaters present in
|
||||
// Number of left/right floats in the current band. Note that this
|
||||
// number may be less than the total number of floats present in
|
||||
// the band, if our translation in the space manager "hides" some
|
||||
// floaters.
|
||||
PRInt32 mLeftFloaters, mRightFloaters;
|
||||
// floats.
|
||||
PRInt32 mLeftFloats, mRightFloats;
|
||||
|
||||
void ComputeAvailSpaceRect();
|
||||
PRBool ShouldClearFrame(nsIFrame* aFrame, PRUint8 aBreakType);
|
||||
|
|
|
@ -44,15 +44,15 @@
|
|||
#undef NOISY_MAX_ELEMENT_SIZE // enables debug output for max element size computation
|
||||
#undef NOISY_MAXIMUM_WIDTH // enables debug output for max width computation
|
||||
#undef NOISY_KIDXMOST // enables debug output for aState.mKidXMost computation
|
||||
#undef NOISY_FLOATER // enables debug output for floater reflow (the in/out metrics for the floated block)
|
||||
#undef NOISY_FLOATER_CLEARING
|
||||
#undef NOISY_FLOAT // enables debug output for float reflow (the in/out metrics for the floated block)
|
||||
#undef NOISY_FLOAT_CLEARING
|
||||
#undef NOISY_FINAL_SIZE // enables debug output for desired width/height computation, once all children have been reflowed
|
||||
#undef NOISY_REMOVE_FRAME
|
||||
#undef NOISY_COMBINED_AREA // enables debug output for combined area computation
|
||||
#undef NOISY_VERTICAL_MARGINS
|
||||
#undef NOISY_REFLOW_REASON // gives a little info about why each reflow was requested
|
||||
#undef REFLOW_STATUS_COVERAGE // I think this is most useful for printing, to see which frames return "incomplete"
|
||||
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floaters and positioned elements
|
||||
#undef NOISY_SPACEMANAGER // enables debug output for space manager use, useful for analysing reflow of floats and positioned elements
|
||||
#undef NOISY_BLOCK_INVALIDATE // enables debug output for all calls to invalidate
|
||||
#undef REALLY_NOISY_REFLOW // some extra debug info
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -55,7 +55,7 @@ class nsIntervalSet;
|
|||
* Child list name indices
|
||||
* @see #GetAdditionalChildListName()
|
||||
*/
|
||||
#define NS_BLOCK_FRAME_FLOATER_LIST_INDEX 0
|
||||
#define NS_BLOCK_FRAME_FLOAT_LIST_INDEX 0
|
||||
#define NS_BLOCK_FRAME_BULLET_LIST_INDEX 1
|
||||
#define NS_BLOCK_FRAME_OVERFLOW_LIST_INDEX 2
|
||||
#define NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX 3
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
inline nscoord GetAscent() { return mAscent; }
|
||||
|
||||
// Create a contination for aPlaceholder and its out of flow frame and
|
||||
// add it to the list of overflow floaters
|
||||
// add it to the list of overflow floats
|
||||
nsresult SplitPlaceholder(nsIPresContext& aPresContext, nsIFrame& aPlaceholder);
|
||||
|
||||
void UndoSplitPlaceholders(nsBlockReflowState& aState,
|
||||
|
@ -251,7 +251,7 @@ protected:
|
|||
}
|
||||
|
||||
/** move the frames contained by aLine by aDY
|
||||
* if aLine is a block, it's child floaters are added to the state manager
|
||||
* if aLine is a block, it's child floats are added to the state manager
|
||||
*/
|
||||
void SlideLine(nsBlockReflowState& aState,
|
||||
nsLineBox* aLine, nscoord aDY);
|
||||
|
@ -293,7 +293,7 @@ protected:
|
|||
nsresult DoRemoveFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aDeletedFrame);
|
||||
|
||||
// Remove a floater, abs, rel positioned frame from the appropriate block's list
|
||||
// Remove a float, abs, rel positioned frame from the appropriate block's list
|
||||
static void DoRemoveOutOfFlowFrame(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
|
@ -424,12 +424,12 @@ protected:
|
|||
nsIFrame* aFrame,
|
||||
PRUint8* aLineReflowStatus);
|
||||
|
||||
// An incomplete aReflowStatus indicates the floater should be split
|
||||
// An incomplete aReflowStatus indicates the float should be split
|
||||
// but only if the available height is constrained.
|
||||
nsresult ReflowFloater(nsBlockReflowState& aState,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsFloaterCache* aFloaterCache,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
nsresult ReflowFloat(nsBlockReflowState& aState,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsFloatCache* aFloatCache,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
//----------------------------------------
|
||||
// Methods for pushing/pulling lines/frames
|
||||
|
@ -475,15 +475,15 @@ protected:
|
|||
nsFramePaintLayer aWhichLayer,
|
||||
PRUint32 aFlags = 0);
|
||||
|
||||
void PaintFloaters(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
void PaintFloats(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect);
|
||||
|
||||
void PropagateFloaterDamage(nsBlockReflowState& aState,
|
||||
nsLineBox* aLine,
|
||||
nscoord aDeltaY);
|
||||
void PropagateFloatDamage(nsBlockReflowState& aState,
|
||||
nsLineBox* aLine,
|
||||
nscoord aDeltaY);
|
||||
|
||||
void BuildFloaterList();
|
||||
void BuildFloatList();
|
||||
|
||||
//----------------------------------------
|
||||
// List handling kludge
|
||||
|
@ -532,8 +532,8 @@ protected:
|
|||
|
||||
nsLineList mLines;
|
||||
|
||||
// List of all floaters in this block
|
||||
nsFrameList mFloaters;
|
||||
// List of all floats in this block
|
||||
nsFrameList mFloats;
|
||||
|
||||
// XXX_fix_me: subclass one more time!
|
||||
// For list-item frames, this is the bullet frame.
|
||||
|
|
|
@ -362,9 +362,9 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
}
|
||||
|
||||
/* We build a different reflow context based on the width attribute of the block,
|
||||
* if it's a floater.
|
||||
* Auto-width floaters need to have their containing-block size set explicitly,
|
||||
* factoring in other floaters that impact it.
|
||||
* if it's a float.
|
||||
* Auto-width floats need to have their containing-block size set explicitly,
|
||||
* factoring in other floats that impact it.
|
||||
* It's possible this should be quirks-only.
|
||||
* All other blocks proceed normally.
|
||||
*/
|
||||
|
@ -439,7 +439,7 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
aFrameRS.mComputedBorderPadding.right;
|
||||
}
|
||||
|
||||
// if this is an unconstrained width reflow, then just place the floater at the left margin
|
||||
// if this is an unconstrained width reflow, then just place the float at the left margin
|
||||
if (NS_UNCONSTRAINEDSIZE == mSpace.width)
|
||||
x = mSpace.x;
|
||||
else
|
||||
|
@ -682,7 +682,7 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
|
|||
// always fit. Note: don't force the width to 0
|
||||
aInFlowBounds = nsRect(x, y, mMetrics.width, 0);
|
||||
|
||||
// Retain combined area information in case we contain a floater
|
||||
// Retain combined area information in case we contain a float
|
||||
// and nothing else.
|
||||
aCombinedRect = mMetrics.mOverflowArea;
|
||||
aCombinedRect.x += x;
|
||||
|
|
|
@ -67,7 +67,7 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
|
|||
mPrevBottomMargin(),
|
||||
mLineNumber(0),
|
||||
mFlags(0),
|
||||
mFloaterBreakType(NS_STYLE_CLEAR_NONE)
|
||||
mFloatBreakType(NS_STYLE_CLEAR_NONE)
|
||||
{
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
|
||||
|
@ -220,7 +220,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
nsRect& aResult)
|
||||
{
|
||||
#ifdef REALLY_NOISY_REFLOW
|
||||
printf("CBAS frame=%p has floater count %d\n", aFrame, mBand.GetFloaterCount());
|
||||
printf("CBAS frame=%p has float count %d\n", aFrame, mBand.GetFloatCount());
|
||||
mBand.List();
|
||||
#endif
|
||||
aResult.y = mY;
|
||||
|
@ -246,14 +246,14 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
NS_FRAME_NOT_SPLITTABLE == aSplitType || // things like images mapped to display: block
|
||||
PR_TRUE == treatAsNotSplittable) // text input controls mapped to display: block (special case)
|
||||
{
|
||||
if (mBand.GetFloaterCount()) {
|
||||
if (mBand.GetFloatCount()) {
|
||||
// Use the float-edge property to determine how the child block
|
||||
// will interact with the floater.
|
||||
// will interact with the float.
|
||||
const nsStyleBorder* borderStyle = aFrame->GetStyleBorder();
|
||||
switch (borderStyle->mFloatEdge) {
|
||||
default:
|
||||
case NS_STYLE_FLOAT_EDGE_CONTENT: // content and only content does runaround of floaters
|
||||
// The child block will flow around the floater. Therefore
|
||||
case NS_STYLE_FLOAT_EDGE_CONTENT: // content and only content does runaround of floats
|
||||
// The child block will flow around the float. Therefore
|
||||
// give it all of the available space.
|
||||
aResult.x = borderPadding.left;
|
||||
aResult.width = GetFlag(BRS_UNCONSTRAINEDWIDTH)
|
||||
|
@ -264,7 +264,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
case NS_STYLE_FLOAT_EDGE_PADDING:
|
||||
{
|
||||
// The child block's border should be placed adjacent to,
|
||||
// but not overlap the floater(s).
|
||||
// but not overlap the float(s).
|
||||
nsMargin m(0, 0, 0, 0);
|
||||
const nsStyleMargin* styleMargin = aFrame->GetStyleMargin();
|
||||
styleMargin->GetMargin(m); // XXX percentage margins
|
||||
|
@ -276,7 +276,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
}
|
||||
|
||||
// determine left edge
|
||||
if (mBand.GetLeftFloaterCount()) {
|
||||
if (mBand.GetLeftFloatCount()) {
|
||||
aResult.x = mAvailSpaceRect.x + borderPadding.left - m.left;
|
||||
}
|
||||
else {
|
||||
|
@ -288,8 +288,8 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
aResult.width = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
if (mBand.GetRightFloaterCount()) {
|
||||
if (mBand.GetLeftFloaterCount()) {
|
||||
if (mBand.GetRightFloatCount()) {
|
||||
if (mBand.GetLeftFloatCount()) {
|
||||
aResult.width = mAvailSpaceRect.width + m.left + m.right;
|
||||
}
|
||||
else {
|
||||
|
@ -306,7 +306,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
case NS_STYLE_FLOAT_EDGE_MARGIN:
|
||||
{
|
||||
// The child block's margins should be placed adjacent to,
|
||||
// but not overlap the floater.
|
||||
// but not overlap the float.
|
||||
aResult.x = mAvailSpaceRect.x + borderPadding.left;
|
||||
aResult.width = mAvailSpaceRect.width;
|
||||
}
|
||||
|
@ -314,9 +314,9 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
}
|
||||
}
|
||||
else {
|
||||
// Since there are no floaters present the float-edge property
|
||||
// Since there are no floats present the float-edge property
|
||||
// doesn't matter therefore give the block element all of the
|
||||
// available space since it will flow around the floater itself.
|
||||
// available space since it will flow around the float itself.
|
||||
aResult.x = borderPadding.left;
|
||||
aResult.width = GetFlag(BRS_UNCONSTRAINEDWIDTH)
|
||||
? NS_UNCONSTRAINEDSIZE
|
||||
|
@ -326,7 +326,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
|
|||
else {
|
||||
// The frame is clueless about the space manager and therefore we
|
||||
// only give it free space. An example is a table frame - the
|
||||
// tables do not flow around floaters.
|
||||
// tables do not flow around floats.
|
||||
aResult.x = mAvailSpaceRect.x + borderPadding.left;
|
||||
aResult.width = mAvailSpaceRect.width;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ nsBlockReflowState::GetAvailableSpace(nscoord aY)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
|
||||
nsBlockReflowState::ClearPastFloats(PRUint8 aBreakType)
|
||||
{
|
||||
nscoord saveY, deltaY;
|
||||
|
||||
|
@ -372,10 +372,10 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
|
|||
case NS_STYLE_CLEAR_LEFT_AND_RIGHT:
|
||||
// Apply the previous margin before clearing
|
||||
saveY = mY + mPrevBottomMargin.get();
|
||||
ClearFloaters(saveY, aBreakType);
|
||||
#ifdef NOISY_FLOATER_CLEARING
|
||||
ClearFloats(saveY, aBreakType);
|
||||
#ifdef NOISY_FLOAT_CLEARING
|
||||
nsFrame::ListTag(stdout, mBlock);
|
||||
printf(": ClearPastFloaters: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n",
|
||||
printf(": ClearPastFloats: mPrevBottomMargin=%d saveY=%d oldY=%d newY=%d deltaY=%d\n",
|
||||
mPrevBottomMargin, saveY, saveY - mPrevBottomMargin, mY,
|
||||
mY - saveY);
|
||||
#endif
|
||||
|
@ -389,7 +389,7 @@ nsBlockReflowState::ClearPastFloaters(PRUint8 aBreakType)
|
|||
// Pretend that the distance we just moved is a previous
|
||||
// blocks bottom margin. Note that GetAvailableSpace has been
|
||||
// done so that the available space calculations will be done
|
||||
// after clearing the appropriate floaters.
|
||||
// after clearing the appropriate floats.
|
||||
//
|
||||
// What we are doing here is applying CSS2 section 9.5.2's
|
||||
// rules for clearing - "The top margin of the generated box
|
||||
|
@ -473,43 +473,43 @@ nsBlockReflowState::ReconstructMarginAbove(nsLineList::iterator aLine)
|
|||
}
|
||||
|
||||
/**
|
||||
* Restore information about floaters into the space manager for an
|
||||
* incremental reflow, and simultaneously push the floaters by
|
||||
* Restore information about floats into the space manager for an
|
||||
* incremental reflow, and simultaneously push the floats by
|
||||
* |aDeltaY|, which is the amount |aLine| was pushed relative to its
|
||||
* parent. The recovery of state is one of the things that makes
|
||||
* incremental reflow O(N^2) and this state should really be kept
|
||||
* around, attached to the frame tree.
|
||||
*/
|
||||
void
|
||||
nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
||||
nscoord aDeltaY)
|
||||
nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
|
||||
nscoord aDeltaY)
|
||||
{
|
||||
if (aLine->HasFloaters()) {
|
||||
// Place the floaters into the space-manager again. Also slide
|
||||
if (aLine->HasFloats()) {
|
||||
// Place the floats into the space-manager again. Also slide
|
||||
// them, just like the regular frames on the line.
|
||||
nsFloaterCache* fc = aLine->GetFirstFloater();
|
||||
nsFloatCache* fc = aLine->GetFirstFloat();
|
||||
while (fc) {
|
||||
nsIFrame* floater = fc->mPlaceholder->GetOutOfFlowFrame();
|
||||
nsIFrame* floatFrame = fc->mPlaceholder->GetOutOfFlowFrame();
|
||||
if (aDeltaY != 0) {
|
||||
fc->mRegion.y += aDeltaY;
|
||||
fc->mCombinedArea.y += aDeltaY;
|
||||
nsPoint p = floater->GetPosition();
|
||||
floater->SetPosition(nsPoint(p.x, p.y + aDeltaY));
|
||||
nsPoint p = floatFrame->GetPosition();
|
||||
floatFrame->SetPosition(nsPoint(p.x, p.y + aDeltaY));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
|
||||
nscoord tx, ty;
|
||||
mSpaceManager->GetTranslation(tx, ty);
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("RecoverFloaters: txy=%d,%d (%d,%d) ",
|
||||
printf("RecoverFloats: txy=%d,%d (%d,%d) ",
|
||||
tx, ty, mSpaceManagerX, mSpaceManagerY);
|
||||
nsFrame::ListTag(stdout, floater);
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" aDeltaY=%d region={%d,%d,%d,%d}\n",
|
||||
aDeltaY, fc->mRegion.x, fc->mRegion.y,
|
||||
fc->mRegion.width, fc->mRegion.height);
|
||||
}
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floater, fc->mRegion);
|
||||
mSpaceManager->AddRectRegion(floatFrame, fc->mRegion);
|
||||
fc = fc->Next();
|
||||
}
|
||||
} else if (aLine->IsBlock()) {
|
||||
|
@ -522,10 +522,10 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
|||
line_end = kid->end_lines();
|
||||
line != line_end;
|
||||
++line)
|
||||
// Pass 0, not the real DeltaY, since these floaters aren't
|
||||
// Pass 0, not the real DeltaY, since these floats aren't
|
||||
// moving relative to their parent block, only relative to
|
||||
// the space manager.
|
||||
RecoverFloaters(line, 0);
|
||||
RecoverFloats(line, 0);
|
||||
mSpaceManager->Translate(-kidx, -kidy);
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ nsBlockReflowState::RecoverFloaters(nsLineList::iterator aLine,
|
|||
* nsBlockReflowState is in the same state that it would have been in
|
||||
* had the line just been reflowed.
|
||||
*
|
||||
* Most of the state recovery that we have to do involves floaters.
|
||||
* Most of the state recovery that we have to do involves floats.
|
||||
*/
|
||||
void
|
||||
nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
||||
|
@ -573,11 +573,11 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
#endif
|
||||
UpdateMaxElementWidth(aLine->mMaxElementWidth);
|
||||
|
||||
// Recover the floater MEWs for floaters in this line (but not in
|
||||
// Recover the float MEWs for floats in this line (but not in
|
||||
// blocks within it, since their MEWs are already part of the block's
|
||||
// MEW).
|
||||
if (aLine->HasFloaters()) {
|
||||
for (nsFloaterCache* fc = aLine->GetFirstFloater(); fc; fc = fc->Next())
|
||||
if (aLine->HasFloats()) {
|
||||
for (nsFloatCache* fc = aLine->GetFirstFloat(); fc; fc = fc->Next())
|
||||
UpdateMaxElementWidth(fc->mMaxElementWidth);
|
||||
}
|
||||
}
|
||||
|
@ -590,15 +590,15 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
UpdateMaximumWidth(aLine->mMaximumWidth);
|
||||
}
|
||||
|
||||
// Place floaters for this line into the space manager
|
||||
if (aLine->HasFloaters() || aLine->IsBlock()) {
|
||||
// Undo border/padding translation since the nsFloaterCache's
|
||||
// Place floats for this line into the space manager
|
||||
if (aLine->HasFloats() || aLine->IsBlock()) {
|
||||
// Undo border/padding translation since the nsFloatCache's
|
||||
// coordinates are relative to the frame not relative to the
|
||||
// border/padding.
|
||||
const nsMargin& bp = BorderPadding();
|
||||
mSpaceManager->Translate(-bp.left, -bp.top);
|
||||
|
||||
RecoverFloaters(aLine, aDeltaY);
|
||||
RecoverFloats(aLine, aDeltaY);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
|
||||
|
@ -611,34 +611,34 @@ nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBlockReflowState::IsImpactedByFloater() const
|
||||
nsBlockReflowState::IsImpactedByFloat() const
|
||||
{
|
||||
#ifdef REALLY_NOISY_REFLOW
|
||||
printf("nsBlockReflowState::IsImpactedByFloater %p returned %d\n",
|
||||
this, mBand.GetFloaterCount());
|
||||
printf("nsBlockReflowState::IsImpactedByFloat %p returned %d\n",
|
||||
this, mBand.GetFloatCount());
|
||||
#endif
|
||||
return mBand.GetFloaterCount() > 0;
|
||||
return mBand.GetFloatCount() > 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsBlockReflowState::InitFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
nsBlockReflowState::InitFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
// Set the geometric parent of the floater
|
||||
nsIFrame* floater = aPlaceholder->GetOutOfFlowFrame();
|
||||
floater->SetParent(mBlock);
|
||||
// Set the geometric parent of the float
|
||||
nsIFrame* floatFrame = aPlaceholder->GetOutOfFlowFrame();
|
||||
floatFrame->SetParent(mBlock);
|
||||
|
||||
// Then add the floater to the current line and place it when
|
||||
// Then add the float to the current line and place it when
|
||||
// appropriate
|
||||
AddFloater(aLineLayout, aPlaceholder, PR_TRUE, aReflowStatus);
|
||||
AddFloat(aLineLayout, aPlaceholder, PR_TRUE, aReflowStatus);
|
||||
}
|
||||
|
||||
// This is called by the line layout's AddFloater method when a
|
||||
// place-holder frame is reflowed in a line. If the floater is a
|
||||
// This is called by the line layout's AddFloat method when a
|
||||
// place-holder frame is reflowed in a line. If the float is a
|
||||
// left-most child (it's x coordinate is at the line's left margin)
|
||||
// then the floater is place immediately, otherwise the floater
|
||||
// then the float is place immediately, otherwise the float
|
||||
// placement is deferred until the line has been reflowed.
|
||||
|
||||
// XXXldb This behavior doesn't quite fit with CSS1 and CSS2 --
|
||||
|
@ -646,31 +646,31 @@ nsBlockReflowState::InitFloater(nsLineLayout& aLineLayout,
|
|||
// float as well unless it won't fit next to what we already have.
|
||||
// But nobody else implements it that way...
|
||||
void
|
||||
nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
nsBlockReflowState::AddFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholder,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
NS_PRECONDITION(mBlock->end_lines() != mCurrentLine, "null ptr");
|
||||
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
// Allocate a nsFloaterCache for the floater
|
||||
nsFloaterCache* fc = mFloaterCacheFreeList.Alloc();
|
||||
// Allocate a nsFloatCache for the float
|
||||
nsFloatCache* fc = mFloatCacheFreeList.Alloc();
|
||||
fc->mPlaceholder = aPlaceholder;
|
||||
fc->mIsCurrentLineFloater = aLineLayout.CanPlaceFloaterNow();
|
||||
fc->mIsCurrentLineFloat = aLineLayout.CanPlaceFloatNow();
|
||||
fc->mMaxElementWidth = 0;
|
||||
|
||||
// Now place the floater immediately if possible. Otherwise stash it
|
||||
// away in mPendingFloaters and place it later.
|
||||
if (fc->mIsCurrentLineFloater) {
|
||||
// Record this floater in the current-line list
|
||||
mCurrentLineFloaters.Append(fc);
|
||||
// Now place the float immediately if possible. Otherwise stash it
|
||||
// away in mPendingFloats and place it later.
|
||||
if (fc->mIsCurrentLineFloat) {
|
||||
// Record this float in the current-line list
|
||||
mCurrentLineFloats.Append(fc);
|
||||
|
||||
// Because we are in the middle of reflowing a placeholder frame
|
||||
// within a line (and possibly nested in an inline frame or two
|
||||
// that's a child of our block) we need to restore the space
|
||||
// manager's translation to the space that the block resides in
|
||||
// before placing the floater.
|
||||
// before placing the float.
|
||||
nscoord ox, oy;
|
||||
mSpaceManager->GetTranslation(ox, oy);
|
||||
nscoord dx = ox - mSpaceManagerX;
|
||||
|
@ -678,24 +678,24 @@ nsBlockReflowState::AddFloater(nsLineLayout& aLineLayout,
|
|||
mSpaceManager->Translate(-dx, -dy);
|
||||
|
||||
// And then place it
|
||||
PRBool isLeftFloater;
|
||||
FlowAndPlaceFloater(fc, &isLeftFloater, aReflowStatus);
|
||||
PRBool isLeftFloat;
|
||||
FlowAndPlaceFloat(fc, &isLeftFloat, aReflowStatus);
|
||||
|
||||
// Pass on updated available space to the current inline reflow engine
|
||||
GetAvailableSpace();
|
||||
aLineLayout.UpdateBand(mAvailSpaceRect.x + BorderPadding().left, mY,
|
||||
GetFlag(BRS_UNCONSTRAINEDWIDTH) ? NS_UNCONSTRAINEDSIZE : mAvailSpaceRect.width,
|
||||
mAvailSpaceRect.height,
|
||||
isLeftFloater,
|
||||
isLeftFloat,
|
||||
aPlaceholder->GetOutOfFlowFrame());
|
||||
|
||||
// Restore coordinate system
|
||||
mSpaceManager->Translate(dx, dy);
|
||||
}
|
||||
else {
|
||||
// This floater will be placed after the line is done (it is a
|
||||
// below-current-line floater).
|
||||
mBelowCurrentLineFloaters.Append(fc);
|
||||
// This float will be placed after the line is done (it is a
|
||||
// below-current-line float).
|
||||
mBelowCurrentLineFloats.Append(fc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,61 +735,61 @@ nsBlockReflowState::UpdateMaximumWidth(nscoord aMaximumWidth)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
||||
PRUint8 aFloats)
|
||||
nsBlockReflowState::CanPlaceFloat(const nsRect& aFloatRect,
|
||||
PRUint8 aFloats)
|
||||
{
|
||||
// If the current Y coordinate is not impacted by any floaters
|
||||
// then by definition the floater fits.
|
||||
// If the current Y coordinate is not impacted by any floats
|
||||
// then by definition the float fits.
|
||||
PRBool result = PR_TRUE;
|
||||
if (0 != mBand.GetFloaterCount()) {
|
||||
if (0 != mBand.GetFloatCount()) {
|
||||
// XXX We should allow overflow by up to half a pixel here (bug 21193).
|
||||
if (mAvailSpaceRect.width < aFloaterRect.width) {
|
||||
if (mAvailSpaceRect.width < aFloatRect.width) {
|
||||
// The available width is too narrow (and its been impacted by a
|
||||
// prior floater)
|
||||
// prior float)
|
||||
result = PR_FALSE;
|
||||
}
|
||||
else {
|
||||
// At this point we know that there is enough horizontal space for
|
||||
// the floater (somewhere). Lets see if there is enough vertical
|
||||
// the float (somewhere). Lets see if there is enough vertical
|
||||
// space.
|
||||
if (mAvailSpaceRect.height < aFloaterRect.height) {
|
||||
if (mAvailSpaceRect.height < aFloatRect.height) {
|
||||
// The available height is too short. However, its possible that
|
||||
// there is enough open space below which is not impacted by a
|
||||
// floater.
|
||||
// float.
|
||||
//
|
||||
// Compute the X coordinate for the floater based on its float
|
||||
// Compute the X coordinate for the float based on its float
|
||||
// type, assuming its placed on the current line. This is
|
||||
// where the floater will be placed horizontally if it can go
|
||||
// where the float will be placed horizontally if it can go
|
||||
// here.
|
||||
nscoord xa;
|
||||
if (NS_STYLE_FLOAT_LEFT == aFloats) {
|
||||
xa = mAvailSpaceRect.x;
|
||||
}
|
||||
else {
|
||||
xa = mAvailSpaceRect.XMost() - aFloaterRect.width;
|
||||
xa = mAvailSpaceRect.XMost() - aFloatRect.width;
|
||||
|
||||
// In case the floater is too big, don't go past the left edge
|
||||
// In case the float is too big, don't go past the left edge
|
||||
// XXXldb This seems wrong, but we might want to fix bug 6976
|
||||
// first.
|
||||
if (xa < mAvailSpaceRect.x) {
|
||||
xa = mAvailSpaceRect.x;
|
||||
}
|
||||
}
|
||||
nscoord xb = xa + aFloaterRect.width;
|
||||
nscoord xb = xa + aFloatRect.width;
|
||||
|
||||
// Calculate the top and bottom y coordinates, again assuming
|
||||
// that the floater is placed on the current line.
|
||||
// that the float is placed on the current line.
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
nscoord ya = mY - borderPadding.top;
|
||||
if (ya < 0) {
|
||||
// CSS2 spec, 9.5.1 rule [4]: "A floating box's outer top may not
|
||||
// be higher than the top of its containing block." (Since the
|
||||
// containing block is the content edge of the block box, this
|
||||
// means the margin edge of the floater can't be higher than the
|
||||
// means the margin edge of the float can't be higher than the
|
||||
// content edge of the block that contains it.)
|
||||
ya = 0;
|
||||
}
|
||||
nscoord yb = ya + aFloaterRect.height;
|
||||
nscoord yb = ya + aFloatRect.height;
|
||||
|
||||
nscoord saveY = mY;
|
||||
for (;;) {
|
||||
|
@ -797,24 +797,24 @@ nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
|||
mY += mAvailSpaceRect.height;
|
||||
GetAvailableSpace();
|
||||
|
||||
if (0 == mBand.GetFloaterCount()) {
|
||||
// Winner. This band has no floaters on it, therefore
|
||||
if (0 == mBand.GetFloatCount()) {
|
||||
// Winner. This band has no floats on it, therefore
|
||||
// there can be no overlap.
|
||||
break;
|
||||
}
|
||||
|
||||
// Check and make sure the floater won't intersect any
|
||||
// floaters on this band. The floaters starting and ending
|
||||
// Check and make sure the float won't intersect any
|
||||
// floats on this band. The floats starting and ending
|
||||
// coordinates must be entirely in the available space.
|
||||
if ((xa < mAvailSpaceRect.x) || (xb > mAvailSpaceRect.XMost())) {
|
||||
// The floater can't go here.
|
||||
// The float can't go here.
|
||||
result = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
// See if there is now enough height for the floater.
|
||||
// See if there is now enough height for the float.
|
||||
if (yb < mY + mAvailSpaceRect.height) {
|
||||
// Winner. The bottom Y coordinate of the floater is in
|
||||
// Winner. The bottom Y coordinate of the float is in
|
||||
// this band.
|
||||
break;
|
||||
}
|
||||
|
@ -831,94 +831,94 @@ nsBlockReflowState::CanPlaceFloater(const nsRect& aFloaterRect,
|
|||
}
|
||||
|
||||
void
|
||||
nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
||||
PRBool* aIsLeftFloater,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
nsBlockReflowState::FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
||||
PRBool* aIsLeftFloat,
|
||||
nsReflowStatus& aReflowStatus)
|
||||
{
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
// Save away the Y coordinate before placing the floater. We will
|
||||
// restore mY at the end after placing the floater. This is
|
||||
// necessary because any adjustments to mY during the floater
|
||||
// placement are for the floater only, not for any non-floating
|
||||
// Save away the Y coordinate before placing the float. We will
|
||||
// restore mY at the end after placing the float. This is
|
||||
// necessary because any adjustments to mY during the float
|
||||
// placement are for the float only, not for any non-floating
|
||||
// content.
|
||||
nscoord saveY = mY;
|
||||
|
||||
nsPlaceholderFrame* placeholder = aFloaterCache->mPlaceholder;
|
||||
nsIFrame* floater = placeholder->GetOutOfFlowFrame();
|
||||
nsPlaceholderFrame* placeholder = aFloatCache->mPlaceholder;
|
||||
nsIFrame* floatFrame = placeholder->GetOutOfFlowFrame();
|
||||
|
||||
// Grab the floater's display information
|
||||
const nsStyleDisplay* floaterDisplay = floater->GetStyleDisplay();
|
||||
// Grab the float's display information
|
||||
const nsStyleDisplay* floatDisplay = floatFrame->GetStyleDisplay();
|
||||
|
||||
// This will hold the floater's geometry when we've found a place
|
||||
// This will hold the float's geometry when we've found a place
|
||||
// for it to live.
|
||||
nsRect region;
|
||||
|
||||
// The floater's old region, so we can propagate damage.
|
||||
nsRect oldRegion = floater->GetRect();
|
||||
oldRegion.Inflate(aFloaterCache->mMargins);
|
||||
// The float's old region, so we can propagate damage.
|
||||
nsRect oldRegion = floatFrame->GetRect();
|
||||
oldRegion.Inflate(aFloatCache->mMargins);
|
||||
|
||||
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
|
||||
// ``above'' another float that preceded it in the flow.
|
||||
mY = NS_MAX(mSpaceManager->GetLowestRegionTop() + BorderPadding().top, mY);
|
||||
|
||||
// See if the floater should clear any preceeding floaters...
|
||||
if (NS_STYLE_CLEAR_NONE != floaterDisplay->mBreakType) {
|
||||
// See if the float should clear any preceeding floats...
|
||||
if (NS_STYLE_CLEAR_NONE != floatDisplay->mBreakType) {
|
||||
// XXXldb Does this handle vertical margins correctly?
|
||||
ClearFloaters(mY, floaterDisplay->mBreakType);
|
||||
ClearFloats(mY, floatDisplay->mBreakType);
|
||||
}
|
||||
else {
|
||||
// Get the band of available space
|
||||
GetAvailableSpace();
|
||||
}
|
||||
|
||||
// Reflow the floater
|
||||
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
|
||||
// Reflow the float
|
||||
mBlock->ReflowFloat(*this, placeholder, aFloatCache, aReflowStatus);
|
||||
|
||||
// Get the floaters bounding box and margin information
|
||||
region = floater->GetRect();
|
||||
// Get the floats bounding box and margin information
|
||||
region = floatFrame->GetRect();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("flowed floater: ");
|
||||
nsFrame::ListTag(stdout, floater);
|
||||
printf("flowed float: ");
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" (%d,%d,%d,%d)\n",
|
||||
region.x, region.y, region.width, region.height);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Adjust the floater size by its margin. That's the area that will
|
||||
// Adjust the float size by its margin. That's the area that will
|
||||
// impact the space manager.
|
||||
region.width += aFloaterCache->mMargins.left + aFloaterCache->mMargins.right;
|
||||
region.height += aFloaterCache->mMargins.top + aFloaterCache->mMargins.bottom;
|
||||
region.width += aFloatCache->mMargins.left + aFloatCache->mMargins.right;
|
||||
region.height += aFloatCache->mMargins.top + aFloatCache->mMargins.bottom;
|
||||
|
||||
// Find a place to place the floater. The CSS2 spec doesn't want
|
||||
// floaters overlapping each other or sticking out of the containing
|
||||
// Find a place to place the float. The CSS2 spec doesn't want
|
||||
// floats overlapping each other or sticking out of the containing
|
||||
// block if possible (CSS2 spec section 9.5.1, see the rule list).
|
||||
NS_ASSERTION((NS_STYLE_FLOAT_LEFT == floaterDisplay->mFloats) ||
|
||||
(NS_STYLE_FLOAT_RIGHT == floaterDisplay->mFloats),
|
||||
NS_ASSERTION((NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats) ||
|
||||
(NS_STYLE_FLOAT_RIGHT == floatDisplay->mFloats),
|
||||
"invalid float type");
|
||||
|
||||
// Can the floater fit here?
|
||||
PRBool keepFloaterOnSameLine = PR_FALSE;
|
||||
// Can the float fit here?
|
||||
PRBool keepFloatOnSameLine = PR_FALSE;
|
||||
nsCompatibility mode;
|
||||
mPresContext->GetCompatibilityMode(&mode);
|
||||
|
||||
while (! CanPlaceFloater(region, floaterDisplay->mFloats)) {
|
||||
while (! CanPlaceFloat(region, floatDisplay->mFloats)) {
|
||||
// Nope. try to advance to the next band.
|
||||
if (NS_STYLE_DISPLAY_TABLE != floaterDisplay->mDisplay ||
|
||||
if (NS_STYLE_DISPLAY_TABLE != floatDisplay->mDisplay ||
|
||||
eCompatibility_NavQuirks != mode ) {
|
||||
|
||||
mY += mAvailSpaceRect.height;
|
||||
GetAvailableSpace();
|
||||
} else {
|
||||
// IE handles floater tables in a very special way
|
||||
// IE handles float tables in a very special way
|
||||
|
||||
// see if the previous floater is also a table and has "align"
|
||||
nsFloaterCache* fc = mCurrentLineFloaters.Head();
|
||||
// see if the previous float is also a table and has "align"
|
||||
nsFloatCache* fc = mCurrentLineFloats.Head();
|
||||
nsIFrame* prevFrame = nsnull;
|
||||
while (fc) {
|
||||
if (fc->mPlaceholder->GetOutOfFlowFrame() == floater) {
|
||||
if (fc->mPlaceholder->GetOutOfFlowFrame() == floatFrame) {
|
||||
break;
|
||||
}
|
||||
prevFrame = fc->mPlaceholder->GetOutOfFlowFrame();
|
||||
|
@ -939,7 +939,7 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
// we're interested only if previous frame is align=left
|
||||
// IE messes things up when "right" (overlapping frames)
|
||||
if (value.EqualsIgnoreCase("left")) {
|
||||
keepFloaterOnSameLine = PR_TRUE;
|
||||
keepFloatOnSameLine = PR_TRUE;
|
||||
// don't advance to next line (IE quirkie behaviour)
|
||||
// it breaks rule CSS2/9.5.1/1, but what the hell
|
||||
// since we cannot evangelize the world
|
||||
|
@ -953,21 +953,21 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
// the table does not fit anymore in this line so advance to next band
|
||||
mY += mAvailSpaceRect.height;
|
||||
GetAvailableSpace();
|
||||
// reflow the floater again now since we have more space
|
||||
mBlock->ReflowFloater(*this, placeholder, aFloaterCache, aReflowStatus);
|
||||
// Get the floaters bounding box and margin information
|
||||
region = floater->GetRect();
|
||||
// Adjust the floater size by its margin. That's the area that will
|
||||
// reflow the float again now since we have more space
|
||||
mBlock->ReflowFloat(*this, placeholder, aFloatCache, aReflowStatus);
|
||||
// Get the floats bounding box and margin information
|
||||
region = floatFrame->GetRect();
|
||||
// Adjust the float size by its margin. That's the area that will
|
||||
// impact the space manager.
|
||||
region.width += aFloaterCache->mMargins.left + aFloaterCache->mMargins.right;
|
||||
region.height += aFloaterCache->mMargins.top + aFloaterCache->mMargins.bottom;
|
||||
region.width += aFloatCache->mMargins.left + aFloatCache->mMargins.right;
|
||||
region.height += aFloatCache->mMargins.top + aFloatCache->mMargins.bottom;
|
||||
|
||||
}
|
||||
}
|
||||
// If the floater is continued, it will get the same absolute x value as its prev-in-flow
|
||||
// If the float is continued, it will get the same absolute x value as its prev-in-flow
|
||||
nsRect prevRect(0,0,0,0);
|
||||
nsIFrame* prevInFlow;
|
||||
floater->GetPrevInFlow(&prevInFlow);
|
||||
floatFrame->GetPrevInFlow(&prevInFlow);
|
||||
if (prevInFlow) {
|
||||
prevRect = prevInFlow->GetRect();
|
||||
|
||||
|
@ -990,53 +990,53 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
prevRect.x += ancestor->GetRect().x;
|
||||
}
|
||||
}
|
||||
// Assign an x and y coordinate to the floater. Note that the x,y
|
||||
// Assign an x and y coordinate to the float. Note that the x,y
|
||||
// coordinates are computed <b>relative to the translation in the
|
||||
// spacemanager</b> which means that the impacted region will be
|
||||
// <b>inside</b> the border/padding area.
|
||||
PRBool isLeftFloater;
|
||||
if (NS_STYLE_FLOAT_LEFT == floaterDisplay->mFloats) {
|
||||
isLeftFloater = PR_TRUE;
|
||||
PRBool isLeftFloat;
|
||||
if (NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats) {
|
||||
isLeftFloat = PR_TRUE;
|
||||
region.x = (prevInFlow) ? prevRect.x : mAvailSpaceRect.x;
|
||||
}
|
||||
else {
|
||||
isLeftFloater = PR_FALSE;
|
||||
isLeftFloat = PR_FALSE;
|
||||
if (NS_UNCONSTRAINEDSIZE != mAvailSpaceRect.width) {
|
||||
nsIFrame* prevInFlow;
|
||||
floater->GetPrevInFlow(&prevInFlow);
|
||||
floatFrame->GetPrevInFlow(&prevInFlow);
|
||||
if (prevInFlow) {
|
||||
region.x = prevRect.x;
|
||||
}
|
||||
else if (!keepFloaterOnSameLine) {
|
||||
else if (!keepFloatOnSameLine) {
|
||||
region.x = mAvailSpaceRect.XMost() - region.width;
|
||||
}
|
||||
else {
|
||||
// this is the IE quirk (see few lines above)
|
||||
// the table is keept in the same line: don't let it overlap the previous floater
|
||||
// the table is keept in the same line: don't let it overlap the previous float
|
||||
region.x = mAvailSpaceRect.x;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// For unconstrained reflows, pretend that a right floater is
|
||||
// instead a left floater. This will make us end up with the
|
||||
// For unconstrained reflows, pretend that a right float is
|
||||
// instead a left float. This will make us end up with the
|
||||
// correct unconstrained width, and we'll place it later.
|
||||
region.x = mAvailSpaceRect.x;
|
||||
}
|
||||
}
|
||||
*aIsLeftFloater = isLeftFloater;
|
||||
*aIsLeftFloat = isLeftFloat;
|
||||
const nsMargin& borderPadding = BorderPadding();
|
||||
region.y = mY - borderPadding.top;
|
||||
if (region.y < 0) {
|
||||
// CSS2 spec, 9.5.1 rule [4]: "A floating box's outer top may not
|
||||
// be higher than the top of its containing block." (Since the
|
||||
// containing block is the content edge of the block box, this
|
||||
// means the margin edge of the floater can't be higher than the
|
||||
// means the margin edge of the float can't be higher than the
|
||||
// content edge of the block that contains it.)
|
||||
region.y = 0;
|
||||
}
|
||||
|
||||
// Place the floater in the space manager
|
||||
// if the floater split, then take up all of the vertical height
|
||||
// Place the float in the space manager
|
||||
// if the float split, then take up all of the vertical height
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus) &&
|
||||
(NS_UNCONSTRAINEDSIZE != mContentArea.height)) {
|
||||
region.height = PR_MAX(region.height, mContentArea.height);
|
||||
|
@ -1044,10 +1044,10 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
mSpaceManager->AddRectRegion(floater, region);
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad floater placement");
|
||||
mSpaceManager->AddRectRegion(floatFrame, region);
|
||||
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad float placement");
|
||||
|
||||
// If the floater's dimensions have changed, note the damage in the
|
||||
// If the float's dimensions have changed, note the damage in the
|
||||
// space manager.
|
||||
if (region != oldRegion) {
|
||||
// XXXwaterson conservative: we could probably get away with noting
|
||||
|
@ -1059,61 +1059,61 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
mSpaceManager->IncludeInDamage(top, bottom);
|
||||
}
|
||||
|
||||
// Save away the floaters region in the spacemanager, after making
|
||||
// Save away the floats region in the spacemanager, after making
|
||||
// it relative to the containing block's frame instead of relative
|
||||
// to the spacemanager translation (which is inset by the
|
||||
// border+padding).
|
||||
aFloaterCache->mRegion.x = region.x + borderPadding.left;
|
||||
aFloaterCache->mRegion.y = region.y + borderPadding.top;
|
||||
aFloaterCache->mRegion.width = region.width;
|
||||
aFloaterCache->mRegion.height = region.height;
|
||||
aFloatCache->mRegion.x = region.x + borderPadding.left;
|
||||
aFloatCache->mRegion.y = region.y + borderPadding.top;
|
||||
aFloatCache->mRegion.width = region.width;
|
||||
aFloatCache->mRegion.height = region.height;
|
||||
#ifdef NOISY_SPACEMANAGER
|
||||
nscoord tx, ty;
|
||||
mSpaceManager->GetTranslation(tx, ty);
|
||||
nsFrame::ListTag(stdout, mBlock);
|
||||
printf(": FlowAndPlaceFloater: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
|
||||
printf(": FlowAndPlaceFloat: AddRectRegion: txy=%d,%d (%d,%d) {%d,%d,%d,%d}\n",
|
||||
tx, ty, mSpaceManagerX, mSpaceManagerY,
|
||||
aFloaterCache->mRegion.x, aFloaterCache->mRegion.y,
|
||||
aFloaterCache->mRegion.width, aFloaterCache->mRegion.height);
|
||||
aFloatCache->mRegion.x, aFloatCache->mRegion.y,
|
||||
aFloatCache->mRegion.width, aFloatCache->mRegion.height);
|
||||
#endif
|
||||
|
||||
// Set the origin of the floater frame, in frame coordinates. These
|
||||
// Set the origin of the float frame, in frame coordinates. These
|
||||
// coordinates are <b>not</b> relative to the spacemanager
|
||||
// translation, therefore we have to factor in our border/padding.
|
||||
nscoord x = borderPadding.left + aFloaterCache->mMargins.left + region.x;
|
||||
nscoord y = borderPadding.top + aFloaterCache->mMargins.top + region.y;
|
||||
nscoord x = borderPadding.left + aFloatCache->mMargins.left + region.x;
|
||||
nscoord y = borderPadding.top + aFloatCache->mMargins.top + region.y;
|
||||
|
||||
// If floater is relatively positioned, factor that in as well
|
||||
// If float is relatively positioned, factor that in as well
|
||||
// XXXldb Should this be done after handling the combined area
|
||||
// below?
|
||||
if (NS_STYLE_POSITION_RELATIVE == floaterDisplay->mPosition) {
|
||||
x += aFloaterCache->mOffsets.left;
|
||||
y += aFloaterCache->mOffsets.top;
|
||||
if (NS_STYLE_POSITION_RELATIVE == floatDisplay->mPosition) {
|
||||
x += aFloatCache->mOffsets.left;
|
||||
y += aFloatCache->mOffsets.top;
|
||||
}
|
||||
|
||||
// Position the floater and make sure and views are properly
|
||||
// Position the float and make sure and views are properly
|
||||
// positioned. We need to explicitly position its child views as
|
||||
// well, since we're moving the floater after flowing it.
|
||||
floater->SetPosition(nsPoint(x, y));
|
||||
nsContainerFrame::PositionFrameView(mPresContext, floater);
|
||||
nsContainerFrame::PositionChildViews(mPresContext, floater);
|
||||
// well, since we're moving the float after flowing it.
|
||||
floatFrame->SetPosition(nsPoint(x, y));
|
||||
nsContainerFrame::PositionFrameView(mPresContext, floatFrame);
|
||||
nsContainerFrame::PositionChildViews(mPresContext, floatFrame);
|
||||
|
||||
// Update the floater combined area state
|
||||
nsRect combinedArea = aFloaterCache->mCombinedArea;
|
||||
// Update the float combined area state
|
||||
nsRect combinedArea = aFloatCache->mCombinedArea;
|
||||
combinedArea.x += x;
|
||||
combinedArea.y += y;
|
||||
// When we are placing a right floater in an unconstrained situation or
|
||||
// when shrink wrapping, we don't apply it to the floater combined area
|
||||
// When we are placing a right float in an unconstrained situation or
|
||||
// when shrink wrapping, we don't apply it to the float combined area
|
||||
// immediately, since there's no need to since we're guaranteed another
|
||||
// reflow, and since there's no need to change the code that was
|
||||
// necessary back when the floater was positioned relative to
|
||||
// necessary back when the float was positioned relative to
|
||||
// NS_UNCONSTRAINEDSIZE.
|
||||
if (isLeftFloater ||
|
||||
if (isLeftFloat ||
|
||||
!GetFlag(BRS_UNCONSTRAINEDWIDTH) ||
|
||||
!GetFlag(BRS_SHRINKWRAPWIDTH)) {
|
||||
mFloaterCombinedArea.UnionRect(combinedArea, mFloaterCombinedArea);
|
||||
mFloatCombinedArea.UnionRect(combinedArea, mFloatCombinedArea);
|
||||
} else if (GetFlag(BRS_SHRINKWRAPWIDTH)) {
|
||||
// Mark the line dirty so we come back and re-place the floater once
|
||||
// Mark the line dirty so we come back and re-place the float once
|
||||
// the shrink wrap width is determined
|
||||
mCurrentLine->MarkDirty();
|
||||
SetFlag(BRS_NEEDRESIZEREFLOW, PR_TRUE);
|
||||
|
@ -1124,46 +1124,46 @@ nsBlockReflowState::FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
|||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsRect r = floater->GetRect();
|
||||
nsRect r = floatFrame->GetRect();
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("placed floater: ");
|
||||
nsFrame::ListTag(stdout, floater);
|
||||
printf("placed float: ");
|
||||
nsFrame::ListTag(stdout, floatFrame);
|
||||
printf(" %d,%d,%d,%d\n", r.x, r.y, r.width, r.height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Place below-current-line floaters.
|
||||
* Place below-current-line floats.
|
||||
*/
|
||||
PRBool
|
||||
nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
|
||||
nsBlockReflowState::PlaceBelowCurrentLineFloats(nsFloatCacheList& aList)
|
||||
{
|
||||
nsFloaterCache* fc = aList.Head();
|
||||
nsFloatCache* fc = aList.Head();
|
||||
while (fc) {
|
||||
NS_ASSERTION(!fc->mIsCurrentLineFloater,
|
||||
"A cl floater crept into the bcl floater list.");
|
||||
if (!fc->mIsCurrentLineFloater) {
|
||||
NS_ASSERTION(!fc->mIsCurrentLineFloat,
|
||||
"A cl float crept into the bcl float list.");
|
||||
if (!fc->mIsCurrentLineFloat) {
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("placing bcl floater: ");
|
||||
printf("placing bcl float: ");
|
||||
nsFrame::ListTag(stdout, fc->mPlaceholder->GetOutOfFlowFrame());
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Place the floater
|
||||
PRBool isLeftFloater;
|
||||
// Place the float
|
||||
PRBool isLeftFloat;
|
||||
nsReflowStatus reflowStatus;
|
||||
FlowAndPlaceFloater(fc, &isLeftFloater, reflowStatus);
|
||||
FlowAndPlaceFloat(fc, &isLeftFloat, reflowStatus);
|
||||
|
||||
if (NS_FRAME_IS_TRUNCATED(reflowStatus)) {
|
||||
// return before processing all of the floaters, since the line will be pushed.
|
||||
// return before processing all of the floats, since the line will be pushed.
|
||||
return PR_FALSE;
|
||||
}
|
||||
else if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus)) {
|
||||
// Create a continuation for the incomplete floater and its placeholder.
|
||||
// Create a continuation for the incomplete float and its placeholder.
|
||||
nsresult rv = mBlock->SplitPlaceholder(*mPresContext, *fc->mPlaceholder);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
@ -1175,30 +1175,30 @@ nsBlockReflowState::PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aList)
|
|||
}
|
||||
|
||||
void
|
||||
nsBlockReflowState::ClearFloaters(nscoord aY, PRUint8 aBreakType)
|
||||
nsBlockReflowState::ClearFloats(nscoord aY, PRUint8 aBreakType)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("clear floaters: in: mY=%d aY=%d(%d)\n",
|
||||
printf("clear floats: in: mY=%d aY=%d(%d)\n",
|
||||
mY, aY, aY - BorderPadding().top);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NOISY_FLOATER_CLEARING
|
||||
printf("nsBlockReflowState::ClearFloaters: aY=%d breakType=%d\n",
|
||||
#ifdef NOISY_FLOAT_CLEARING
|
||||
printf("nsBlockReflowState::ClearFloats: aY=%d breakType=%d\n",
|
||||
aY, aBreakType);
|
||||
mSpaceManager->List(stdout);
|
||||
#endif
|
||||
const nsMargin& bp = BorderPadding();
|
||||
nscoord newY = mBand.ClearFloaters(aY - bp.top, aBreakType);
|
||||
nscoord newY = mBand.ClearFloats(aY - bp.top, aBreakType);
|
||||
mY = newY + bp.top;
|
||||
GetAvailableSpace();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (nsBlockFrame::gNoisyReflow) {
|
||||
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
|
||||
printf("clear floaters: out: mY=%d(%d)\n", mY, mY - bp.top);
|
||||
printf("clear floats: out: mY=%d(%d)\n", mY, mY - bp.top);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -68,29 +68,29 @@ public:
|
|||
|
||||
void GetAvailableSpace(nscoord aY);
|
||||
|
||||
void InitFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
void InitFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
void AddFloater(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
void AddFloat(nsLineLayout& aLineLayout,
|
||||
nsPlaceholderFrame* aPlaceholderFrame,
|
||||
PRBool aInitialReflow,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool CanPlaceFloater(const nsRect& aFloaterRect, PRUint8 aFloats);
|
||||
PRBool CanPlaceFloat(const nsRect& aFloatRect, PRUint8 aFloats);
|
||||
|
||||
void FlowAndPlaceFloater(nsFloaterCache* aFloaterCache,
|
||||
PRBool* aIsLeftFloater,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
void FlowAndPlaceFloat(nsFloatCache* aFloatCache,
|
||||
PRBool* aIsLeftFloat,
|
||||
nsReflowStatus& aReflowStatus);
|
||||
|
||||
PRBool PlaceBelowCurrentLineFloaters(nsFloaterCacheList& aFloaters);
|
||||
PRBool PlaceBelowCurrentLineFloats(nsFloatCacheList& aFloats);
|
||||
|
||||
// called when clearing a line with a break type caused by a BR past
|
||||
// floats, and also used internally by ClearPastFloaters
|
||||
void ClearFloaters(nscoord aY, PRUint8 aBreakType);
|
||||
// floats, and also used internally by ClearPastFloats
|
||||
void ClearFloats(nscoord aY, PRUint8 aBreakType);
|
||||
|
||||
// called when clearing a block past floats
|
||||
PRBool ClearPastFloaters(PRUint8 aBreakType);
|
||||
PRBool ClearPastFloats(PRUint8 aBreakType);
|
||||
|
||||
PRBool IsAdjacentWithTop() const {
|
||||
return mY == mReflowState.mComputedBorderPadding.top;
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
nsRect& aResult);
|
||||
|
||||
protected:
|
||||
void RecoverFloaters(nsLineList::iterator aLine, nscoord aDeltaY);
|
||||
void RecoverFloats(nsLineList::iterator aLine, nscoord aDeltaY);
|
||||
|
||||
public:
|
||||
void RecoverStateFrom(nsLineList::iterator aLine, nscoord aDeltaY);
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
mLineNumber++;
|
||||
}
|
||||
|
||||
PRBool IsImpactedByFloater() const;
|
||||
PRBool IsImpactedByFloat() const;
|
||||
|
||||
nsLineBox* NewLineBox(nsIFrame* aFrame, PRInt32 aCount, PRBool aIsBlock);
|
||||
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
// placed <b>after</b> taking into account the blocks border and
|
||||
// padding. This, therefore, represents the inner "content area" (in
|
||||
// spacemanager coordinates) where child frames will be placed,
|
||||
// including child blocks and floaters.
|
||||
// including child blocks and floats.
|
||||
nscoord mSpaceManagerX, mSpaceManagerY;
|
||||
|
||||
// XXX get rid of this
|
||||
|
@ -184,10 +184,10 @@ public:
|
|||
// The maximum x-most of each line
|
||||
nscoord mKidXMost;
|
||||
|
||||
// The combined area of all floaters placed so far
|
||||
nsRect mFloaterCombinedArea;
|
||||
// The combined area of all floats placed so far
|
||||
nsRect mFloatCombinedArea;
|
||||
|
||||
nsFloaterCacheFreeList mFloaterCacheFreeList;
|
||||
nsFloatCacheFreeList mFloatCacheFreeList;
|
||||
|
||||
// Previous child. This is used when pulling up a frame to update
|
||||
// the sibling list.
|
||||
|
@ -210,16 +210,16 @@ public:
|
|||
// Temporary line-reflow state. This state is used during the reflow
|
||||
// of a given line, but doesn't have meaning before or after.
|
||||
|
||||
// The list of floaters that are "current-line" floaters. These are
|
||||
// The list of floats that are "current-line" floats. These are
|
||||
// added to the line after the line has been reflowed, to keep the
|
||||
// list fiddling from being N^2.
|
||||
nsFloaterCacheFreeList mCurrentLineFloaters;
|
||||
nsFloatCacheFreeList mCurrentLineFloats;
|
||||
|
||||
// The list of floaters which are "below current-line"
|
||||
// floaters. These are reflowed/placed after the line is reflowed
|
||||
// The list of floats which are "below current-line"
|
||||
// floats. These are reflowed/placed after the line is reflowed
|
||||
// and placed. Again, this is done to keep the list fiddling from
|
||||
// being N^2.
|
||||
nsFloaterCacheFreeList mBelowCurrentLineFloaters;
|
||||
nsFloatCacheFreeList mBelowCurrentLineFloats;
|
||||
|
||||
nscoord mMaxElementWidth;
|
||||
nscoord mMaximumWidth;
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
|
||||
PRInt16 mFlags;
|
||||
|
||||
PRUint8 mFloaterBreakType;
|
||||
PRUint8 mFloatBreakType;
|
||||
|
||||
void SetFlag(PRUint32 aFlag, PRBool aValue)
|
||||
{
|
||||
|
|
|
@ -129,10 +129,10 @@ nsLineBox::Cleanup()
|
|||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters)
|
||||
ListFloats(FILE* out, PRInt32 aIndent, const nsFloatCacheList& aFloats)
|
||||
{
|
||||
nsAutoString frameName;
|
||||
nsFloaterCache* fc = aFloaters.Head();
|
||||
nsFloatCache* fc = aFloats.Head();
|
||||
while (fc) {
|
||||
nsFrame::IndentBy(out, aIndent);
|
||||
nsPlaceholderFrame* ph = fc->mPlaceholder;
|
||||
|
@ -148,7 +148,7 @@ ListFloaters(FILE* out, PRInt32 aIndent, const nsFloaterCacheList& aFloaters)
|
|||
}
|
||||
}
|
||||
fprintf(out, " %s region={%d,%d,%d,%d} combinedArea={%d,%d,%d,%d}",
|
||||
fc->mIsCurrentLineFloater ? "cl" : "bcl",
|
||||
fc->mIsCurrentLineFloat ? "cl" : "bcl",
|
||||
fc->mRegion.x, fc->mRegion.y,
|
||||
fc->mRegion.width, fc->mRegion.height,
|
||||
fc->mCombinedArea.x, fc->mCombinedArea.y,
|
||||
|
@ -187,7 +187,7 @@ nsLineBox::StateToString(char* aBuf, PRInt32 aBufSize) const
|
|||
IsBlock() ? "block" : "inline",
|
||||
IsDirty() ? "dirty" : "clean",
|
||||
IsPreviousMarginDirty() ? "prevmargindirty" : "prevmarginclean",
|
||||
IsImpactedByFloater() ? "impacted" : "not impacted",
|
||||
IsImpactedByFloat() ? "impacted" : "not impacted",
|
||||
IsLineWrapped() ? "wrapped" : "not wrapped",
|
||||
BreakTypeToString(GetBreakType()),
|
||||
mAllFlags);
|
||||
|
@ -231,9 +231,9 @@ nsLineBox::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const
|
|||
}
|
||||
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
if (HasFloaters()) {
|
||||
fputs("> floaters <\n", out);
|
||||
ListFloaters(out, aIndent + 1, mInlineData->mFloaters);
|
||||
if (HasFloats()) {
|
||||
fputs("> floats <\n", out);
|
||||
ListFloats(out, aIndent + 1, mInlineData->mFloats);
|
||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||
}
|
||||
fputs(">\n", out);
|
||||
|
@ -390,7 +390,7 @@ nsLineBox::MaybeFreeData()
|
|||
{
|
||||
if (mData && (mData->mCombinedArea == mBounds)) {
|
||||
if (IsInline()) {
|
||||
if (mInlineData->mFloaters.IsEmpty()) {
|
||||
if (mInlineData->mFloats.IsEmpty()) {
|
||||
delete mInlineData;
|
||||
mInlineData = nsnull;
|
||||
}
|
||||
|
@ -403,53 +403,53 @@ nsLineBox::MaybeFreeData()
|
|||
}
|
||||
|
||||
// XXX get rid of this???
|
||||
nsFloaterCache*
|
||||
nsLineBox::GetFirstFloater()
|
||||
nsFloatCache*
|
||||
nsLineBox::GetFirstFloat()
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
return mInlineData ? mInlineData->mFloaters.Head() : nsnull;
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
return mInlineData ? mInlineData->mFloats.Head() : nsnull;
|
||||
}
|
||||
|
||||
// XXX this might be too eager to free memory
|
||||
void
|
||||
nsLineBox::FreeFloaters(nsFloaterCacheFreeList& aFreeList)
|
||||
nsLineBox::FreeFloats(nsFloatCacheFreeList& aFreeList)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
if (IsInline()) {
|
||||
if (mInlineData) {
|
||||
aFreeList.Append(mInlineData->mFloaters);
|
||||
aFreeList.Append(mInlineData->mFloats);
|
||||
MaybeFreeData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsLineBox::AppendFloaters(nsFloaterCacheFreeList& aFreeList)
|
||||
nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
if (IsInline()) {
|
||||
if (aFreeList.NotEmpty()) {
|
||||
if (!mInlineData) {
|
||||
mInlineData = new ExtraInlineData(mBounds);
|
||||
}
|
||||
if (mInlineData) {
|
||||
mInlineData->mFloaters.Append(aFreeList);
|
||||
mInlineData->mFloats.Append(aFreeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLineBox::RemoveFloater(nsIFrame* aFrame)
|
||||
nsLineBox::RemoveFloat(nsIFrame* aFrame)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floaters");
|
||||
NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats");
|
||||
if (IsInline() && mInlineData) {
|
||||
nsFloaterCache* fc = mInlineData->mFloaters.Find(aFrame);
|
||||
nsFloatCache* fc = mInlineData->mFloats.Find(aFrame);
|
||||
if (fc) {
|
||||
// Note: the placeholder is part of the line's child list
|
||||
// and will be removed later.
|
||||
fc->mPlaceholder->SetOutOfFlowFrame(nsnull);
|
||||
mInlineData->mFloaters.Remove(fc);
|
||||
mInlineData->mFloats.Remove(fc);
|
||||
MaybeFreeData();
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -970,21 +970,21 @@ nsLineIterator::GetNextSiblingOnLine(nsIFrame*& aFrame, PRInt32 aLineNumber)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsFloaterCacheList::~nsFloaterCacheList()
|
||||
nsFloatCacheList::~nsFloatCacheList()
|
||||
{
|
||||
nsFloaterCache* floater = mHead;
|
||||
while (floater) {
|
||||
nsFloaterCache* next = floater->mNext;
|
||||
delete floater;
|
||||
floater = next;
|
||||
nsFloatCache* fc = mHead;
|
||||
while (fc) {
|
||||
nsFloatCache* next = fc->mNext;
|
||||
delete fc;
|
||||
fc = next;
|
||||
}
|
||||
mHead = nsnull;
|
||||
}
|
||||
|
||||
nsFloaterCache*
|
||||
nsFloaterCacheList::Tail() const
|
||||
nsFloatCache*
|
||||
nsFloatCacheList::Tail() const
|
||||
{
|
||||
nsFloaterCache* fc = mHead;
|
||||
nsFloatCache* fc = mHead;
|
||||
while (fc) {
|
||||
if (!fc->mNext) {
|
||||
break;
|
||||
|
@ -995,9 +995,9 @@ nsFloaterCacheList::Tail() const
|
|||
}
|
||||
|
||||
void
|
||||
nsFloaterCacheList::Append(nsFloaterCacheFreeList& aList)
|
||||
nsFloatCacheList::Append(nsFloatCacheFreeList& aList)
|
||||
{
|
||||
nsFloaterCache* tail = Tail();
|
||||
nsFloatCache* tail = Tail();
|
||||
if (tail) {
|
||||
tail->mNext = aList.mHead;
|
||||
}
|
||||
|
@ -1008,10 +1008,10 @@ nsFloaterCacheList::Append(nsFloaterCacheFreeList& aList)
|
|||
aList.mTail = nsnull;
|
||||
}
|
||||
|
||||
nsFloaterCache*
|
||||
nsFloaterCacheList::Find(nsIFrame* aOutOfFlowFrame)
|
||||
nsFloatCache*
|
||||
nsFloatCacheList::Find(nsIFrame* aOutOfFlowFrame)
|
||||
{
|
||||
nsFloaterCache* fc = mHead;
|
||||
nsFloatCache* fc = mHead;
|
||||
while (fc) {
|
||||
if (fc->mPlaceholder->GetOutOfFlowFrame() == aOutOfFlowFrame) {
|
||||
break;
|
||||
|
@ -1022,10 +1022,10 @@ nsFloaterCacheList::Find(nsIFrame* aOutOfFlowFrame)
|
|||
}
|
||||
|
||||
void
|
||||
nsFloaterCacheList::Remove(nsFloaterCache* aElement)
|
||||
nsFloatCacheList::Remove(nsFloatCache* aElement)
|
||||
{
|
||||
nsFloaterCache** fcp = &mHead;
|
||||
nsFloaterCache* fc;
|
||||
nsFloatCache** fcp = &mHead;
|
||||
nsFloatCache* fc;
|
||||
while (nsnull != (fc = *fcp)) {
|
||||
if (fc == aElement) {
|
||||
*fcp = fc->mNext;
|
||||
|
@ -1038,7 +1038,7 @@ nsFloaterCacheList::Remove(nsFloaterCache* aElement)
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsFloaterCacheFreeList::Append(nsFloaterCacheList& aList)
|
||||
nsFloatCacheFreeList::Append(nsFloatCacheList& aList)
|
||||
{
|
||||
if (mTail) {
|
||||
mTail->mNext = aList.mHead;
|
||||
|
@ -1050,10 +1050,10 @@ nsFloaterCacheFreeList::Append(nsFloaterCacheList& aList)
|
|||
aList.mHead = nsnull;
|
||||
}
|
||||
|
||||
nsFloaterCache*
|
||||
nsFloaterCacheFreeList::Alloc()
|
||||
nsFloatCache*
|
||||
nsFloatCacheFreeList::Alloc()
|
||||
{
|
||||
nsFloaterCache* fc = mHead;
|
||||
nsFloatCache* fc = mHead;
|
||||
if (mHead) {
|
||||
if (mHead == mTail) {
|
||||
mHead = mTail = nsnull;
|
||||
|
@ -1064,42 +1064,42 @@ nsFloaterCacheFreeList::Alloc()
|
|||
fc->mNext = nsnull;
|
||||
}
|
||||
else {
|
||||
fc = new nsFloaterCache();
|
||||
fc = new nsFloatCache();
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
|
||||
void
|
||||
nsFloaterCacheFreeList::Append(nsFloaterCache* aFloater)
|
||||
nsFloatCacheFreeList::Append(nsFloatCache* aFloat)
|
||||
{
|
||||
aFloater->mNext = nsnull;
|
||||
aFloat->mNext = nsnull;
|
||||
if (mTail) {
|
||||
mTail->mNext = aFloater;
|
||||
mTail = aFloater;
|
||||
mTail->mNext = aFloat;
|
||||
mTail = aFloat;
|
||||
}
|
||||
else {
|
||||
mHead = mTail = aFloater;
|
||||
mHead = mTail = aFloat;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(nsFloaterCache)
|
||||
MOZ_DECL_CTOR_COUNTER(nsFloatCache)
|
||||
|
||||
nsFloaterCache::nsFloaterCache()
|
||||
nsFloatCache::nsFloatCache()
|
||||
: mPlaceholder(nsnull),
|
||||
mIsCurrentLineFloater(PR_TRUE),
|
||||
mIsCurrentLineFloat(PR_TRUE),
|
||||
mMargins(0, 0, 0, 0),
|
||||
mOffsets(0, 0, 0, 0),
|
||||
mCombinedArea(0, 0, 0, 0),
|
||||
mNext(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsFloaterCache);
|
||||
MOZ_COUNT_CTOR(nsFloatCache);
|
||||
}
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
nsFloaterCache::~nsFloaterCache()
|
||||
nsFloatCache::~nsFloatCache()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsFloaterCache);
|
||||
MOZ_COUNT_DTOR(nsFloatCache);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -45,60 +45,60 @@
|
|||
|
||||
class nsSpaceManager;
|
||||
class nsLineBox;
|
||||
class nsFloaterCache;
|
||||
class nsFloaterCacheList;
|
||||
class nsFloaterCacheFreeList;
|
||||
class nsFloatCache;
|
||||
class nsFloatCacheList;
|
||||
class nsFloatCacheFreeList;
|
||||
|
||||
// State cached after reflowing a floater. This state is used during
|
||||
// incremental reflow when we avoid reflowing a floater.
|
||||
class nsFloaterCache {
|
||||
// State cached after reflowing a float. This state is used during
|
||||
// incremental reflow when we avoid reflowing a float.
|
||||
class nsFloatCache {
|
||||
public:
|
||||
nsFloaterCache();
|
||||
nsFloatCache();
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
~nsFloaterCache();
|
||||
~nsFloatCache();
|
||||
#else
|
||||
~nsFloaterCache() { }
|
||||
~nsFloatCache() { }
|
||||
#endif
|
||||
|
||||
nsFloaterCache* Next() const { return mNext; }
|
||||
nsFloatCache* Next() const { return mNext; }
|
||||
|
||||
nsPlaceholderFrame* mPlaceholder; // nsPlaceholderFrame
|
||||
|
||||
// This will be true if the floater was placed on the current line
|
||||
// This will be true if the float was placed on the current line
|
||||
// instead of below the current line.
|
||||
PRBool mIsCurrentLineFloater;
|
||||
PRBool mIsCurrentLineFloat;
|
||||
|
||||
nsMargin mMargins; // computed margins
|
||||
|
||||
nsMargin mOffsets; // computed offsets (relative pos)
|
||||
|
||||
// Region in the spacemanager impacted by this floater; the
|
||||
// Region in the spacemanager impacted by this float; the
|
||||
// coordinates are relative to the containing block frame. The
|
||||
// region includes the margins around the floater, but doesn't
|
||||
// region includes the margins around the float, but doesn't
|
||||
// include the relative offsets.
|
||||
nsRect mRegion;
|
||||
|
||||
// Combined area for the floater. This will not include the margins
|
||||
// for the floater. Like mRegion, the coordinates are relative to
|
||||
// Combined area for the float. This will not include the margins
|
||||
// for the float. Like mRegion, the coordinates are relative to
|
||||
// the containing block frame.
|
||||
nsRect mCombinedArea;
|
||||
|
||||
// The floater's max-element-width.
|
||||
// The float's max-element-width.
|
||||
nscoord mMaxElementWidth;
|
||||
|
||||
protected:
|
||||
nsFloaterCache* mNext;
|
||||
nsFloatCache* mNext;
|
||||
|
||||
friend class nsFloaterCacheList;
|
||||
friend class nsFloaterCacheFreeList;
|
||||
friend class nsFloatCacheList;
|
||||
friend class nsFloatCacheFreeList;
|
||||
};
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
class nsFloaterCacheList {
|
||||
class nsFloatCacheList {
|
||||
public:
|
||||
nsFloaterCacheList() : mHead(nsnull) { }
|
||||
~nsFloaterCacheList();
|
||||
nsFloatCacheList() : mHead(nsnull) { }
|
||||
~nsFloatCacheList();
|
||||
|
||||
PRBool IsEmpty() const {
|
||||
return nsnull == mHead;
|
||||
|
@ -108,44 +108,44 @@ public:
|
|||
return nsnull != mHead;
|
||||
}
|
||||
|
||||
nsFloaterCache* Head() const {
|
||||
nsFloatCache* Head() const {
|
||||
return mHead;
|
||||
}
|
||||
|
||||
nsFloaterCache* Tail() const;
|
||||
nsFloatCache* Tail() const;
|
||||
|
||||
nsFloaterCache* Find(nsIFrame* aOutOfFlowFrame);
|
||||
nsFloatCache* Find(nsIFrame* aOutOfFlowFrame);
|
||||
|
||||
void Remove(nsFloaterCache* aElement);
|
||||
void Remove(nsFloatCache* aElement);
|
||||
|
||||
void Append(nsFloaterCacheFreeList& aList);
|
||||
void Append(nsFloatCacheFreeList& aList);
|
||||
|
||||
protected:
|
||||
nsFloaterCache* mHead;
|
||||
nsFloatCache* mHead;
|
||||
|
||||
friend class nsFloaterCacheFreeList;
|
||||
friend class nsFloatCacheFreeList;
|
||||
};
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
class nsFloaterCacheFreeList : public nsFloaterCacheList {
|
||||
class nsFloatCacheFreeList : public nsFloatCacheList {
|
||||
public:
|
||||
nsFloaterCacheFreeList() : mTail(nsnull) { }
|
||||
~nsFloaterCacheFreeList() { }
|
||||
nsFloatCacheFreeList() : mTail(nsnull) { }
|
||||
~nsFloatCacheFreeList() { }
|
||||
|
||||
// Steal away aList's nsFloaterCache objects and put them on this
|
||||
// Steal away aList's nsFloatCache objects and put them on this
|
||||
// free-list.
|
||||
void Append(nsFloaterCacheList& aList);
|
||||
void Append(nsFloatCacheList& aList);
|
||||
|
||||
void Append(nsFloaterCache* aFloaterCache);
|
||||
void Append(nsFloatCache* aFloatCache);
|
||||
|
||||
// Allocate a new nsFloaterCache object
|
||||
nsFloaterCache* Alloc();
|
||||
// Allocate a new nsFloatCache object
|
||||
nsFloatCache* Alloc();
|
||||
|
||||
protected:
|
||||
nsFloaterCache* mTail;
|
||||
nsFloatCache* mTail;
|
||||
|
||||
friend class nsFloaterCacheList;
|
||||
friend class nsFloatCacheList;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -246,13 +246,13 @@ public:
|
|||
return mFlags.mPreviousMarginDirty;
|
||||
}
|
||||
|
||||
// mImpactedByFloater bit
|
||||
void SetLineIsImpactedByFloater(PRBool aValue) {
|
||||
// mImpactedByFloat bit
|
||||
void SetLineIsImpactedByFloat(PRBool aValue) {
|
||||
NS_ASSERTION((PR_FALSE==aValue || PR_TRUE==aValue), "somebody is playing fast and loose with bools and bits!");
|
||||
mFlags.mImpactedByFloater = aValue;
|
||||
mFlags.mImpactedByFloat = aValue;
|
||||
}
|
||||
PRBool IsImpactedByFloater() const {
|
||||
return mFlags.mImpactedByFloater;
|
||||
PRBool IsImpactedByFloat() const {
|
||||
return mFlags.mImpactedByFloat;
|
||||
}
|
||||
|
||||
// mHasPercentageChild bit
|
||||
|
@ -324,14 +324,14 @@ public:
|
|||
nsCollapsingMargin GetCarriedOutBottomMargin() const;
|
||||
void SetCarriedOutBottomMargin(nsCollapsingMargin aValue);
|
||||
|
||||
// mFloaters
|
||||
PRBool HasFloaters() const {
|
||||
return (IsInline() && mInlineData) && mInlineData->mFloaters.NotEmpty();
|
||||
// mFloats
|
||||
PRBool HasFloats() const {
|
||||
return (IsInline() && mInlineData) && mInlineData->mFloats.NotEmpty();
|
||||
}
|
||||
nsFloaterCache* GetFirstFloater();
|
||||
void FreeFloaters(nsFloaterCacheFreeList& aFreeList);
|
||||
void AppendFloaters(nsFloaterCacheFreeList& aFreeList);
|
||||
PRBool RemoveFloater(nsIFrame* aFrame);
|
||||
nsFloatCache* GetFirstFloat();
|
||||
void FreeFloats(nsFloatCacheFreeList& aFreeList);
|
||||
void AppendFloats(nsFloatCacheFreeList& aFreeList);
|
||||
PRBool RemoveFloat(nsIFrame* aFrame);
|
||||
|
||||
// Combined area is the area of the line that should influence the
|
||||
// overflow area of its parent block. The combined area should be
|
||||
|
@ -416,7 +416,7 @@ public:
|
|||
PRUint32 mDirty : 1;
|
||||
PRUint32 mPreviousMarginDirty : 1;
|
||||
PRUint32 mBlock : 1;
|
||||
PRUint32 mImpactedByFloater : 1;
|
||||
PRUint32 mImpactedByFloat : 1;
|
||||
PRUint32 mHasPercentageChild : 1;
|
||||
PRUint32 mLineWrapped: 1;
|
||||
PRUint32 mForceInvalidate: 1; // default 0 = means this line handles it's own invalidation. 1 = always invalidate this entire line
|
||||
|
@ -444,7 +444,7 @@ public:
|
|||
struct ExtraInlineData : public ExtraData {
|
||||
ExtraInlineData(const nsRect& aBounds) : ExtraData(aBounds) {
|
||||
}
|
||||
nsFloaterCacheList mFloaters;
|
||||
nsFloatCacheList mFloats;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
@ -169,7 +169,7 @@ nsLineLayout::nsLineLayout(nsIPresContext* aPresContext,
|
|||
mColumn = 0;
|
||||
mFlags = 0; // default all flags to false except those that follow here...
|
||||
SetFlag(LL_ENDSINWHITESPACE, PR_TRUE);
|
||||
mPlacedFloaters = 0;
|
||||
mPlacedFloats = 0;
|
||||
mTotalPlacedFrames = 0;
|
||||
mTopEdge = mBottomEdge = 0;
|
||||
|
||||
|
@ -229,7 +229,7 @@ HasPrevInFlow(nsIFrame *aFrame)
|
|||
void
|
||||
nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aImpactedByFloaters,
|
||||
PRBool aImpactedByFloats,
|
||||
PRBool aIsTopOfPage)
|
||||
{
|
||||
NS_ASSERTION(nsnull == mRootSpan, "bad linelayout user");
|
||||
|
@ -251,7 +251,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
printf(": BeginLineReflow: %d,%d,%d,%d impacted=%s %s\n",
|
||||
aX, aY, aWidth, aHeight,
|
||||
aImpactedByFloaters?"true":"false",
|
||||
aImpactedByFloats?"true":"false",
|
||||
aIsTopOfPage ? "top-of-page" : "");
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
|
@ -265,10 +265,10 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE);
|
||||
SetFlag(LL_ISTOPOFPAGE, aIsTopOfPage);
|
||||
SetFlag(LL_UPDATEDBAND, PR_FALSE);
|
||||
mPlacedFloaters = 0;
|
||||
SetFlag(LL_IMPACTEDBYFLOATERS, aImpactedByFloaters);
|
||||
mPlacedFloats = 0;
|
||||
SetFlag(LL_IMPACTEDBYFLOATS, aImpactedByFloats);
|
||||
mTotalPlacedFrames = 0;
|
||||
SetFlag(LL_CANPLACEFLOATER, PR_TRUE);
|
||||
SetFlag(LL_CANPLACEFLOAT, PR_TRUE);
|
||||
SetFlag(LL_LINEENDSINBR, PR_FALSE);
|
||||
mSpanDepth = 0;
|
||||
mMaxTopBoxHeight = mMaxBottomBoxHeight = 0;
|
||||
|
@ -374,12 +374,12 @@ nsLineLayout::EndLineReflow()
|
|||
void
|
||||
nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPlacedLeftFloater,
|
||||
nsIFrame* aFloaterFrame)
|
||||
PRBool aPlacedLeftFloat,
|
||||
nsIFrame* aFloatFrame)
|
||||
{
|
||||
#ifdef REALLY_NOISY_REFLOW
|
||||
printf("nsLL::UpdateBand %d, %d, %d, %d, frame=%p placedLeft=%s\n will set mImpacted to PR_TRUE\n",
|
||||
aX, aY, aWidth, aHeight, aFloaterFrame, aPlacedLeftFloater?"true":"false");
|
||||
aX, aY, aWidth, aHeight, aFloatFrame, aPlacedLeftFloat?"true":"false");
|
||||
#endif
|
||||
PerSpanData* psd = mRootSpan;
|
||||
NS_PRECONDITION(psd->mX == psd->mLeftEdge, "update-band called late");
|
||||
|
@ -405,9 +405,9 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
}
|
||||
#ifdef NOISY_REFLOW
|
||||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s floater\n",
|
||||
printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s float\n",
|
||||
aX, aY, aWidth, aHeight, deltaWidth,
|
||||
aPlacedLeftFloater ? "left" : "right");
|
||||
aPlacedLeftFloat ? "left" : "right");
|
||||
#endif
|
||||
|
||||
psd->mLeftEdge = aX;
|
||||
|
@ -426,29 +426,29 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
mBottomEdge = aY + aHeight;
|
||||
}
|
||||
SetFlag(LL_UPDATEDBAND, PR_TRUE);
|
||||
mPlacedFloaters |= (aPlacedLeftFloater ? PLACED_LEFT : PLACED_RIGHT);
|
||||
SetFlag(LL_IMPACTEDBYFLOATERS, PR_TRUE);
|
||||
mPlacedFloats |= (aPlacedLeftFloat ? PLACED_LEFT : PLACED_RIGHT);
|
||||
SetFlag(LL_IMPACTEDBYFLOATS, PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
aFloaterFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
SetFlag(LL_LASTFLOATERWASLETTERFRAME, (nsLayoutAtoms::letterFrame == frameType.get()));
|
||||
aFloatFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
SetFlag(LL_LASTFLOATWASLETTERFRAME, (nsLayoutAtoms::letterFrame == frameType.get()));
|
||||
|
||||
// Now update all of the open spans...
|
||||
mRootSpan->mContainsFloater = PR_TRUE; // make sure mRootSpan gets updated too
|
||||
mRootSpan->mContainsFloat = PR_TRUE; // make sure mRootSpan gets updated too
|
||||
psd = mCurrentSpan;
|
||||
while (psd != mRootSpan) {
|
||||
NS_ASSERTION(nsnull != psd, "null ptr");
|
||||
if (nsnull == psd) {
|
||||
break;
|
||||
}
|
||||
NS_ASSERTION(psd->mX == psd->mLeftEdge, "bad floater placement");
|
||||
NS_ASSERTION(psd->mX == psd->mLeftEdge, "bad float placement");
|
||||
if (NS_UNCONSTRAINEDSIZE == aWidth) {
|
||||
psd->mRightEdge = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
psd->mRightEdge += deltaWidth;
|
||||
}
|
||||
psd->mContainsFloater = PR_TRUE;
|
||||
psd->mContainsFloat = PR_TRUE;
|
||||
#ifdef NOISY_REFLOW
|
||||
printf(" span %p: oldRightEdge=%d newRightEdge=%d\n",
|
||||
psd, psd->mRightEdge - deltaWidth, psd->mRightEdge);
|
||||
|
@ -468,7 +468,7 @@ nsLineLayout::UpdateFrames()
|
|||
|
||||
PerSpanData* psd = mRootSpan;
|
||||
if (NS_STYLE_DIRECTION_LTR == psd->mDirection) {
|
||||
if (PLACED_LEFT & mPlacedFloaters) {
|
||||
if (PLACED_LEFT & mPlacedFloats) {
|
||||
PerFrameData* pfd = psd->mFirstFrame;
|
||||
while (nsnull != pfd) {
|
||||
pfd->mBounds.x = psd->mX;
|
||||
|
@ -476,7 +476,7 @@ nsLineLayout::UpdateFrames()
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (PLACED_RIGHT & mPlacedFloaters) {
|
||||
else if (PLACED_RIGHT & mPlacedFloats) {
|
||||
// XXX handle DIR=right-to-left
|
||||
}
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ nsLineLayout::NewPerSpanData(PerSpanData** aResult)
|
|||
psd->mFrame = nsnull;
|
||||
psd->mFirstFrame = nsnull;
|
||||
psd->mLastFrame = nsnull;
|
||||
psd->mContainsFloater = PR_FALSE;
|
||||
psd->mContainsFloat = PR_FALSE;
|
||||
psd->mZeroEffectiveSpanBox = PR_FALSE;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -795,9 +795,9 @@ nsLineLayout::NewPerFrameData(PerFrameData** aResult)
|
|||
}
|
||||
|
||||
PRBool
|
||||
nsLineLayout::CanPlaceFloaterNow() const
|
||||
nsLineLayout::CanPlaceFloatNow() const
|
||||
{
|
||||
return GetFlag(LL_CANPLACEFLOATER);
|
||||
return GetFlag(LL_CANPLACEFLOAT);
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -809,7 +809,7 @@ nsLineLayout::LineIsEmpty() const
|
|||
PRBool
|
||||
nsLineLayout::LineIsBreakable() const
|
||||
{
|
||||
if ((0 != mTotalPlacedFrames) || GetFlag(LL_IMPACTEDBYFLOATERS)) {
|
||||
if ((0 != mTotalPlacedFrames) || GetFlag(LL_IMPACTEDBYFLOATS)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -956,7 +956,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
// We want to guarantee that we always make progress when
|
||||
// formatting. Therefore, if the object being placed on the line is
|
||||
// too big for the line, but it is the only thing on the line
|
||||
// (including counting floaters) then we go ahead and place it
|
||||
// (including counting floats) then we go ahead and place it
|
||||
// anyway. Its also true that if the object is a part of a larger
|
||||
// object (a multiple frame word) then we will place it on the line
|
||||
// too.
|
||||
|
@ -964,7 +964,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
// Capture this state *before* we reflow the frame in case it clears
|
||||
// the state out. We need to know how to treat the current frame
|
||||
// when breaking.
|
||||
PRBool notSafeToBreak = CanPlaceFloaterNow() || InWord();
|
||||
PRBool notSafeToBreak = CanPlaceFloatNow() || InWord();
|
||||
|
||||
// Apply start margins (as appropriate) to the frame computing the
|
||||
// new starting x,y coordinates for the frame.
|
||||
|
@ -1063,7 +1063,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
pfd->mJustificationNumLetters = mTextJustificationNumLetters;
|
||||
|
||||
// XXX See if the frame is a placeholderFrame and if it is process
|
||||
// the floater.
|
||||
// the float.
|
||||
if (frameType) {
|
||||
if (nsLayoutAtoms::placeholderFrame == frameType.get()) {
|
||||
nsIFrame* outOfFlowFrame = ((nsPlaceholderFrame*)aFrame)->GetOutOfFlowFrame();
|
||||
|
@ -1072,18 +1072,19 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
|
||||
if (!display->IsAbsolutelyPositioned()) {
|
||||
if (eReflowReason_Incremental == reason) {
|
||||
InitFloater((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
InitFloat((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
}
|
||||
else {
|
||||
AddFloater((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
AddFloat((nsPlaceholderFrame*)aFrame, aReflowStatus);
|
||||
}
|
||||
nsIAtom* oofft;
|
||||
outOfFlowFrame->GetFrameType(&oofft);
|
||||
if (oofft) {
|
||||
if (oofft == nsLayoutAtoms::letterFrame) {
|
||||
SetFlag(LL_FIRSTLETTERSTYLEOK, PR_FALSE);
|
||||
// An incomplete reflow status means we should split the floater if the
|
||||
// height is constrained (bug 145305). We never split floating first letters.
|
||||
// An incomplete reflow status means we should split the
|
||||
// float if the height is constrained (bug 145305). We
|
||||
// never split floating first letters.
|
||||
if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus))
|
||||
aReflowStatus = NS_FRAME_COMPLETE;
|
||||
}
|
||||
|
@ -1417,9 +1418,9 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
|
||||
if (aNotSafeToBreak) {
|
||||
// There are no frames on the line or we are in the first word on
|
||||
// the line. If the line isn't impacted by a floater then the
|
||||
// the line. If the line isn't impacted by a float then the
|
||||
// current frame fits.
|
||||
if (!GetFlag(LL_IMPACTEDBYFLOATERS)) {
|
||||
if (!GetFlag(LL_IMPACTEDBYFLOATS)) {
|
||||
#ifdef NOISY_CAN_PLACE_FRAME
|
||||
printf(" ==> not-safe and not-impacted fits: ");
|
||||
while (nsnull != psd) {
|
||||
|
@ -1430,8 +1431,8 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (GetFlag(LL_LASTFLOATERWASLETTERFRAME)) {
|
||||
// Another special case: see if the floater is a letter
|
||||
else if (GetFlag(LL_LASTFLOATWASLETTERFRAME)) {
|
||||
// Another special case: see if the float is a letter
|
||||
// frame. If it is, then allow the frame next to it to fit.
|
||||
if (pfd->GetFlag(PFD_ISNONEMPTYTEXTFRAME)) {
|
||||
// This must be the first piece of non-empty text (because
|
||||
|
@ -1453,7 +1454,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
|
||||
if (pfd->GetFlag(PFD_ISSTICKY)) {
|
||||
#ifdef NOISY_CAN_PLACE_FRAME
|
||||
printf(" ==> last floater was letter frame && frame is sticky\n");
|
||||
printf(" ==> last float was letter frame && frame is sticky\n");
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1490,8 +1491,8 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
}
|
||||
|
||||
// Special check for span frames
|
||||
if (pfd->mSpan && pfd->mSpan->mContainsFloater) {
|
||||
// If the span either directly or indirectly contains a floater then
|
||||
if (pfd->mSpan && pfd->mSpan->mContainsFloat) {
|
||||
// If the span either directly or indirectly contains a float then
|
||||
// it fits. Why? It's kind of complicated, but here goes:
|
||||
//
|
||||
// 1. CanPlaceFrame is used for all frame placements on a line,
|
||||
|
@ -1500,19 +1501,19 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
// checks for room before proceeding (the code above here), the
|
||||
// only things on a line will be those things that "fit".
|
||||
//
|
||||
// 2. Before a floater is placed on a line, the line has to be empty
|
||||
// 2. Before a float is placed on a line, the line has to be empty
|
||||
// (otherwise its a "below current line" flaoter and will be placed
|
||||
// after the line).
|
||||
//
|
||||
// Therefore, if the span directly or indirectly has a floater
|
||||
// then it means that at the time of the placement of the floater
|
||||
// Therefore, if the span directly or indirectly has a float
|
||||
// then it means that at the time of the placement of the float
|
||||
// the line was empty. Because of #1, only the frames that fit can
|
||||
// be added after that point, therefore we can assume that the
|
||||
// current span being placed has fit.
|
||||
//
|
||||
// So how do we get here and have a span that should already fit
|
||||
// and yet doesn't: Simple: span's that have the no-wrap attribute
|
||||
// set on them and contain a floater and are placed where they
|
||||
// set on them and contain a float and are placed where they
|
||||
// don't naturally fit.
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -1565,8 +1566,8 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics)
|
|||
mTotalPlacedFrames++;
|
||||
if (psd->mX != psd->mLeftEdge || pfd->mBounds.x != psd->mLeftEdge) {
|
||||
// As soon as a frame placed on the line advances an X coordinate
|
||||
// of any span we can no longer place a floater on the line.
|
||||
SetFlag(LL_CANPLACEFLOATER, PR_FALSE);
|
||||
// of any span we can no longer place a float on the line.
|
||||
SetFlag(LL_CANPLACEFLOAT, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,14 +72,14 @@ public:
|
|||
|
||||
void BeginLineReflow(nscoord aX, nscoord aY,
|
||||
nscoord aWidth, nscoord aHeight,
|
||||
PRBool aImpactedByFloaters,
|
||||
PRBool aImpactedByFloats,
|
||||
PRBool aIsTopOfPage);
|
||||
|
||||
void EndLineReflow();
|
||||
|
||||
void UpdateBand(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
|
||||
PRBool aPlacedLeftFloater,
|
||||
nsIFrame* aFloaterFrame);
|
||||
PRBool aPlacedLeftFloat,
|
||||
nsIFrame* aFloatFrame);
|
||||
|
||||
nsresult BeginSpan(nsIFrame* aFrame,
|
||||
const nsHTMLReflowState* aSpanReflowState,
|
||||
|
@ -134,9 +134,9 @@ protected:
|
|||
#define LL_FIRSTLETTERSTYLEOK 0x00000008
|
||||
#define LL_ISTOPOFPAGE 0x00000010
|
||||
#define LL_UPDATEDBAND 0x00000020
|
||||
#define LL_IMPACTEDBYFLOATERS 0x00000040
|
||||
#define LL_LASTFLOATERWASLETTERFRAME 0x00000080
|
||||
#define LL_CANPLACEFLOATER 0x00000100
|
||||
#define LL_IMPACTEDBYFLOATS 0x00000040
|
||||
#define LL_LASTFLOATWASLETTERFRAME 0x00000080
|
||||
#define LL_CANPLACEFLOAT 0x00000100
|
||||
#define LL_LINEENDSINBR 0x00000200
|
||||
#define LL_LASTFLAG LL_LINEENDSINBR
|
||||
|
||||
|
@ -200,7 +200,7 @@ public:
|
|||
|
||||
nsIFrame* FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame);
|
||||
|
||||
PRBool CanPlaceFloaterNow() const;
|
||||
PRBool CanPlaceFloatNow() const;
|
||||
|
||||
PRBool LineIsEmpty() const;
|
||||
|
||||
|
@ -229,12 +229,12 @@ public:
|
|||
//----------------------------------------
|
||||
// Inform the line-layout about the presence of a floating frame
|
||||
// XXX get rid of this: use get-frame-type?
|
||||
void InitFloater(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->InitFloater(*this, aFrame, aReflowStatus);
|
||||
void InitFloat(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->InitFloat(*this, aFrame, aReflowStatus);
|
||||
}
|
||||
|
||||
void AddFloater(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->AddFloater(*this, aFrame, PR_FALSE, aReflowStatus);
|
||||
void AddFloat(nsPlaceholderFrame* aFrame, nsReflowStatus& aReflowStatus) {
|
||||
mBlockRS->AddFloat(*this, aFrame, PR_FALSE, aReflowStatus);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
@ -280,7 +280,7 @@ protected:
|
|||
PRPackedBool mComputeMaxElementWidth;
|
||||
PRUint8 mTextAlign;
|
||||
|
||||
PRUint8 mPlacedFloaters;
|
||||
PRUint8 mPlacedFloats;
|
||||
|
||||
// The amount of text indent that we applied to this line, needed for
|
||||
// max-element-size calculation.
|
||||
|
@ -406,7 +406,7 @@ protected:
|
|||
PRUint8 mDirection;
|
||||
PRPackedBool mChangedFrameDirection;
|
||||
PRPackedBool mZeroEffectiveSpanBox;
|
||||
PRPackedBool mContainsFloater;
|
||||
PRPackedBool mContainsFloat;
|
||||
|
||||
nscoord mLeftEdge;
|
||||
nscoord mX;
|
||||
|
|
|
@ -5759,7 +5759,7 @@ PresShell::Paint(nsIView *aView,
|
|||
rv = frame->Paint(mPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
rv = frame->Paint(mPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
rv = frame->Paint(mPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
|
@ -6073,7 +6073,7 @@ PresShell::HandleEvent(nsIView *aView,
|
|||
&mCurrentEventFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = frame->GetFrameForPoint(mPresContext, eventPoint,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS,
|
||||
NS_FRAME_PAINT_LAYER_FLOATS,
|
||||
&mCurrentEventFrame);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = frame->GetFrameForPoint(mPresContext, eventPoint,
|
||||
|
|
|
@ -3878,7 +3878,7 @@ nsTextFrame::GetChildFrameContainingOffset(PRInt32 inContentOffset,
|
|||
}
|
||||
}
|
||||
|
||||
if (inContentOffset < mContentOffset) //could happen with floaters!
|
||||
if (inContentOffset < mContentOffset) //could happen with floats!
|
||||
{
|
||||
result = GetPrevInFlow(outChildFrame);
|
||||
if (NS_SUCCEEDED(result) && *outChildFrame)
|
||||
|
|
|
@ -2403,7 +2403,7 @@ nsComboboxControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
nsAreaFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
|
|
|
@ -412,12 +412,12 @@ nsFormControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
return rv;
|
||||
|
||||
rv = nsLeafFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
// draw selection borders when appropriate
|
||||
rv = nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -445,7 +445,7 @@ nsFormControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsLeafFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS, aFrame);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS, aFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsLeafFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
|
|
|
@ -363,7 +363,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
|
||||
#if 0 // old way
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
#else // temporary
|
||||
|
@ -384,7 +384,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
aRenderingContext.SetClipRect(rect, nsClipCombine_kIntersect, clipEmpty);
|
||||
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
|
||||
aRenderingContext.PopState(clipEmpty);
|
||||
|
|
|
@ -1985,7 +1985,7 @@ nsTextControlFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (aWhichLayer == NS_FRAME_PAINT_LAYER_FOREGROUND) {
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_BACKGROUND);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATERS);
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FLOATS);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = nsStackFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, NS_FRAME_PAINT_LAYER_FOREGROUND);
|
||||
}
|
||||
|
@ -2006,7 +2006,7 @@ nsTextControlFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsStackFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS, aFrame);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS, aFrame);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return NS_OK;
|
||||
rv = nsStackFrame::GetFrameForPoint(aPresContext, aPoint,
|
||||
|
|
|
@ -745,13 +745,13 @@ public:
|
|||
nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock,
|
||||
nsIFrame* aFloatContainingBlock,
|
||||
nsILayoutHistoryState* aHistoryState);
|
||||
// Get the history state from the pres context's pres shell.
|
||||
nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock);
|
||||
nsIFrame* aFloatContainingBlock);
|
||||
|
||||
// Function to push the existing absolute containing block state and
|
||||
// create a new scope
|
||||
|
@ -759,9 +759,9 @@ public:
|
|||
nsIFrame* aNewAbsoluteContainingBlock,
|
||||
nsFrameConstructorSaveState& aSaveState);
|
||||
|
||||
// Function to push the existing floater containing block state and
|
||||
// Function to push the existing float containing block state and
|
||||
// create a new scope
|
||||
void PushFloaterContainingBlock(nsIFrame* aNewFloaterContainingBlock,
|
||||
void PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock,
|
||||
nsFrameConstructorSaveState& aSaveState,
|
||||
PRBool aFirstLetterStyle,
|
||||
PRBool aFirstLineStyle);
|
||||
|
@ -770,11 +770,11 @@ public:
|
|||
nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock,
|
||||
nsIFrame* aFloatContainingBlock,
|
||||
nsILayoutHistoryState* aHistoryState)
|
||||
: mFixedItems(aFixedContainingBlock),
|
||||
mAbsoluteItems(aAbsoluteContainingBlock),
|
||||
mFloatedItems(aFloaterContainingBlock),
|
||||
mFloatedItems(aFloatContainingBlock),
|
||||
mFirstLetterStyle(PR_FALSE),
|
||||
mFirstLineStyle(PR_FALSE),
|
||||
mFrameState(aHistoryState),
|
||||
|
@ -787,10 +787,10 @@ nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresCon
|
|||
nsFrameConstructorState::nsFrameConstructorState(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFixedContainingBlock,
|
||||
nsIFrame* aAbsoluteContainingBlock,
|
||||
nsIFrame* aFloaterContainingBlock)
|
||||
nsIFrame* aFloatContainingBlock)
|
||||
: mFixedItems(aFixedContainingBlock),
|
||||
mAbsoluteItems(aAbsoluteContainingBlock),
|
||||
mFloatedItems(aFloaterContainingBlock),
|
||||
mFloatedItems(aFloatContainingBlock),
|
||||
mFirstLetterStyle(PR_FALSE),
|
||||
mFirstLineStyle(PR_FALSE),
|
||||
mPseudoFrames()
|
||||
|
@ -836,7 +836,7 @@ nsFrameConstructorState::PushAbsoluteContainingBlock(nsIPresContext* aPresContex
|
|||
}
|
||||
|
||||
void
|
||||
nsFrameConstructorState::PushFloaterContainingBlock(nsIFrame* aNewFloaterContainingBlock,
|
||||
nsFrameConstructorState::PushFloatContainingBlock(nsIFrame* aNewFloatContainingBlock,
|
||||
nsFrameConstructorSaveState& aSaveState,
|
||||
PRBool aFirstLetterStyle,
|
||||
PRBool aFirstLineStyle)
|
||||
|
@ -847,7 +847,7 @@ nsFrameConstructorState::PushFloaterContainingBlock(nsIFrame* aNewFloaterContain
|
|||
aSaveState.mSavedItems = mFloatedItems;
|
||||
aSaveState.mSavedFirstLetterStyle = mFirstLetterStyle;
|
||||
aSaveState.mSavedFirstLineStyle = mFirstLineStyle;
|
||||
mFloatedItems = nsAbsoluteItems(aNewFloaterContainingBlock);
|
||||
mFloatedItems = nsAbsoluteItems(aNewFloatContainingBlock);
|
||||
mFirstLetterStyle = aFirstLetterStyle;
|
||||
mFirstLineStyle = aFirstLineStyle;
|
||||
}
|
||||
|
@ -896,12 +896,12 @@ GetRealFrame(nsIFrame* aFrame)
|
|||
// We may be a placeholder. If we are, go to the real frame.
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
|
||||
// See if it's a placeholder frame for a floater.
|
||||
// See if it's a placeholder frame for a float.
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
PRBool isPlaceholder = (nsLayoutAtoms::placeholderFrame == frameType.get());
|
||||
if (isPlaceholder) {
|
||||
// Get the out-of-flow frame that the placeholder points to.
|
||||
// This is the real floater that we should examine.
|
||||
// This is the real float that we should examine.
|
||||
result = NS_STATIC_CAST(nsPlaceholderFrame*,aFrame)->GetOutOfFlowFrame();
|
||||
NS_ASSERTION(result, "No out of flow frame found for placeholder!\n");
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
|
|||
if (outOfFlowFrame && outOfFlowFrame != aFrame) {
|
||||
|
||||
// Get the display data for the outOfFlowFrame so we can
|
||||
// figure out if it is a floater or absolutely positioned element.
|
||||
// figure out if it is a float or absolutely positioned element.
|
||||
|
||||
const nsStyleDisplay* display = outOfFlowFrame->GetStyleDisplay();
|
||||
|
||||
|
@ -974,7 +974,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
|
|||
return;
|
||||
}
|
||||
|
||||
// XXX_kin: Since we're only handling floaters at the moment,
|
||||
// XXX_kin: Since we're only handling floats at the moment,
|
||||
// XXX_kin: we don't need to cross block boundaries.
|
||||
|
||||
if (IsBlockFrame(aPresContext, aFrame))
|
||||
|
@ -991,7 +991,7 @@ AdjustOutOfFlowFrameParentPtrs(nsIPresContext* aPresContext,
|
|||
// XXX_kin: Once we add support for adjusting absolutely positioned
|
||||
// XXX_kin: frames, we will be crossing block boundaries, we/ll need
|
||||
// XXX_kin: to update aState's containingBlock info to avoid incorrectly
|
||||
// XXX_kin: reparenting floaters, etc.
|
||||
// XXX_kin: reparenting floats, etc.
|
||||
// XXX_kin:
|
||||
// XXX_kin: Do we need to prevent descent into anonymous content here?
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ GetChildListNameFor(nsIPresContext* aPresContext,
|
|||
} else {
|
||||
NS_ASSERTION(aChildFrame->GetStyleDisplay()->IsFloating(),
|
||||
"not a floated frame");
|
||||
listName = nsLayoutAtoms::floaterList;
|
||||
listName = nsLayoutAtoms::floatList;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2935,9 +2935,9 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresShell* aPresShe
|
|||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
|
||||
// The block frame is a floater container
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(aNewCellInnerFrame, floaterSaveState,
|
||||
// The block frame is a float container
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(aNewCellInnerFrame, floatSaveState,
|
||||
haveFirstLetterStyle, haveFirstLineStyle);
|
||||
|
||||
// Process the child content
|
||||
|
@ -2949,7 +2949,7 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresShell* aPresShe
|
|||
|
||||
aNewCellInnerFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewCellInnerFrame->SetInitialChildList(aPresContext, nsLayoutAtoms::floaterList,
|
||||
aNewCellInnerFrame->SetInitialChildList(aPresContext, nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -3495,7 +3495,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
if (!docElemIsTable) {
|
||||
// Process the child content
|
||||
nsFrameConstructorSaveState absoluteSaveState;
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
nsFrameItems childItems;
|
||||
|
||||
if (isBlockFrame) {
|
||||
|
@ -3503,7 +3503,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
HaveSpecialBlockStyle(aPresContext, aDocElement, styleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
aState.PushAbsoluteContainingBlock(aPresContext, contentFrame, absoluteSaveState);
|
||||
aState.PushFloaterContainingBlock(contentFrame, floaterSaveState,
|
||||
aState.PushFloatContainingBlock(contentFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
}
|
||||
|
@ -3531,7 +3531,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
contentFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -4301,12 +4301,12 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsIPresShell* aPresShell,
|
|||
aState.mFrameManager->RestoreFrameStateFor(scrollFrame, aState.mFrameState);
|
||||
}
|
||||
|
||||
// The area frame is a floater container
|
||||
// The area frame is a float container
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(scrolledFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(scrolledFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
|
||||
|
@ -4350,7 +4350,7 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsIPresShell* aPresShell,
|
|||
|
||||
if (aState.mFloatedItems.childList) {
|
||||
scrolledFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -4410,12 +4410,12 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
|
|||
|
||||
|
||||
|
||||
// The area frame is a floater container
|
||||
// The area frame is a float container
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(areaFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(areaFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
|
||||
|
@ -4471,7 +4471,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
|
|||
|
||||
if (aState.mFloatedItems.childList) {
|
||||
areaFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -4552,7 +4552,7 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
|
|||
nsIFrame* newFrame = nsnull; // the frame we construct
|
||||
PRBool isReplaced = PR_FALSE;
|
||||
PRBool addToHashTable = PR_TRUE;
|
||||
PRBool isFloaterContainer = PR_FALSE;
|
||||
PRBool isFloatContainer = PR_FALSE;
|
||||
PRBool isPositionedContainingBlock = PR_FALSE;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -4848,24 +4848,24 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
|
|||
aState.mAbsoluteItems.childList);
|
||||
}
|
||||
}
|
||||
else if (isFloaterContainer) {
|
||||
// If the frame can contain floaters, then push a floater
|
||||
else if (isFloatContainer) {
|
||||
// If the frame can contain floats, then push a float
|
||||
// containing block
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(newFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(newFrame, floatSaveState,
|
||||
PR_FALSE, PR_FALSE);
|
||||
|
||||
// Process the child frames
|
||||
rv = ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame,
|
||||
PR_TRUE, childItems, PR_FALSE);
|
||||
|
||||
// Set the frame's floater list if there were any floated children
|
||||
// Set the frame's float list if there were any floated children
|
||||
if (aState.mFloatedItems.childList) {
|
||||
newFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -6188,12 +6188,12 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
|
||||
//-----
|
||||
|
||||
// The area frame is a floater container
|
||||
// The area frame is a float container
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
HaveSpecialBlockStyle(aPresContext, aContent, aStyleContext,
|
||||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(scrolledFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(scrolledFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
|
||||
|
@ -6228,7 +6228,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
|
||||
if (aState.mFloatedItems.childList) {
|
||||
scrolledFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
///------
|
||||
|
@ -6262,7 +6262,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
// Process the child content. The area frame becomes a container for child
|
||||
// frames that are absolutely positioned
|
||||
nsFrameConstructorSaveState absoluteSaveState;
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
nsFrameItems childItems;
|
||||
|
||||
PRBool haveFirstLetterStyle = PR_FALSE, haveFirstLineStyle = PR_FALSE;
|
||||
|
@ -6271,7 +6271,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
&haveFirstLetterStyle, &haveFirstLineStyle);
|
||||
}
|
||||
aState.PushAbsoluteContainingBlock(aPresContext, newFrame, absoluteSaveState);
|
||||
aState.PushFloaterContainingBlock(newFrame, floaterSaveState,
|
||||
aState.PushFloatContainingBlock(newFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE,
|
||||
|
@ -6290,7 +6290,7 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
newFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -7505,7 +7505,7 @@ nsCSSFrameConstructor::GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsIFrame*
|
||||
nsCSSFrameConstructor::GetFloaterContainingBlock(nsIPresContext* aPresContext,
|
||||
nsCSSFrameConstructor::GetFloatContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
NS_PRECONDITION(mInitialContainingBlock, "no initial containing block");
|
||||
|
@ -8257,7 +8257,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
nsFrameItems frameItems;
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, parentFrame),
|
||||
GetFloaterContainingBlock(aPresContext, parentFrame));
|
||||
GetFloatContainingBlock(aPresContext, parentFrame));
|
||||
|
||||
// See if the containing block has :first-letter style applied.
|
||||
PRBool haveFirstLetterStyle, haveFirstLineStyle;
|
||||
|
@ -8416,7 +8416,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
// determine where in the list they should be inserted...
|
||||
if (state.mFloatedItems.childList) {
|
||||
state.mFloatedItems.containingBlock->AppendFrames(aPresContext, *shell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -8922,7 +8922,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
nsFrameItems frameItems;
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, parentFrame),
|
||||
GetFloaterContainingBlock(aPresContext, parentFrame),
|
||||
GetFloatContainingBlock(aPresContext, parentFrame),
|
||||
aFrameState);
|
||||
|
||||
// Recover state for the containing block - we need to know if
|
||||
|
@ -9104,7 +9104,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext,
|
|||
// determine where in the list they should be inserted...
|
||||
if (state.mFloatedItems.childList) {
|
||||
state.mFloatedItems.containingBlock->AppendFrames(aPresContext, *shell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
|
||||
|
@ -9477,7 +9477,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
// Examine the containing-block for the removed content and see if
|
||||
// :first-letter style applies.
|
||||
nsIFrame* containingBlock =
|
||||
GetFloaterContainingBlock(aPresContext, parentFrame);
|
||||
GetFloatContainingBlock(aPresContext, parentFrame);
|
||||
nsStyleContext* blockSC = containingBlock->GetStyleContext();
|
||||
nsIContent* blockContent = containingBlock->GetContent();
|
||||
PRBool haveFLS = HaveFirstLetterStyle(aPresContext, blockContent, blockSC);
|
||||
|
@ -9594,11 +9594,11 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
|
||||
// XXX has to be done first for now: the blocks line list
|
||||
// contains an array of pointers to the placeholder - we have to
|
||||
// remove the floater first (which gets rid of the lines
|
||||
// reference to the placeholder and floater) and then remove the
|
||||
// remove the float first (which gets rid of the lines
|
||||
// reference to the placeholder and float) and then remove the
|
||||
// placeholder
|
||||
rv = frameManager->RemoveFrame(parentFrame,
|
||||
nsLayoutAtoms::floaterList, childFrame);
|
||||
nsLayoutAtoms::floatList, childFrame);
|
||||
|
||||
// Remove the placeholder frame first (XXX second for now) (so
|
||||
// that it doesn't retain a dangling pointer to memory)
|
||||
|
@ -9653,8 +9653,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext,
|
|||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext,
|
||||
parentFrame),
|
||||
GetFloaterContainingBlock(aPresContext,
|
||||
parentFrame));
|
||||
GetFloatContainingBlock(aPresContext,
|
||||
parentFrame));
|
||||
RecoverLetterFrames(shell, aPresContext, state, containingBlock);
|
||||
}
|
||||
|
||||
|
@ -9939,7 +9939,7 @@ nsCSSFrameConstructor::ContentChanged(nsIPresContext* aPresContext,
|
|||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(aContent));
|
||||
if (textContent) {
|
||||
// Ok, it's text content. Now do some real work...
|
||||
nsIFrame* block = GetFloaterContainingBlock(aPresContext, frame);
|
||||
nsIFrame* block = GetFloatContainingBlock(aPresContext, frame);
|
||||
if (block) {
|
||||
// See if the block has first-letter style applied to it.
|
||||
nsIContent* blockContent = block->GetContent();
|
||||
|
@ -10592,7 +10592,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
// new frame
|
||||
frameManager->RegisterPlaceholderFrame(placeholderFrame);
|
||||
|
||||
// XXX Work around a bug in the block code where the floater won't get
|
||||
// XXX Work around a bug in the block code where the float won't get
|
||||
// reflowed unless the line containing the placeholder frame is reflowed...
|
||||
placeholderFrame->GetParent()->
|
||||
ReflowDirtyChild(aPresShell, placeholderFrame);
|
||||
|
@ -10605,34 +10605,34 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
// It's an OBJECT, EMBED, or APPLET, so we should display the contents
|
||||
// instead
|
||||
nsIFrame* absoluteContainingBlock;
|
||||
nsIFrame* floaterContainingBlock;
|
||||
nsIFrame* floatContainingBlock;
|
||||
nsIFrame* inFlowParent = parentFrame;
|
||||
|
||||
// If the OBJECT frame is out-of-flow, then get the placeholder frame's
|
||||
// parent and use that when determining the absolute containing block and
|
||||
// floater containing block
|
||||
// float containing block
|
||||
if (placeholderFrame) {
|
||||
inFlowParent = placeholderFrame->GetParent();
|
||||
}
|
||||
|
||||
absoluteContainingBlock = GetAbsoluteContainingBlock(aPresContext, inFlowParent);
|
||||
floaterContainingBlock = GetFloaterContainingBlock(aPresContext, inFlowParent);
|
||||
floatContainingBlock = GetFloatContainingBlock(aPresContext, inFlowParent);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
// Verify that we calculated the same containing block
|
||||
if (listName.get() == nsLayoutAtoms::absoluteList) {
|
||||
NS_ASSERTION(absoluteContainingBlock == parentFrame,
|
||||
"wrong absolute containing block");
|
||||
} else if (listName.get() == nsLayoutAtoms::floaterList) {
|
||||
NS_ASSERTION(floaterContainingBlock == parentFrame,
|
||||
"wrong floater containing block");
|
||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
||||
NS_ASSERTION(floatContainingBlock == parentFrame,
|
||||
"wrong float containing block");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Now initialize the frame construction state
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
absoluteContainingBlock,
|
||||
floaterContainingBlock);
|
||||
floatContainingBlock);
|
||||
nsFrameItems frameItems;
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
|
||||
|
@ -10707,7 +10707,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
} else if (listName.get() == nsLayoutAtoms::fixedList) {
|
||||
newFrame = state.mFixedItems.childList;
|
||||
state.mFixedItems.childList = nsnull;
|
||||
} else if (listName.get() == nsLayoutAtoms::floaterList) {
|
||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
||||
newFrame = state.mFloatedItems.childList;
|
||||
state.mFloatedItems.childList = nsnull;
|
||||
}
|
||||
|
@ -10746,7 +10746,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||
if (state.mFloatedItems.childList) {
|
||||
rv = state.mFloatedItems.containingBlock->AppendFrames(aPresContext,
|
||||
*presShell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -10826,7 +10826,7 @@ nsCSSFrameConstructor::CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
|
|||
// XXX Deal with absolute and fixed frames...
|
||||
if (state.mFloatedItems.childList) {
|
||||
captionFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
newChildFrames.AddChild(captionFrame);
|
||||
|
@ -12486,19 +12486,19 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
nsIFrame* aBlockFrame,
|
||||
PRBool* aStopLooking)
|
||||
{
|
||||
// First look for the floater frame that is a letter frame
|
||||
nsIFrame* floater;
|
||||
aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floaterList, &floater);
|
||||
while (floater) {
|
||||
// First look for the float frame that is a letter frame
|
||||
nsIFrame* floatFrame;
|
||||
aBlockFrame->FirstChild(aPresContext, nsLayoutAtoms::floatList, &floatFrame);
|
||||
while (floatFrame) {
|
||||
// See if we found a floating letter frame
|
||||
nsCOMPtr<nsIAtom> frameType;
|
||||
floater->GetFrameType(getter_AddRefs(frameType));
|
||||
floatFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (nsLayoutAtoms::letterFrame == frameType.get()) {
|
||||
break;
|
||||
}
|
||||
floater = floater->GetNextSibling();
|
||||
floatFrame = floatFrame->GetNextSibling();
|
||||
}
|
||||
if (!floater) {
|
||||
if (!floatFrame) {
|
||||
// No such frame
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12506,7 +12506,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// Take the text frame away from the letter frame (so it isn't
|
||||
// destroyed when we destroy the letter frame).
|
||||
nsIFrame* textFrame;
|
||||
floater->FirstChild(aPresContext, nsnull, &textFrame);
|
||||
floatFrame->FirstChild(aPresContext, nsnull, &textFrame);
|
||||
if (!textFrame) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12514,7 +12514,8 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// Discover the placeholder frame for the letter frame
|
||||
nsIFrame* parentFrame;
|
||||
nsPlaceholderFrame* placeholderFrame;
|
||||
aFrameManager->GetPlaceholderFrameFor(floater, (nsIFrame**)&placeholderFrame);
|
||||
aFrameManager->GetPlaceholderFrameFor(floatFrame,
|
||||
(nsIFrame**)&placeholderFrame);
|
||||
if (!placeholderFrame) {
|
||||
// Somethings really wrong
|
||||
return NS_OK;
|
||||
|
@ -12581,10 +12582,10 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// and skip this call?
|
||||
aFrameManager->UnregisterPlaceholderFrame(placeholderFrame);
|
||||
|
||||
// Remove the floater frame
|
||||
DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, floater);
|
||||
aFrameManager->RemoveFrame(aBlockFrame, nsLayoutAtoms::floaterList,
|
||||
floater);
|
||||
// Remove the float frame
|
||||
DeletingFrameSubtree(aPresContext, aPresShell, aFrameManager, floatFrame);
|
||||
aFrameManager->RemoveFrame(aBlockFrame, nsLayoutAtoms::floatList,
|
||||
floatFrame);
|
||||
|
||||
// Remove placeholder frame
|
||||
aFrameManager->RemoveFrame(parentFrame, nsnull, placeholderFrame);
|
||||
|
@ -12713,10 +12714,10 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont
|
|||
parentFrame->InsertFrames(aPresContext, *aState.mPresShell.get(),
|
||||
nsnull, prevFrame, letterFrames.childList);
|
||||
|
||||
// Insert in floaters too if needed
|
||||
// Insert in floats too if needed
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aBlockFrame->AppendFrames(aPresContext, *aState.mPresShell.get(),
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -12747,7 +12748,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
|
|||
nsFrameItems frameItems;
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, aParentFrame),
|
||||
GetFloaterContainingBlock(aPresContext, aParentFrame),
|
||||
GetFloatContainingBlock(aPresContext, aParentFrame),
|
||||
mTempFrameTreeState);
|
||||
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
|
@ -12810,7 +12811,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
|
|||
// determine where in the list they should be inserted...
|
||||
if (state.mFloatedItems.childList) {
|
||||
rv = state.mFloatedItems.containingBlock->AppendFrames(aPresContext, *shell,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
state.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -12846,7 +12847,7 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||
|
||||
// If we're the first block to be created (e.g., because we're
|
||||
// contained inside a XUL document), then make sure that we've got a
|
||||
// space manager so we can handle floaters...
|
||||
// space manager so we can handle floats...
|
||||
if (! aState.mFloatedItems.containingBlock) {
|
||||
aNewFrame->AddStateBits(NS_BLOCK_SPACE_MGR | NS_BLOCK_MARGIN_ROOT);
|
||||
}
|
||||
|
@ -12865,8 +12866,8 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||
|
||||
// Process the child content
|
||||
nsFrameItems childItems;
|
||||
nsFrameConstructorSaveState floaterSaveState;
|
||||
aState.PushFloaterContainingBlock(aNewFrame, floaterSaveState,
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
aState.PushFloatContainingBlock(aNewFrame, floatSaveState,
|
||||
haveFirstLetterStyle,
|
||||
haveFirstLineStyle);
|
||||
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
|
||||
|
@ -12880,10 +12881,10 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||
// Set the frame's initial child list
|
||||
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||
|
||||
// Set the frame's floater list if there were any floated children
|
||||
// Set the frame's float list if there were any floated children
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
// and the same for absolutely positioned children.
|
||||
|
@ -12961,7 +12962,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -13014,7 +13015,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
}
|
||||
if (aState.mFloatedItems.childList) {
|
||||
aNewFrame->SetInitialChildList(aPresContext,
|
||||
nsLayoutAtoms::floaterList,
|
||||
nsLayoutAtoms::floatList,
|
||||
aState.mFloatedItems.childList);
|
||||
}
|
||||
}
|
||||
|
@ -13055,7 +13056,7 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
|
||||
nsFrameConstructorState state(aPresContext, mFixedContainingBlock,
|
||||
GetAbsoluteContainingBlock(aPresContext, blockFrame),
|
||||
GetFloaterContainingBlock(aPresContext, blockFrame));
|
||||
GetFloatContainingBlock(aPresContext, blockFrame));
|
||||
|
||||
MoveChildrenTo(aPresContext, blockSC, blockFrame, list2, &state);
|
||||
|
||||
|
@ -13640,9 +13641,9 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIPresContext* aPresContext, nsIF
|
|||
// wraps some of its content in an anonymous block; see
|
||||
// ConstructInline)
|
||||
|
||||
// NOTE: We used to get the FloaterContainingBlock here, but it was often wrong.
|
||||
// NOTE: We used to get the FloatContainingBlock here, but it was often wrong.
|
||||
// GetIBContainingBlock works much better and provides the correct container in all cases
|
||||
// so GetFloaterContainingBlock(aPresContext, aFrame) has been removed
|
||||
// so GetFloatContainingBlock(aPresContext, aFrame) has been removed
|
||||
|
||||
// And get the containingBlock's content
|
||||
nsCOMPtr<nsIContent> blockContent = containingBlock->GetContent();
|
||||
|
|
|
@ -658,8 +658,8 @@ protected:
|
|||
nsIFrame* GetAbsoluteContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
nsIFrame* GetFloaterContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
nsIFrame* GetFloatContainingBlock(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame);
|
||||
|
||||
|
||||
// Build a scroll frame:
|
||||
|
|
|
@ -1917,8 +1917,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
aDesiredSize.width = mRect.width;
|
||||
aDesiredSize.height = mRect.height;
|
||||
|
||||
// for floaters, our view has not been positioned yet as we have not been placed
|
||||
// - the block code will position our views after the floater is placed
|
||||
// for floats, our view has not been positioned yet as we have not been placed
|
||||
// - the block code will position our views after the float is placed
|
||||
if (aOuterRS.mStyleDisplay &&
|
||||
!aOuterRS.mStyleDisplay->IsFloating()) {
|
||||
// We know our view (if we have one) has been positioned
|
||||
|
|
|
@ -458,7 +458,7 @@ nsSVGForeignObjectFrame::Paint(nsSVGRenderingContext* renderingContext)
|
|||
nsSVGForeignObjectFrameBase::Paint(renderingContext->GetPresContext(),
|
||||
*ctx,
|
||||
dirtyRect,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS,
|
||||
NS_FRAME_PAINT_LAYER_FLOATS,
|
||||
0);
|
||||
|
||||
nsSVGForeignObjectFrameBase::Paint(renderingContext->GetPresContext(),
|
||||
|
@ -515,7 +515,7 @@ nsSVGForeignObjectFrame::GetFrameForPoint(float x, float y, nsIFrame** hit)
|
|||
if (NS_SUCCEEDED(rv) && *hit) return rv;
|
||||
|
||||
rv = nsSVGForeignObjectFrameBase::GetFrameForPoint(presContext, p,
|
||||
NS_FRAME_PAINT_LAYER_FLOATERS, hit);
|
||||
NS_FRAME_PAINT_LAYER_FLOATS, hit);
|
||||
if (NS_SUCCEEDED(rv) && *hit) return rv;
|
||||
|
||||
return nsSVGForeignObjectFrameBase::GetFrameForPoint(presContext, p,
|
||||
|
|
|
@ -1917,8 +1917,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
|
|||
aDesiredSize.width = mRect.width;
|
||||
aDesiredSize.height = mRect.height;
|
||||
|
||||
// for floaters, our view has not been positioned yet as we have not been placed
|
||||
// - the block code will position our views after the floater is placed
|
||||
// for floats, our view has not been positioned yet as we have not been placed
|
||||
// - the block code will position our views after the float is placed
|
||||
if (aOuterRS.mStyleDisplay &&
|
||||
!aOuterRS.mStyleDisplay->IsFloating()) {
|
||||
// We know our view (if we have one) has been positioned
|
||||
|
|
|
@ -1762,7 +1762,7 @@ NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRU
|
|||
// if this is a floating view, it isn't covered by any widgets other than
|
||||
// its children. In that case we walk up to its parent widget and use
|
||||
// that as the root to update from. This also means we update areas that
|
||||
// may be outside the parent view(s), which is necessary for floaters.
|
||||
// may be outside the parent view(s), which is necessary for floats.
|
||||
if (view->GetFloating()) {
|
||||
nsView* widgetParent = view;
|
||||
|
||||
|
@ -2179,15 +2179,15 @@ void nsViewManager::BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool
|
|||
ComputePlaceholderContainment(displayRoot);
|
||||
|
||||
// Create the Z-ordered view tree
|
||||
PRBool paintFloaters;
|
||||
PRBool paintFloats;
|
||||
if (aEventProcessing) {
|
||||
paintFloaters = PR_TRUE;
|
||||
paintFloats = PR_TRUE;
|
||||
} else {
|
||||
paintFloaters = displayRoot->GetFloating();
|
||||
paintFloats = displayRoot->GetFloating();
|
||||
}
|
||||
CreateDisplayList(displayRoot, PR_FALSE, zTree, PR_FALSE, origin.x, origin.y,
|
||||
aView, &aRect, nsnull, displayRootOrigin.x, displayRootOrigin.y,
|
||||
paintFloaters, aEventProcessing);
|
||||
paintFloats, aEventProcessing);
|
||||
|
||||
// Reparent any views that need reparenting in the Z-order tree
|
||||
ReparentViews(zTree);
|
||||
|
@ -3377,7 +3377,7 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView, PRBool aReparentedViewsPr
|
|||
DisplayZTreeNode* &aResult, PRBool aInsideRealView,
|
||||
nscoord aOriginX, nscoord aOriginY, nsView *aRealView,
|
||||
const nsRect *aDamageRect, nsView *aTopView,
|
||||
nscoord aX, nscoord aY, PRBool aPaintFloaters,
|
||||
nscoord aX, nscoord aY, PRBool aPaintFloats,
|
||||
PRBool aEventProcessing)
|
||||
{
|
||||
PRBool retval = PR_FALSE;
|
||||
|
@ -3455,9 +3455,9 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView, PRBool aReparentedViewsPr
|
|||
|
||||
// Don't paint floating views unless the root view being painted is a floating view.
|
||||
// This is important because we may be asked to paint
|
||||
// a window that's behind a transient floater; in this case we must paint the real window
|
||||
// contents, not the floater contents (bug 63496)
|
||||
if (!aPaintFloaters && aView->GetFloating()) {
|
||||
// a window that's behind a transient float; in this case we must paint the real window
|
||||
// contents, not the float contents (bug 63496)
|
||||
if (!aPaintFloats && aView->GetFloating()) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -3494,7 +3494,7 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView, PRBool aReparentedViewsPr
|
|||
DisplayZTreeNode* createdNode;
|
||||
retval = CreateDisplayList(childView, aReparentedViewsPresent, createdNode,
|
||||
aInsideRealView,
|
||||
aOriginX, aOriginY, aRealView, aDamageRect, aTopView, pos.x, pos.y, aPaintFloaters,
|
||||
aOriginX, aOriginY, aRealView, aDamageRect, aTopView, pos.x, pos.y, aPaintFloats,
|
||||
aEventProcessing);
|
||||
if (createdNode != nsnull) {
|
||||
EnsureZTreeNodeCreated(aView, aResult);
|
||||
|
|
|
@ -276,7 +276,7 @@ private:
|
|||
nscoord aOriginX, nscoord aOriginY,
|
||||
PRBool aInsideRealView, nsView *aRealView, const nsRect *aDamageRect,
|
||||
nsView *aTopView, nscoord aX, nscoord aY,
|
||||
PRBool aPaintFloaters, PRBool aEventProcessing);
|
||||
PRBool aPaintFloats, PRBool aEventProcessing);
|
||||
PRBool AddToDisplayList(nsView *aView,
|
||||
DisplayZTreeNode* &aParent, nsRect &aClipRect,
|
||||
nsRect& aDirtyRect, PRUint32 aFlags, nscoord aAbsX, nscoord aAbsY,
|
||||
|
|
Загрузка…
Ссылка в новой задаче