Relanding changes to replace local helpers with new nsLayoutUtils versions. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2007-01-17 08:11:32 +00:00
Родитель 2235524e9e
Коммит 132c672bf5
2 изменённых файлов: 3 добавлений и 29 удалений

Просмотреть файл

@ -2421,20 +2421,11 @@ nsBlockFrame::AttributeChanged(PRInt32 aNameSpaceID,
else if (nsGkAtoms::value == aAttribute) {
const nsStyleDisplay* styleDisplay = GetStyleDisplay();
if (NS_STYLE_DISPLAY_LIST_ITEM == styleDisplay->mDisplay) {
nsIFrame* nextAncestor = mParent;
nsBlockFrame* blockParent = nsnull;
// Search for the closest ancestor that's a block frame. We
// make the assumption that all related list items share a
// common block parent.
// XXXldb I think that's a bad assumption.
while (nextAncestor) {
if (NS_OK == nextAncestor->QueryInterface(kBlockFrameCID,
(void**)&blockParent)) {
break;
}
nextAncestor = nextAncestor->GetParent();
}
nsBlockFrame* blockParent = nsLayoutUtils::FindNearestBlockAncestor(this);
// Tell the enclosing block frame to renumber list items within
// itself

Просмотреть файл

@ -651,24 +651,6 @@ nsHTMLReflowState::CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWid
margin.left + margin.right;
}
static nsIFrame*
FindImmediateChildOf(nsIFrame* aParent, nsIFrame* aDescendantFrame)
{
nsIFrame* result = aDescendantFrame;
while (result) {
nsIFrame* parent = result->GetParent();
if (parent == aParent) {
break;
}
// The frame is not an immediate child of aParent so walk up another level
result = parent;
}
return result;
}
/**
* Returns PR_TRUE iff a pre-order traversal of the normal child
* frames rooted at aFrame finds no non-empty frame before aDescendant.
@ -776,7 +758,8 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
NS_REINTERPRET_CAST(void**, &blockFrame)))) {
// We need the immediate child of the block frame, and that may not be
// the placeholder frame
nsIFrame *blockChild = FindImmediateChildOf(blockFrame, aPlaceholderFrame);
nsIFrame *blockChild =
nsLayoutUtils::FindChildContainingDescendant(blockFrame, aPlaceholderFrame);
nsBlockFrame::line_iterator lineBox = blockFrame->FindLineFor(blockChild);
// How we determine the hypothetical box depends on whether the element