Bug 749055 - Add index parameter to nsDisplayMathMLCharForeground. r=roc

This commit is contained in:
Matt Woodrow 2012-04-27 12:24:54 +12:00
parent bbc1f6b31e
commit 7474fc8aa3
6 changed files with 17 additions and 9 deletions

View File

@ -1899,8 +1899,9 @@ class nsDisplayMathMLCharForeground : public nsDisplayItem {
public:
nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsMathMLChar* aChar,
bool aIsSelected)
: nsDisplayItem(aBuilder, aFrame), mChar(aChar), mIsSelected(aIsSelected) {
PRUint32 aIndex, bool aIsSelected)
: nsDisplayItem(aBuilder, aFrame), mChar(aChar),
mIndex(aIndex), mIsSelected(aIsSelected) {
MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -1934,9 +1935,12 @@ public:
bool snap;
return GetBounds(aBuilder, &snap);
}
virtual PRUint32 GetPerFrameKey() { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
private:
nsMathMLChar* mChar;
PRUint32 mIndex;
bool mIsSelected;
};
@ -1982,6 +1986,7 @@ nsresult
nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
nsIFrame* aForFrame,
const nsDisplayListSet& aLists,
PRUint32 aIndex,
const nsRect* aSelectedRect)
{
nsresult rv = NS_OK;
@ -2026,6 +2031,7 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
}
return aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayMathMLCharForeground(aBuilder, aForFrame, this,
aIndex,
aSelectedRect && !aSelectedRect->IsEmpty()));
}

View File

@ -131,6 +131,7 @@ public:
Display(nsDisplayListBuilder* aBuilder,
nsIFrame* aForFrame,
const nsDisplayListSet& aLists,
PRUint32 aIndex,
const nsRect* aSelectedRect = nsnull);
void PaintForeground(nsPresContext* aPresContext,

View File

@ -236,7 +236,7 @@ nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
mencloseRect.x = mencloseRect.y = 0;
if (IsToDraw(NOTATION_RADICAL)) {
rv = mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists);
rv = mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists, 0);
NS_ENSURE_SUCCESS(rv, rv);
nsRect rect;
@ -249,7 +249,7 @@ nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
if (IsToDraw(NOTATION_LONGDIV)) {
rv = mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists);
rv = mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists, 1);
NS_ENSURE_SUCCESS(rv, rv);
nsRect rect;

View File

@ -220,18 +220,19 @@ nsMathMLmfencedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
////////////
// display fences and separators
PRUint32 count = 0;
if (mOpenChar) {
rv = mOpenChar->Display(aBuilder, this, aLists);
rv = mOpenChar->Display(aBuilder, this, aLists, count++);
NS_ENSURE_SUCCESS(rv, rv);
}
if (mCloseChar) {
rv = mCloseChar->Display(aBuilder, this, aLists);
rv = mCloseChar->Display(aBuilder, this, aLists, count++);
NS_ENSURE_SUCCESS(rv, rv);
}
for (PRInt32 i = 0; i < mSeparatorsCount; i++) {
rv = mSeparatorsChar[i].Display(aBuilder, this, aLists);
rv = mSeparatorsChar[i].Display(aBuilder, this, aLists, count++);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;

View File

@ -140,7 +140,7 @@ nsMathMLmoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
selectedRect = firstChild->GetRect();
isSelected = true;
}
rv = mMathMLChar.Display(aBuilder, this, aLists, isSelected ? &selectedRect : nsnull);
rv = mMathMLChar.Display(aBuilder, this, aLists, 0, isSelected ? &selectedRect : nsnull);
NS_ENSURE_SUCCESS(rv, rv);
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)

View File

@ -134,7 +134,7 @@ nsMathMLmrootFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
/////////////
// paint the sqrt symbol
if (!NS_MATHML_HAS_ERROR(mPresentationData.flags)) {
rv = mSqrChar.Display(aBuilder, this, aLists);
rv = mSqrChar.Display(aBuilder, this, aLists, 0);
NS_ENSURE_SUCCESS(rv, rv);
rv = DisplayBar(aBuilder, this, mBarRect, aLists);