зеркало из https://github.com/mozilla/gecko-dev.git
Bug 480979 part 7. Create a FrameConstructionItemList class so we can abstract away item lists and change the implementation as needed. r+sr=roc
This commit is contained in:
Родитель
53d54e4acc
Коммит
26f646c20e
|
@ -423,19 +423,6 @@ AnyKidsNeedBlockParent(nsIFrame *aFrameList)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
PRBool
|
|
||||||
nsCSSFrameConstructor::AnyItemsNeedBlockParent(const nsTArray<FrameConstructionItem>& aItems)
|
|
||||||
{
|
|
||||||
for (PRUint32 i = 0, count = aItems.Length(); i < count; ++i) {
|
|
||||||
if (aItems[i].mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) {
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reparent a frame into a wrapper frame that is a child of its old parent.
|
// Reparent a frame into a wrapper frame that is a child of its old parent.
|
||||||
static void
|
static void
|
||||||
ReparentFrame(nsFrameManager* aFrameManager,
|
ReparentFrame(nsFrameManager* aFrameManager,
|
||||||
|
@ -2126,7 +2113,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
||||||
nsIContent* aParentContent,
|
nsIContent* aParentContent,
|
||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
nsIAtom* aPseudoElement,
|
nsIAtom* aPseudoElement,
|
||||||
nsTArray<FrameConstructionItem>& aItems)
|
FrameConstructionItemList& aItems)
|
||||||
{
|
{
|
||||||
// XXXbz is this ever true?
|
// XXXbz is this ever true?
|
||||||
if (!aParentContent->IsNodeOfType(nsINode::eELEMENT))
|
if (!aParentContent->IsNodeOfType(nsINode::eELEMENT))
|
||||||
|
@ -6438,7 +6425,7 @@ nsCSSFrameConstructor::ConstructSVGForeignObjectFrame(nsFrameConstructorState& a
|
||||||
void
|
void
|
||||||
nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
|
nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
|
||||||
nsStyleContext* aMainStyleContext,
|
nsStyleContext* aMainStyleContext,
|
||||||
nsTArray<FrameConstructionItem>& aItems)
|
FrameConstructionItemList& aItems)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsStyleContext> pseudoStyle;
|
nsRefPtr<nsStyleContext> pseudoStyle;
|
||||||
// Use the same parent style context that |aMainStyleContext| has, since
|
// Use the same parent style context that |aMainStyleContext| has, since
|
||||||
|
@ -6453,7 +6440,7 @@ nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
|
||||||
NS_ASSERTION(pseudoStyle->GetStyleDisplay()->mDisplay ==
|
NS_ASSERTION(pseudoStyle->GetStyleDisplay()->mDisplay ==
|
||||||
NS_STYLE_DISPLAY_BLOCK, "Unexpected display");
|
NS_STYLE_DISPLAY_BLOCK, "Unexpected display");
|
||||||
|
|
||||||
FrameConstructionItem* item = aItems.AppendElement();
|
FrameConstructionItem* item = aItems.AppendItem();
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6483,12 +6470,12 @@ nsCSSFrameConstructor::ConstructFrame(nsFrameConstructorState& aState,
|
||||||
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(nsnull != aParentFrame, "no parent frame");
|
NS_PRECONDITION(nsnull != aParentFrame, "no parent frame");
|
||||||
nsAutoTArray<FrameConstructionItem, 1> items;
|
FrameConstructionItemList items;
|
||||||
AddFrameConstructionItems(aState, aContent, aParentFrame, items);
|
AddFrameConstructionItems(aState, aContent, aParentFrame, items);
|
||||||
|
|
||||||
for (PRUint32 i = 0; i < items.Length(); ++i) {
|
for (FCItemIterator iter(items); !iter.IsDone(); iter.Next()) {
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
ConstructFramesFromItem(aState, items[i], aParentFrame, aFrameItems);
|
ConstructFramesFromItem(aState, iter, aParentFrame, aFrameItems);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6499,7 +6486,7 @@ void
|
||||||
nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState,
|
nsCSSFrameConstructor::AddFrameConstructionItems(nsFrameConstructorState& aState,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsTArray<FrameConstructionItem>& aItems)
|
FrameConstructionItemList& aItems)
|
||||||
{
|
{
|
||||||
// don't create a whitespace frame if aParent doesn't want it
|
// don't create a whitespace frame if aParent doesn't want it
|
||||||
if (!NeedFrameFor(aParentFrame, aContent)) {
|
if (!NeedFrameFor(aParentFrame, aContent)) {
|
||||||
|
@ -6530,7 +6517,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||||
PRInt32 aNameSpaceID,
|
PRInt32 aNameSpaceID,
|
||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsTArray<FrameConstructionItem>& aItems)
|
FrameConstructionItemList& aItems)
|
||||||
{
|
{
|
||||||
// The following code allows the user to specify the base tag
|
// The following code allows the user to specify the base tag
|
||||||
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.)
|
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.)
|
||||||
|
@ -6665,7 +6652,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||||
|
|
||||||
PRBool isGeneratedContent = ((aFlags & ITEM_IS_GENERATED_CONTENT) != 0);
|
PRBool isGeneratedContent = ((aFlags & ITEM_IS_GENERATED_CONTENT) != 0);
|
||||||
|
|
||||||
FrameConstructionItem* item = aItems.AppendElement();
|
FrameConstructionItem* item = aItems.AppendItem();
|
||||||
if (!item) {
|
if (!item) {
|
||||||
if (isGeneratedContent) {
|
if (isGeneratedContent) {
|
||||||
aContent->UnbindFromTree();
|
aContent->UnbindFromTree();
|
||||||
|
@ -6725,6 +6712,14 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||||
// Popups that are certainly out of flow.
|
// Popups that are certainly out of flow.
|
||||||
isPopup;
|
isPopup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item->mIsAllInline) {
|
||||||
|
aItems.InlineItemAdded();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bits & FCDATA_IS_LINE_PARTICIPANT) {
|
||||||
|
aItems.LineParticipantItemAdded();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DestroyContent(void *aObject,
|
static void DestroyContent(void *aObject,
|
||||||
|
@ -7519,7 +7514,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
||||||
state.mFrameManager, containingBlock);
|
state.mFrameManager, containingBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoTArray<FrameConstructionItem, 16> items;
|
FrameConstructionItemList items;
|
||||||
for (PRUint32 i = aNewIndexInContainer, count = aContainer->GetChildCount();
|
for (PRUint32 i = aNewIndexInContainer, count = aContainer->GetChildCount();
|
||||||
i < count;
|
i < count;
|
||||||
++i) {
|
++i) {
|
||||||
|
@ -7541,9 +7536,9 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
|
||||||
nsFrameItems frameItems;
|
nsFrameItems frameItems;
|
||||||
nsFrameItems captionItems;
|
nsFrameItems captionItems;
|
||||||
|
|
||||||
for (PRUint32 i = 0, count = items.Length(); i < count; i++) {
|
for (FCItemIterator iter(items); !iter.IsDone(); iter.Next()) {
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
ConstructFramesFromItem(state, items[i], parentFrame, frameItems);
|
ConstructFramesFromItem(state, iter, parentFrame, frameItems);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -7944,7 +7939,7 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoTArray<FrameConstructionItem, 1> items;
|
FrameConstructionItemList items;
|
||||||
AddFrameConstructionItems(state, aChild, parentFrame, items);
|
AddFrameConstructionItems(state, aChild, parentFrame, items);
|
||||||
|
|
||||||
// Perform special check for diddling around with the frames in
|
// Perform special check for diddling around with the frames in
|
||||||
|
@ -7960,8 +7955,8 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
|
||||||
// put in the outer table frame's additional child list.
|
// put in the outer table frame's additional child list.
|
||||||
|
|
||||||
nsFrameItems frameItems, captionItems;
|
nsFrameItems frameItems, captionItems;
|
||||||
for (PRUint32 i = 0; i < items.Length(); ++i) {
|
for (FCItemIterator iter(items); !iter.IsDone(); iter.Next()) {
|
||||||
ConstructFramesFromItem(state, items[i], parentFrame, frameItems);
|
ConstructFramesFromItem(state, iter, parentFrame, frameItems);
|
||||||
}
|
}
|
||||||
if (frameItems.childList) {
|
if (frameItems.childList) {
|
||||||
InvalidateCanvasIfNeeded(frameItems.childList);
|
InvalidateCanvasIfNeeded(frameItems.childList);
|
||||||
|
@ -10288,23 +10283,18 @@ nsCSSFrameConstructor::ShouldHaveSpecialBlockStyle(nsIContent* aContent,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsCSSFrameConstructor::ConstructFramesFromItemSublist(nsFrameConstructorState& aState,
|
nsCSSFrameConstructor::ConstructFramesFromItemList(nsFrameConstructorState& aState,
|
||||||
nsTArray<FrameConstructionItem>& aItems,
|
FrameConstructionItemList& aItems,
|
||||||
PRUint32 aStart,
|
nsIFrame* aParentFrame,
|
||||||
PRUint32 aEnd,
|
nsFrameItems& aFrameItems)
|
||||||
nsIFrame* aParentFrame,
|
|
||||||
nsFrameItems& aFrameItems)
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aStart <= aEnd, "Bogus start or end");
|
|
||||||
NS_PRECONDITION(aEnd <= aItems.Length(), "Bogus end");
|
|
||||||
|
|
||||||
// save the incoming pseudo frame state
|
// save the incoming pseudo frame state
|
||||||
nsPseudoFrames priorPseudoFrames;
|
nsPseudoFrames priorPseudoFrames;
|
||||||
aState.mPseudoFrames.Reset(&priorPseudoFrames);
|
aState.mPseudoFrames.Reset(&priorPseudoFrames);
|
||||||
|
|
||||||
for (PRUint32 i = aStart; i < aEnd; ++i) {
|
for (FCItemIterator iter(aItems); !iter.IsDone(); iter.Next()) {
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
ConstructFramesFromItem(aState, aItems[i], aParentFrame, aFrameItems);
|
ConstructFramesFromItem(aState, iter, aParentFrame, aFrameItems);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10362,7 +10352,7 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
|
||||||
aState.PushFloatContainingBlock(aFrame, floatSaveState);
|
aState.PushFloatContainingBlock(aFrame, floatSaveState);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoTArray<FrameConstructionItem, 16> itemsToConstruct;
|
FrameConstructionItemList itemsToConstruct;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (aFrame == mRootElementFrame) {
|
if (aFrame == mRootElementFrame) {
|
||||||
|
@ -10433,9 +10423,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = ConstructFramesFromItemSublist(aState, itemsToConstruct, 0,
|
rv = ConstructFramesFromItemList(aState, itemsToConstruct, aFrame,
|
||||||
itemsToConstruct.Length(), aFrame,
|
aFrameItems);
|
||||||
aFrameItems);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
NS_ASSERTION(!aAllowBlockStyles || !aFrame->IsBoxFrame(),
|
NS_ASSERTION(!aAllowBlockStyles || !aFrame->IsBoxFrame(),
|
||||||
|
@ -11448,18 +11437,12 @@ nsCSSFrameConstructor::CreateListBoxContent(nsPresContext* aPresContext,
|
||||||
|
|
||||||
BeginUpdate();
|
BeginUpdate();
|
||||||
|
|
||||||
nsAutoTArray<FrameConstructionItem, 1> items;
|
FrameConstructionItemList items;
|
||||||
AddFrameConstructionItemsInternal(state, aChild, aParentFrame,
|
AddFrameConstructionItemsInternal(state, aChild, aParentFrame,
|
||||||
aChild->Tag(), aChild->GetNameSpaceID(),
|
aChild->Tag(), aChild->GetNameSpaceID(),
|
||||||
styleContext, ITEM_ALLOW_XBL_BASE,
|
styleContext, ITEM_ALLOW_XBL_BASE,
|
||||||
items);
|
items);
|
||||||
for (PRUint32 i = 0; i < items.Length(); ++i) {
|
ConstructFramesFromItemList(state, items, aParentFrame, frameItems);
|
||||||
ConstructFramesFromItem(state, items[i], aParentFrame, frameItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!state.mPseudoFrames.IsEmpty()) {
|
|
||||||
ProcessPseudoFrames(state, frameItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIFrame* newFrame = frameItems.childList;
|
nsIFrame* newFrame = frameItems.childList;
|
||||||
*aNewFrame = newFrame;
|
*aNewFrame = newFrame;
|
||||||
|
@ -11564,18 +11547,6 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static*/
|
|
||||||
PRBool
|
|
||||||
nsCSSFrameConstructor::AreAllItemsInline(const nsTArray<FrameConstructionItem>& aItems)
|
|
||||||
{
|
|
||||||
for (PRUint32 i = 0, count = aItems.Length(); i < count; ++i) {
|
|
||||||
if (!aItems[i].mIsAllInline) {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
||||||
FrameConstructionItem& aItem,
|
FrameConstructionItem& aItem,
|
||||||
|
@ -11617,9 +11588,8 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
|
||||||
|
|
||||||
// Process the child content
|
// Process the child content
|
||||||
nsFrameItems childItems;
|
nsFrameItems childItems;
|
||||||
nsresult rv = ConstructFramesFromItemSublist(aState, aItem.mChildItems, 0,
|
nsresult rv = ConstructFramesFromItemList(aState, aItem.mChildItems,
|
||||||
aItem.mChildItems.Length(),
|
newFrame, childItems);
|
||||||
newFrame, childItems);
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
// Clean up?
|
// Clean up?
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -11851,26 +11821,18 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
|
||||||
parentStyleContext, nsCSSPseudoElements::after,
|
parentStyleContext, nsCSSPseudoElements::after,
|
||||||
aParentItem.mChildItems);
|
aParentItem.mChildItems);
|
||||||
|
|
||||||
aParentItem.mIsAllInline = PR_TRUE;
|
aParentItem.mIsAllInline = aParentItem.mChildItems.AreAllItemsInline();
|
||||||
for (PRUint32 i = 0, count = aParentItem.mChildItems.Length();
|
|
||||||
i < count; ++i) {
|
|
||||||
if (!aParentItem.mChildItems[i].mIsAllInline) {
|
|
||||||
aParentItem.mIsAllInline = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
||||||
nsIFrame* aContainingBlock,
|
nsIFrame* aContainingBlock,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
const nsTArray<FrameConstructionItem>& aItems,
|
const FrameConstructionItemList& aItems,
|
||||||
PRBool aIsAppend,
|
PRBool aIsAppend,
|
||||||
nsIFrame* aPrevSibling)
|
nsIFrame* aPrevSibling)
|
||||||
{
|
{
|
||||||
PRUint32 count = aItems.Length();
|
if (aItems.IsEmpty()) {
|
||||||
if (!count) {
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11881,7 +11843,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
||||||
// to be wrapped in blocks.
|
// to be wrapped in blocks.
|
||||||
if (aFrame->IsBoxFrame() &&
|
if (aFrame->IsBoxFrame() &&
|
||||||
!(aFrame->GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
|
!(aFrame->GetStateBits() & NS_STATE_BOX_WRAPS_KIDS_IN_BLOCK) &&
|
||||||
AnyItemsNeedBlockParent(aItems)) {
|
aItems.AnyItemsNeedBlockParent()) {
|
||||||
RecreateFramesForContent(aFrame->GetContent());
|
RecreateFramesForContent(aFrame->GetContent());
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -11900,7 +11862,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
||||||
|
|
||||||
if (IsInlineFrame(aFrame)) {
|
if (IsInlineFrame(aFrame)) {
|
||||||
// Nothing to do if all kids are inline
|
// Nothing to do if all kids are inline
|
||||||
if (AreAllItemsInline(aItems)) {
|
if (aItems.AreAllItemsInline()) {
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
} else if (!IsFrameSpecial(aFrame)) {
|
} else if (!IsFrameSpecial(aFrame)) {
|
||||||
|
@ -11936,13 +11898,13 @@ nsCSSFrameConstructor::WipeContainingBlock(nsFrameConstructorState& aState,
|
||||||
if (aPrevSibling && !aPrevSibling->GetNextSibling()) {
|
if (aPrevSibling && !aPrevSibling->GetNextSibling()) {
|
||||||
// This is an append that won't go through AppendFrames. We can bail out
|
// This is an append that won't go through AppendFrames. We can bail out
|
||||||
// if the last frame we're appending is not inline.
|
// if the last frame we're appending is not inline.
|
||||||
if (!aItems[count-1].mHasInlineEnds) {
|
if (!aItems.IsStartInline()) {
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We can bail out if we're not inserting at the beginning or if
|
// We can bail out if we're not inserting at the beginning or if
|
||||||
// the first frame we're inserting is not inline.
|
// the first frame we're inserting is not inline.
|
||||||
if (aPrevSibling || !aItems[0].mHasInlineEnds) {
|
if (aPrevSibling || !aItems.IsEndInline()) {
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,6 +283,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct FrameConstructionItem;
|
struct FrameConstructionItem;
|
||||||
|
class FrameConstructionItemList;
|
||||||
|
|
||||||
nsresult ReconstructDocElementHierarchyInternal();
|
nsresult ReconstructDocElementHierarchyInternal();
|
||||||
|
|
||||||
|
@ -330,7 +331,7 @@ private:
|
||||||
void AddFrameConstructionItems(nsFrameConstructorState& aState,
|
void AddFrameConstructionItems(nsFrameConstructorState& aState,
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
nsIFrame* aParentFrame,
|
nsIFrame* aParentFrame,
|
||||||
nsTArray<FrameConstructionItem>& aItems);
|
FrameConstructionItemList& aItems);
|
||||||
|
|
||||||
nsresult ConstructDocElementFrame(nsFrameConstructorState& aState,
|
nsresult ConstructDocElementFrame(nsFrameConstructorState& aState,
|
||||||
nsIContent* aDocElement,
|
nsIContent* aDocElement,
|
||||||
|
@ -392,7 +393,7 @@ private:
|
||||||
nsIContent* aContent,
|
nsIContent* aContent,
|
||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
nsIAtom* aPseudoElement,
|
nsIAtom* aPseudoElement,
|
||||||
nsTArray<FrameConstructionItem>& aItems);
|
FrameConstructionItemList& aItems);
|
||||||
|
|
||||||
// This method can change aFrameList: it can chop off the end and
|
// This method can change aFrameList: it can chop off the end and
|
||||||
// put it in a special sibling of aParentFrame. It can also change
|
// put it in a special sibling of aParentFrame. It can also change
|
||||||
|
@ -727,6 +728,63 @@ private:
|
||||||
const FrameConstructionDataByTag* aDataPtr,
|
const FrameConstructionDataByTag* aDataPtr,
|
||||||
PRUint32 aDataLength);
|
PRUint32 aDataLength);
|
||||||
|
|
||||||
|
/* A class representing a list of FrameConstructionItems */
|
||||||
|
class FrameConstructionItemList {
|
||||||
|
public:
|
||||||
|
FrameConstructionItemList() :
|
||||||
|
mInlineCount(0),
|
||||||
|
mLineParticipantCount(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
PRBool IsEmpty() const { return mItems.Length() == 0; }
|
||||||
|
PRBool AnyItemsNeedBlockParent() const { return mLineParticipantCount != 0; }
|
||||||
|
PRBool AreAllItemsInline() const { return mInlineCount == mItems.Length(); }
|
||||||
|
PRBool IsStartInline() const {
|
||||||
|
NS_ASSERTION(!IsEmpty(), "Someone forgot to check IsEmpty()");
|
||||||
|
return mItems[0].mHasInlineEnds;
|
||||||
|
}
|
||||||
|
PRBool IsEndInline() const {
|
||||||
|
NS_ASSERTION(!IsEmpty(), "Someone forgot to check IsEmpty()");
|
||||||
|
return mItems[mItems.Length() - 1].mHasInlineEnds;
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameConstructionItem* AppendItem() {
|
||||||
|
return mItems.AppendElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InlineItemAdded() { ++mInlineCount; }
|
||||||
|
void LineParticipantItemAdded() { ++mLineParticipantCount; }
|
||||||
|
|
||||||
|
class Iterator;
|
||||||
|
friend class Iterator;
|
||||||
|
class Iterator {
|
||||||
|
public:
|
||||||
|
Iterator(FrameConstructionItemList& list) :
|
||||||
|
mList(list.mItems),
|
||||||
|
mPosition(0),
|
||||||
|
mLimit(mList.Length())
|
||||||
|
{}
|
||||||
|
|
||||||
|
operator FrameConstructionItem& () { return mList[mPosition]; }
|
||||||
|
PRBool IsDone() const { return mPosition == mLimit; }
|
||||||
|
void Next() {
|
||||||
|
NS_ASSERTION(mPosition < mLimit, "Should have checked IsDone()!");
|
||||||
|
++mPosition;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
nsTArray<FrameConstructionItem> & mList;
|
||||||
|
PRUint32 mPosition;
|
||||||
|
PRUint32 mLimit;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsTArray<FrameConstructionItem> mItems;
|
||||||
|
PRUint32 mInlineCount;
|
||||||
|
PRUint32 mLineParticipantCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef FrameConstructionItemList::Iterator FCItemIterator;
|
||||||
|
|
||||||
/* A struct representing an item for which frames might need to be
|
/* A struct representing an item for which frames might need to be
|
||||||
* constructed. This contains all the information needed to construct the
|
* constructed. This contains all the information needed to construct the
|
||||||
* frame other than the parent frame and whatever would be stored in the
|
* frame other than the parent frame and whatever would be stored in the
|
||||||
|
@ -771,10 +829,8 @@ private:
|
||||||
PRPackedBool mIsPopup;
|
PRPackedBool mIsPopup;
|
||||||
|
|
||||||
// Child frame construction items.
|
// Child frame construction items.
|
||||||
// Can't be an auto array, since we don't know our size yet, and
|
// Only used for inline frame items for now.
|
||||||
// in any case it would be bad if someone tried to do that...
|
FrameConstructionItemList mChildItems;
|
||||||
// Only used for inline frame items.
|
|
||||||
nsTArray<FrameConstructionItem> mChildItems;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FrameConstructionItem(const FrameConstructionItem& aOther); /* not implemented */
|
FrameConstructionItem(const FrameConstructionItem& aOther); /* not implemented */
|
||||||
|
@ -866,7 +922,7 @@ private:
|
||||||
|
|
||||||
void AddPageBreakItem(nsIContent* aContent,
|
void AddPageBreakItem(nsIContent* aContent,
|
||||||
nsStyleContext* aMainStyleContext,
|
nsStyleContext* aMainStyleContext,
|
||||||
nsTArray<FrameConstructionItem>& aItems);
|
FrameConstructionItemList& aItems);
|
||||||
|
|
||||||
// Function to find FrameConstructionData for aContent. Will return
|
// Function to find FrameConstructionData for aContent. Will return
|
||||||
// null if aContent is not HTML.
|
// null if aContent is not HTML.
|
||||||
|
@ -923,7 +979,7 @@ private:
|
||||||
PRInt32 aNameSpaceID,
|
PRInt32 aNameSpaceID,
|
||||||
nsStyleContext* aStyleContext,
|
nsStyleContext* aStyleContext,
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsTArray<FrameConstructionItem>& aItems);
|
FrameConstructionItemList& aItems);
|
||||||
|
|
||||||
// On success, always puts something in aChildItems
|
// On success, always puts something in aChildItems
|
||||||
nsresult ConstructFramesFromItem(nsFrameConstructorState& aState,
|
nsresult ConstructFramesFromItem(nsFrameConstructorState& aState,
|
||||||
|
@ -1244,17 +1300,14 @@ private:
|
||||||
FrameConstructionItem& aParentItem);
|
FrameConstructionItem& aParentItem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct frames for the indicated range of aItems (half-open; closed on
|
* Construct frames for the given item list and put the resulting frames in
|
||||||
* the aStart end, open on the aEnd end), and put the resulting frames in
|
|
||||||
* aFrameItems. This function will save pseudoframes on entry and restore on
|
* aFrameItems. This function will save pseudoframes on entry and restore on
|
||||||
* exit.
|
* exit.
|
||||||
*/
|
*/
|
||||||
nsresult ConstructFramesFromItemSublist(nsFrameConstructorState& aState,
|
nsresult ConstructFramesFromItemList(nsFrameConstructorState& aState,
|
||||||
nsTArray<FrameConstructionItem>& aItems,
|
FrameConstructionItemList& aItems,
|
||||||
PRUint32 aStart,
|
nsIFrame* aParentFrame,
|
||||||
PRUint32 aEnd,
|
nsFrameItems& aFrameItems);
|
||||||
nsIFrame* aParentFrame,
|
|
||||||
nsFrameItems& aFrameItems);
|
|
||||||
|
|
||||||
// Determine whether we need to wipe out what we just did and start over
|
// Determine whether we need to wipe out what we just did and start over
|
||||||
// because we're doing something like adding block kids to an inline frame
|
// because we're doing something like adding block kids to an inline frame
|
||||||
|
@ -1268,7 +1321,7 @@ private:
|
||||||
PRBool WipeContainingBlock(nsFrameConstructorState& aState,
|
PRBool WipeContainingBlock(nsFrameConstructorState& aState,
|
||||||
nsIFrame* aContainingBlock,
|
nsIFrame* aContainingBlock,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
const nsTArray<FrameConstructionItem>& aItems,
|
const FrameConstructionItemList& aItems,
|
||||||
PRBool aIsAppend,
|
PRBool aIsAppend,
|
||||||
nsIFrame* aPrevSibling);
|
nsIFrame* aPrevSibling);
|
||||||
|
|
||||||
|
@ -1419,16 +1472,6 @@ private:
|
||||||
mCountersDirty = PR_TRUE;
|
mCountersDirty = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether any of the given items requires a block parent
|
|
||||||
*/
|
|
||||||
static PRBool AnyItemsNeedBlockParent(const nsTArray<FrameConstructionItem>& aItems);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether all of the given items are inline
|
|
||||||
*/
|
|
||||||
static PRBool AreAllItemsInline(const nsTArray<FrameConstructionItem>& aItems);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct RestyleData;
|
struct RestyleData;
|
||||||
friend struct RestyleData;
|
friend struct RestyleData;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче