fix reresolve style context to iterate all child lists

This commit is contained in:
peterl%netscape.com 1999-07-18 00:18:45 +00:00
parent 71c53ea754
commit c35106c852
8 changed files with 168 additions and 120 deletions

View File

@ -885,7 +885,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
PRInt32* aLocalChange)
{
// NOTE: using nsFrame's ReResolveStyleContext method to avoid
// useless version in base classes.
// version in container frame that will do our children
PRInt32 ourChange = aParentChange;
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
ourChange, aChangeList,
@ -895,21 +895,6 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != rv) {
if (HaveOutsideBullet() && mBullet) {
nsIStyleContext* newBulletSC;
nsIStyleContext* oldBulletSC = nsnull;
mBullet->GetStyleContext(&oldBulletSC);
aPresContext->ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozListBulletPseudo,
mStyleContext,
PR_FALSE, &newBulletSC);
rv = mBullet->SetStyleContext(aPresContext, newBulletSC);
CaptureStyleChangeFor(this, oldBulletSC, newBulletSC,
ourChange, aChangeList, &ourChange);
NS_RELEASE(oldBulletSC);
NS_RELEASE(newBulletSC);
}
if (aLocalChange) {
*aLocalChange = ourChange;
}
@ -925,6 +910,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Just in case, we update the prev-in-flow's overflow lines too
// XXX try to make this go away....
if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) {
nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines;
if (nsnull != lines) {
@ -932,6 +918,24 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
ourChange, aChangeList);
}
}
// Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
GetAdditionalChildListName(listIndex++, &childList);
while (childList) {
nsIFrame* child = nsnull;
rv = FirstChild(childList, &child);
while ((NS_SUCCEEDED(rv)) && (child)) {
rv = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
}
}
// It is possible that we just acquired first-line style. See if
@ -942,7 +946,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// Now we do have first-line style. Therefore we need to wrap up
// the inline-frames in a first-line frame.
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
rv = WrapFramesInFirstLineFrame(aPresContext);
WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes
// Force a reflow so that the first-line is reflowed properly
aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW);

View File

@ -885,7 +885,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
PRInt32* aLocalChange)
{
// NOTE: using nsFrame's ReResolveStyleContext method to avoid
// useless version in base classes.
// version in container frame that will do our children
PRInt32 ourChange = aParentChange;
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
ourChange, aChangeList,
@ -895,21 +895,6 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != rv) {
if (HaveOutsideBullet() && mBullet) {
nsIStyleContext* newBulletSC;
nsIStyleContext* oldBulletSC = nsnull;
mBullet->GetStyleContext(&oldBulletSC);
aPresContext->ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozListBulletPseudo,
mStyleContext,
PR_FALSE, &newBulletSC);
rv = mBullet->SetStyleContext(aPresContext, newBulletSC);
CaptureStyleChangeFor(this, oldBulletSC, newBulletSC,
ourChange, aChangeList, &ourChange);
NS_RELEASE(oldBulletSC);
NS_RELEASE(newBulletSC);
}
if (aLocalChange) {
*aLocalChange = ourChange;
}
@ -925,6 +910,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Just in case, we update the prev-in-flow's overflow lines too
// XXX try to make this go away....
if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) {
nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines;
if (nsnull != lines) {
@ -932,6 +918,24 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
ourChange, aChangeList);
}
}
// Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
GetAdditionalChildListName(listIndex++, &childList);
while (childList) {
nsIFrame* child = nsnull;
rv = FirstChild(childList, &child);
while ((NS_SUCCEEDED(rv)) && (child)) {
rv = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
}
}
// It is possible that we just acquired first-line style. See if
@ -942,7 +946,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// Now we do have first-line style. Therefore we need to wrap up
// the inline-frames in a first-line frame.
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
rv = WrapFramesInFirstLineFrame(aPresContext);
WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes
// Force a reflow so that the first-line is reflowed properly
aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW);

View File

@ -885,7 +885,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
PRInt32* aLocalChange)
{
// NOTE: using nsFrame's ReResolveStyleContext method to avoid
// useless version in base classes.
// version in container frame that will do our children
PRInt32 ourChange = aParentChange;
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
ourChange, aChangeList,
@ -895,21 +895,6 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != rv) {
if (HaveOutsideBullet() && mBullet) {
nsIStyleContext* newBulletSC;
nsIStyleContext* oldBulletSC = nsnull;
mBullet->GetStyleContext(&oldBulletSC);
aPresContext->ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozListBulletPseudo,
mStyleContext,
PR_FALSE, &newBulletSC);
rv = mBullet->SetStyleContext(aPresContext, newBulletSC);
CaptureStyleChangeFor(this, oldBulletSC, newBulletSC,
ourChange, aChangeList, &ourChange);
NS_RELEASE(oldBulletSC);
NS_RELEASE(newBulletSC);
}
if (aLocalChange) {
*aLocalChange = ourChange;
}
@ -925,6 +910,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Just in case, we update the prev-in-flow's overflow lines too
// XXX try to make this go away....
if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) {
nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines;
if (nsnull != lines) {
@ -932,6 +918,24 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
ourChange, aChangeList);
}
}
// Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
GetAdditionalChildListName(listIndex++, &childList);
while (childList) {
nsIFrame* child = nsnull;
rv = FirstChild(childList, &child);
while ((NS_SUCCEEDED(rv)) && (child)) {
rv = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
}
}
// It is possible that we just acquired first-line style. See if
@ -942,7 +946,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// Now we do have first-line style. Therefore we need to wrap up
// the inline-frames in a first-line frame.
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
rv = WrapFramesInFirstLineFrame(aPresContext);
WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes
// Force a reflow so that the first-line is reflowed properly
aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW);

View File

@ -157,17 +157,26 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != result) {
// Update primary child list
nsIFrame* child;
// Update all children since our context changed
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
result = FirstChild(nsnull, &child);
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
nsIFrame* child;
do {
child = nsnull;
result = FirstChild(childList, &child);
while ((NS_SUCCEEDED(result)) && (child)) {
result = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
// Update overflow list too
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
} while (childList);
// Update overflow list too (XXX this is not just another child list?)
child = mOverflowFrames.FirstChild();
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
result = child->ReResolveStyleContext(aPresContext, mStyleContext,
@ -178,6 +187,8 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// And just to be complete, update our prev-in-flows overflow list
// too (since in theory, those frames will become our frames)
// XXX Eeek, this is potentially re-resolving these frames twice, can this be optimized?
// Better yet, this should just go away, overflow push/pull code should re-resolve
// as needed for parent changes
if (nsnull != mPrevInFlow) {
child = ((nsContainerFrame*)mPrevInFlow)->mOverflowFrames.FirstChild();
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
@ -186,6 +197,7 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
child->GetNextSibling(&child);
}
}
}
return result;
}

View File

@ -885,7 +885,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
PRInt32* aLocalChange)
{
// NOTE: using nsFrame's ReResolveStyleContext method to avoid
// useless version in base classes.
// version in container frame that will do our children
PRInt32 ourChange = aParentChange;
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
ourChange, aChangeList,
@ -895,21 +895,6 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != rv) {
if (HaveOutsideBullet() && mBullet) {
nsIStyleContext* newBulletSC;
nsIStyleContext* oldBulletSC = nsnull;
mBullet->GetStyleContext(&oldBulletSC);
aPresContext->ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozListBulletPseudo,
mStyleContext,
PR_FALSE, &newBulletSC);
rv = mBullet->SetStyleContext(aPresContext, newBulletSC);
CaptureStyleChangeFor(this, oldBulletSC, newBulletSC,
ourChange, aChangeList, &ourChange);
NS_RELEASE(oldBulletSC);
NS_RELEASE(newBulletSC);
}
if (aLocalChange) {
*aLocalChange = ourChange;
}
@ -925,6 +910,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Just in case, we update the prev-in-flow's overflow lines too
// XXX try to make this go away....
if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) {
nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines;
if (nsnull != lines) {
@ -932,6 +918,24 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
ourChange, aChangeList);
}
}
// Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
GetAdditionalChildListName(listIndex++, &childList);
while (childList) {
nsIFrame* child = nsnull;
rv = FirstChild(childList, &child);
while ((NS_SUCCEEDED(rv)) && (child)) {
rv = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
}
}
// It is possible that we just acquired first-line style. See if
@ -942,7 +946,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// Now we do have first-line style. Therefore we need to wrap up
// the inline-frames in a first-line frame.
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
rv = WrapFramesInFirstLineFrame(aPresContext);
WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes
// Force a reflow so that the first-line is reflowed properly
aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW);

View File

@ -885,7 +885,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
PRInt32* aLocalChange)
{
// NOTE: using nsFrame's ReResolveStyleContext method to avoid
// useless version in base classes.
// version in container frame that will do our children
PRInt32 ourChange = aParentChange;
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
ourChange, aChangeList,
@ -895,21 +895,6 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != rv) {
if (HaveOutsideBullet() && mBullet) {
nsIStyleContext* newBulletSC;
nsIStyleContext* oldBulletSC = nsnull;
mBullet->GetStyleContext(&oldBulletSC);
aPresContext->ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozListBulletPseudo,
mStyleContext,
PR_FALSE, &newBulletSC);
rv = mBullet->SetStyleContext(aPresContext, newBulletSC);
CaptureStyleChangeFor(this, oldBulletSC, newBulletSC,
ourChange, aChangeList, &ourChange);
NS_RELEASE(oldBulletSC);
NS_RELEASE(newBulletSC);
}
if (aLocalChange) {
*aLocalChange = ourChange;
}
@ -925,6 +910,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Just in case, we update the prev-in-flow's overflow lines too
// XXX try to make this go away....
if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) {
nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines;
if (nsnull != lines) {
@ -932,6 +918,24 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
ourChange, aChangeList);
}
}
// Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
GetAdditionalChildListName(listIndex++, &childList);
while (childList) {
nsIFrame* child = nsnull;
rv = FirstChild(childList, &child);
while ((NS_SUCCEEDED(rv)) && (child)) {
rv = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
}
}
// It is possible that we just acquired first-line style. See if
@ -942,7 +946,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// Now we do have first-line style. Therefore we need to wrap up
// the inline-frames in a first-line frame.
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
rv = WrapFramesInFirstLineFrame(aPresContext);
WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes
// Force a reflow so that the first-line is reflowed properly
aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW);

View File

@ -885,7 +885,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
PRInt32* aLocalChange)
{
// NOTE: using nsFrame's ReResolveStyleContext method to avoid
// useless version in base classes.
// version in container frame that will do our children
PRInt32 ourChange = aParentChange;
nsresult rv = nsFrame::ReResolveStyleContext(aPresContext, aParentContext,
ourChange, aChangeList,
@ -895,21 +895,6 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != rv) {
if (HaveOutsideBullet() && mBullet) {
nsIStyleContext* newBulletSC;
nsIStyleContext* oldBulletSC = nsnull;
mBullet->GetStyleContext(&oldBulletSC);
aPresContext->ResolvePseudoStyleContextFor(mContent,
nsHTMLAtoms::mozListBulletPseudo,
mStyleContext,
PR_FALSE, &newBulletSC);
rv = mBullet->SetStyleContext(aPresContext, newBulletSC);
CaptureStyleChangeFor(this, oldBulletSC, newBulletSC,
ourChange, aChangeList, &ourChange);
NS_RELEASE(oldBulletSC);
NS_RELEASE(newBulletSC);
}
if (aLocalChange) {
*aLocalChange = ourChange;
}
@ -925,6 +910,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
// Just in case, we update the prev-in-flow's overflow lines too
// XXX try to make this go away....
if (NS_SUCCEEDED(rv) && (nsnull != mPrevInFlow)) {
nsLineBox* lines = ((nsBlockFrame*)mPrevInFlow)->mOverflowLines;
if (nsnull != lines) {
@ -932,6 +918,24 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
ourChange, aChangeList);
}
}
// Update other child lists, but not the primary list, this gets bullets, floaters and subclass lists
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
GetAdditionalChildListName(listIndex++, &childList);
while (childList) {
nsIFrame* child = nsnull;
rv = FirstChild(childList, &child);
while ((NS_SUCCEEDED(rv)) && (child)) {
rv = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
}
}
// It is possible that we just acquired first-line style. See if
@ -942,7 +946,7 @@ nsBlockFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// Now we do have first-line style. Therefore we need to wrap up
// the inline-frames in a first-line frame.
mState |= NS_BLOCK_HAS_FIRST_LINE_STYLE;
rv = WrapFramesInFirstLineFrame(aPresContext);
WrapFramesInFirstLineFrame(aPresContext); // XXX this needs to collect change info from style context changes
// Force a reflow so that the first-line is reflowed properly
aChangeList->AppendChange(this, NS_STYLE_HINT_REFLOW);

View File

@ -157,17 +157,26 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
}
if (NS_COMFALSE != result) {
// Update primary child list
nsIFrame* child;
// Update all children since our context changed
PRInt32 listIndex = 0;
nsIAtom* childList = nsnull;
PRInt32 childChange;
result = FirstChild(nsnull, &child);
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
nsIFrame* child;
do {
child = nsnull;
result = FirstChild(childList, &child);
while ((NS_SUCCEEDED(result)) && (child)) {
result = child->ReResolveStyleContext(aPresContext, mStyleContext,
ourChange, aChangeList, &childChange);
child->GetNextSibling(&child);
}
// Update overflow list too
NS_IF_RELEASE(childList);
GetAdditionalChildListName(listIndex++, &childList);
} while (childList);
// Update overflow list too (XXX this is not just another child list?)
child = mOverflowFrames.FirstChild();
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
result = child->ReResolveStyleContext(aPresContext, mStyleContext,
@ -178,6 +187,8 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
// And just to be complete, update our prev-in-flows overflow list
// too (since in theory, those frames will become our frames)
// XXX Eeek, this is potentially re-resolving these frames twice, can this be optimized?
// Better yet, this should just go away, overflow push/pull code should re-resolve
// as needed for parent changes
if (nsnull != mPrevInFlow) {
child = ((nsContainerFrame*)mPrevInFlow)->mOverflowFrames.FirstChild();
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
@ -186,6 +197,7 @@ nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
child->GetNextSibling(&child);
}
}
}
return result;
}